[Bug c++/26467] New: GCC 4.0 not case-aware where GCC 3 was

tgamblin at cs dot unc dot edu gcc-bugzilla@gcc.gnu.org
Sat Feb 25 18:05:00 GMT 2006


I'm trying to compile a project under mac os x with gcc 4.0.1 that worked fine
under gcc 3.3.  I have code that looks something like this:

src/
    inc/
        Assert.h
    test.C

Basically, with Assert.h inside some other directory from the one that contains
test.C.  I provide -I inc to g++ when I compile.  If I #include <assert.h> from
test.C, it will find Assert.h from my project under gcc 4, but under gcc 3.3,
it would find the system header.  Also, if I #include <cassert>, it finds the
system's cassert header, but the nested #include <assert.h> there finds my
Assert.h.  on gcc 3.3, both of these found the system header as expected.  I
can compile the project ok using -I-, but I know that if other projects have
similar problems this might not work, so I'm filing a bug.

I'm wondering why this worked under gcc 3.3, since the documentation for -I
says:

> Directories named by -I are searched before the standard system include directories. 

So gcc 3 should have found my Assert.h, too!  Was gcc-3 aware of
case-preservation in HFS+?  Did it check to make sure case matched even though
the filesystem didn't?  And why can't gcc 4 do this as well?

Finally, I want to point out that gcc takes a lot of pains to make sure system
includes work as intended, but in this case it's possible for a *system* header
(cassert) to include MY header (Assert.h) instead of the header that was
obviously intended (the standard c assert.h).  Should it really be possible for
users to break the intent of standard library writers by using headers of the
same (or equivalent) names?  Shouldn't #pragma GCC system_header ensure that
any #includes in the header containing #pragma are ONLY searched in the
standard include directories, in addition to what it already does?


-- 
           Summary: GCC 4.0 not case-aware where GCC 3 was
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tgamblin at cs dot unc dot edu
  GCC host triplet: powerpc-darwin-macosx


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



More information about the Gcc-bugs mailing list