------- Comment #1 from joseph at codesourcery dot com 2009-06-15 01:01 ------- Subject: Re: New: Option -I and POSIX conformance (c99 utility)
On Mon, 15 Jun 2009, vincent at vinc17 dot org wrote: > As you can see, there is a difference for standard system include directories, > for which the option is ignored. This sounds like it is mainly a defect in POSIX; it should make it undefined behavior if you pass a -I option pointing to any directory that contains a file with the same name as any standard header (recall that standard headers do not need to correspond to physical files with the same name). Changing the search order of system directories is clearly liable to break any implementation that deliberately has more than one file of a name for some reason (maybe GCC's limits.h and glibc's version can cope with either order of inclusion, but I see no reason for a requirement for implementations to follow that), and pointing to a user's own file with the same name as a standard header is bound to cause breakage. C99 has such an undefined behavior rule in 7.1.2#3; POSIX just needs to extend it to the POSIX system headers as well. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40442