> Date: Thu, 16 Mar 2023 01:58:48 +0900
> From: Izumi Tsutsui <tsut...@ceres.dti.ne.jp>
> 
> > Proposal: Forbid extern declarations in .c files.
>  :
> > Pretty simple.  Any objections?
> 
> No objection, but I wonder how we can resolve this case:
>  
> https://nxr.netbsd.org/xref/src/sys/arch/hp300/stand/common/if_le.c?r=1.14#101
> 
> ---
> extern struct netif_stats     le_stats[];
> 
> static struct netif_dif le_ifs[] = {
> /*    dif_unit        dif_nsel        dif_stats       dif_private     */
> {     0,              NLE0CONF,       &le_stats[0],   le0conf,        },
> };
> #define NLE_IFS (sizeof(le_ifs) / sizeof(le_ifs[0]))
> 
> struct netif_stats le_stats[NLE_IFS];

Two options:

1. If le_stats is used outside this file, move the extern declaration
   to a common .h file used by if_le.c and all users of le_stats.

2. If le_stats is used only inside this file, replace `extern' by
   `static' and add `static' to the definition.  No need for extern
   here.  The forward declaration inside the .c file would still be
   allowed under this change.

Reply via email to