changes in -Wall

Dimitri PAPADOPOULOS-ORFANOS papadopo@shfj.cea.fr
Thu Sep 10 09:58:00 GMT 1998


Jeffrey A Law <law@cygnus.com> writes:
>   In message < 199809071523.RAA05630@orcanie.shfj.cea.fr >you write:
>   > Here is an excerpt of the documentation of the GNU C compiler:
>   > 
>   > 	`-Wunknown-pragmas'
>   > 	     Warn when a #pragma directive is encountered which is not
>   > 	     understood by GCC.  If this command line option is used, warnings
>   > 	     will even be issued for unknown pragmas in system header files.
>   > 	     This is not the case if the warnings were only enabled by the
>   > 	     `-Wall' command line option.
>   > 	
>   > 	`-Wall'
>   > 	     All of the above `-W' options combined.  This enables all the
>   > 	     warnings about constructions that some users consider
>   > 	     questionable, and that are easy to avoid (or modify to prevent the
>   > 	     warning), even in conjunction with macros.
>   > 
>   > Using egcs-1.1b on Solaris 2.5.1, I compile a C++ file using the
>   > following options:
>   > 	-ansi
>   > 	-O3
>   > 	-fPIC
>   > 	-Wall
>   > 
>   > I keep getting warnings in system headers:
>   > 
>   > * The first one seems in contradiction with the documentation:
>   >   	/usr/openwin/include/GL/gl.h:1: warning: ignoring pragma: ignored
> I'd bet /usr/openwin isn't considered a system header by the compiler.
> 
> Generally system headers are those which live under /usr/include.

OK. But this problem didn't occur in egcs-1.0.3a.
What has changed? Why?

Note that the header
	/usr/openwin/include/GL/gl.h
belongs to the OpenGL developpement package. This package is optional
on Solaris. Nevertheless, I consider it to be a system file. After all,
hardware 3D acceleration cards are accessed through this API.

>   > * The second one is not in contradiction with the documentation.
>   >   However, using -Wall, I used not to get this warning - up to
>   >   egcs-1.0.3a. It is of course very annoying, as X11 headers are full
>   >   of such function declarations. How to shut up this warning and keep
>   >   the -Wall option in the same time?
>   >   	/usr/openwin/include/X11/Xutil.h:867: warning: return-type of `XXorRegi
>   > on' defaults to `int'
>   > 
>   > Is this a bug? What should I do to correct it?
> This is a bug in the  X11 header files, not egcs.

Of course. Sun's system headers are also full of bugs.
I understand that some of them are rewritten by egcs in
	lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.57/include
But what's the point of reporting warnings in system files?
Do we expect users of egcs to correct the X11 headers?

I just want to point out that these warnings did not appear
in egcs-1.0.3a.
What has changed? Why?
In the meantime, I'll use `-Wno-return-type' with `-Wall'.

--
Dimitri Papadopoulos



More information about the Gcc-bugs mailing list