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 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


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