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 14:57:02 -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 14:57 -------
(In reply to comment #3)
> And why do you think we should warn here because the redefine is in a system
header file?
The user gets an unexpected value for their define. I wanted BLOCK_SIZE to be
4096, and I wanted the value of BLKBSZGET. I didn't know that linux/fs.h defines
BLOCK_SIZE, and I assumed that if it did I'd get a warning.
As it was, my code was silently broken.
Also you
> should not be including the kernel headers in user land programs.
I needed an ioctl definition. But this is true for non-kernel headers as well:
// define some options:
#define O_SCP 1 // use /usr/bin/scp
#define O_WGET 2 // use /usr/bin/wget
#define O_RSYNC 3 // use /usr/bin/rsync
// ...
#include <fcntl.h> // oops: silently redefines O_RSYNC
The user may not be aware that O_RSYNC exists.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16358