Subject: Re: patch to add rfc2228 support to ftpd
To: Johan Danielsson <joda@pdc.kth.se>
From: Aidan Cully <aidan@kublai.com>
List: tech-userlevel
Date: 03/27/2002 06:51:18
On Wed, Mar 27, 2002 at 11:59:38AM +0100, Johan Danielsson wrote:
> $ gcc -Wshadow -Wall -c x.c
> x.c: In function `foo':
> x.c:8: warning: declaration of `sin' shadows global declaration
> $ gcc -Wshadow -Wall -c x.c -E | grep sin
>         u_int8_t        sin_len;
>         __sa_family_t   sin_family;
>         u_int16_t       sin_port;
>         struct in_addr  sin_addr;
>         __int8_t                sin_zero[8];
>         u_int8_t        sin6_len;        
>         __sa_family_t   sin6_family;     
>         u_int16_t       sin6_port;       
>         u_int32_t       sin6_flowinfo;   
>         struct in6_addr sin6_addr;       
>         u_int32_t       sin6_scope_id;   
>     struct sockaddr_in *sin;
>     sin = 0 ;
> 
> So there is no globally declared "sin" and yet it complains about it.

I noticed that...  I looked at the gcc manpage, and saw
       -fno-builtin
              Don't recognize built-in functions that do not  be-
              gin  with  two leading underscores.  Currently, the
              functions affected include _exit, abort, abs, allo-
              ca,  cos,  exit,  fabs,  labs, memcmp, memcpy, sin,
              sqrt, strcmp, strcpy, and strlen.

              The `-ansi' option prevents alloca and  _exit  from
              being builtin functions.
bash-2.05$ gcc -Wall -Wshadow -c x.c
x.c: In function `test':
x.c:7: warning: declaration of `sin' shadows global declaration
bash-2.05$ gcc -Wall -Wshadow -c -fno-builtin x.c
bash-2.05$ 

--aidan