------- Comment #4 from msebor at gmail dot com 2009-10-02 18:00 ------- I understand that the values of __FILE__ and __LINE__ change within the same translation unit and thus may not be meaningful in the output of -dM -E. But the values of __DATE__ and __TIME__ do not change within a translation unit and so they could and IMO should be included in the output.
In any case, since the preprocessed output contains all the standard macros expanded, I think it's reasonable to either see them all in the output of -dM -E or the discrepancies between the two kinds of output to be mentioned in the docs. I don't insist on including an exhaustive list of all macros excluded from the output if this list is large or changes depending on compiler options etc. but I do think that the docs ought to be clarified so as not to state that *all* macros are output. Here's a small test program to show the discrepancies: $ cat u.c && gcc -E u.c && gcc -E -dM u.c | grep -e__DATE__ -e__FILE__ -e__LINE__ -e__STDC__ -e__STDC_HOSTED__ -e__STDC_VERSION__ -e__TIME__ char date[] = __DATE__; int line = __LINE__; char file[] = __FILE__; char time[] = __TIME__; int stdc = __STDC__; int stdc_hosted = __STDC_HOSTED__; # 1 "u.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "u.c" char date[] = "Oct 2 2009"; int line = 2; char file[] = "u.c"; char time[] = "11:52:51"; int stdc = 1; int stdc_hosted = 1; #define __STDC_HOSTED__ 1 #define __STDC__ 1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41540