If the following line is present in an include file, test_base_file.h: char *base_file = __BASE_FILE__;
And it is included as follows: gcc -include test_base_file.h test_base_file.c -o test_base_file The base file value will be printed as follows: base file = <command line> by this main program: #include <stdio.h> int main () { printf ("base file = %s\n", base_file); } If the program is changed ton include test_base_file.h directly and the -include switch is removed from the command line, the expected result ("test_base_file.c") is printed. This behavior was noted in GCC 3.0, and is still present in 4.2.0. I think that it is likely in the development head version as well, but have not verified that. -- Summary: __BASE_FILE__ does not expand correctly when included from the command line Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gary at intrepid dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33919