This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/16358] -Wno-system-headers hides warning caused by user header vs system header conflict
- From: "avi at exanet dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jul 2004 16:07:55 -0000
- Subject: [Bug preprocessor/16358] -Wno-system-headers hides warning caused by user header vs system header conflict
- References: <20040704080514.16358.avi@exanet.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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