is "-ifoobar.h=dir/foobar.h" possible?

Ian Lance Taylor iant@google.com
Fri Aug 12 04:23:00 GMT 2011


Mark Galeck <mark_galeck@pacbell.net> writes:

> Windriver's diab C/++ compiler had this incredibly useful option for a long 
> time:
>
> -ifoobar.h=dir/foobar.h
>
> This means to the preprocessor, 
>
> "whenever you find 
>
> #include "foobar.h"
> or 
> #include <foobar.h>
>
> in the code, replace foobar.h with dir/foobar.h "
>
>
> This option makes all other header file search options obsolete, in fact the 
> whole "search" is obsolete, which means compilation is fastest, and also if you 
> have multiple files in the filesystem with the same name, it is trivial to point 
> which is the one you want to include (with thousands of files and copies all 
> over the place, it can be very difficult to arrange traditional -I options so 
> that all the correct header files are picked up, and not the unwanted copies).  
>
>
>
>
> Is anything like that planned for gcc?  Possible?  

As far as I know, no such option is planned for gcc.

It's certainly possible.  See the existing support for a header.gcc file
in libcpp/files.c.

Ian



More information about the Gcc-help mailing list