This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug preprocessor/16358] -Wno-system-headers hides warning caused by user header vs system header conflict


------- Additional Comments From avi at exanet dot com  2004-07-04 16:07 -------
(In reply to comment #5)
> Since O_RSYNC is reserved by the UNIX standard that part is invalid.  Yes
there is such a thing, see 
> <http://www.opengroup.org/onlinepubs/007908799/xsh/open.html> for the standard
definition.

If it is reserved, my code shouldn't compile if I define it.

if I do

  #include <fcntl.h>
  #define O_RSYNC blah

I get a warning. If I switch the order of the lines, I don't. The code compiles
after silently overriding my #define.



> 
> If you do not know what the marcos you are being in by using the headers why
are you bring in the 
> headers. 

Say I wanted O_SYNC, and knew about that. Or I included some other file that
included it. In a complex program a very large amount of headers can be expected
to be used. It's unreasonable to expect the user to know about all defines in a
header (did you know about O_RSYNC? I didn't).

 Also it is always custumary to include system headers first and then do the
defines/includes 
> of the user headers and you will never run into this.

This is a valid workaround.

> 
> Again this is invalid as the redefinition is the system header and the system
header depends on the 
> macros being defined right.

The code _is_ invalid, no doubt. I just want a warning, that's all. Shouldn't
gcc reject invalid code?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16358


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