This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cpp oddities. was: sparc-sun-solaris2.8 headers: fixinc, cpplib


Robert Lipe wrote:-

> After:
> 
> $ ./xgcc -c -Wall -B./ -I./ /tmp/z.c
> include/sys/stat.h:246: warning: `stat' defined but not used
> include/sys/stat.h:256: warning: `fstat' defined but not used
> include/sys/stat.h:269: warning: `lstat' defined but not used
> include/sys/stat.h:282: warning: `statlstat' defined but not used
> 
> So it does clean up the warnings about system pragmas.

OK, so that means the front end now has the correct concept of line
numbers (per Gerald's confirmation) and sysheader-ness (shown above,
partially).

I would imagine the above warning does not check for being in a system
header before being issued.

Really, we want all front end warnings to check for being in a system
header; that's what CPP does.  It's simplest to do that in the warning
routines, not in each place we might issue a warning (which is what we
seem to do now).

> Another mystery to me is that this behaves differently if it's manually
> preprocessed vs. letting the wrapper do it.
> 
> $ ./xgcc -E -Wall -B./ -I./ /tmp/z.c > /tmp/x.i
> (robertl) rjlhome:/play/negcs/gcc
> $ ./xgcc -B./ -c -Wall /tmp/x.i
> [ no warnings ] 

That is strange; I don't understand.  Something is wrong there.  This
would seem to indicate that we do check for system headerness, but it
is still not quite right unless the file is preprocessed.  However,
for a preprocessed file to get it right must mean stand-alone CPP got
it right, so why couldn't the front end?

> Stranger still, adding -P results in an incredibly ugly file.
> 
> $ ./xgcc -E -P -Wall -B./ -I./ /tmp/z.c  | head -20
> #pragma comment(exestr, "@(#) stat.h 26.2 95/11/30 ")
> #pragma comment(exestr, "@(#) types.h 26.3 95/11/30 ")
> #pragma pack(4)
> typedef
>         long
>                         daddr_t
>                                ;
> typedef
>         char
>              *
>                         caddr_t
>                                ;
> typedef
>         struct
>                {
>                  int
>                      r
>                       [
>                        1
>                         ]
> 
> 
> Are these all related?   Dunno.

Interesting; this should be a simple fix in stand-alone CPP.  A test
case should be easy for this, too.

I'll commit the change, which has bootstrapped for me without
regressions, and get back to look at these.

Neil.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]