RFC: case insensitive for #include

Chris Lattner clattner@apple.com
Wed Jan 28 20:24:00 GMT 2009


On Jan 28, 2009, at 11:51 AM, H.J. Lu wrote:

> Hi,
>
> I got a request to try "FOO.H" if foo.h doesn't exist when dealing
> with
>
> #include "foo.h"
>
> Any comments?

I strongly recommend against this, unless this is only a "last chance"  
fall back.

 From a performance standpoint, if you have -Idir1 -Idir2 -Idir3, you  
don't want to stat all variants of "foo.h" in dir1 before moving on to  
dir2.  If you do a full search for foo.h in all appropriate search  
paths, and then redo it only on failure, then the performance issue  
goes away.  However, in that  case you get very difficult to explain  
behavior if you have multiple files with spelling variants of foo.h in  
different search paths.

-Chris



More information about the Gcc mailing list