On Mon, 13 Feb 2017, Martin Sebor wrote: >> +The predefined macros @code{__FILE__}, @code{__LINE__}, @code{__DATE__}, >> +and @code{__TIME__} are excluded from this list because their replacements >> +may change from one line of output to the next. >> >> Is this ("their replacements may change") truefor __FILE__ as well? >> >> In any case, this may be too nit-picking, and the patch looks fine >> to me. > Thanks. __FILE__ too can change between different lines of output: > by means of a #line directive.
Good point, I did not think of that. > I actually think it would be preferable if GCC printed the value of > __FILE__ and all the other macros, including the four mentioned here. > But since in response to the bug report Andrew implied that not > printing them is intentional I figured I'd just update the docs > and resolve this old bug (raised in 2009). > > That said, I find the argument that these four are special because > their value can change from line to line a weak one given that the > definition of any predefined macro can change (simply by undefining > and redefining it something else). > > Is there a better argument for not printing __FILE__ et al? Do we > want to document this or change GCC to print all macros? My personal opinion is that -dM is a debugging option and so special- casing the four macros does not seem necessary, or at least not very important. So either proceed with your patch that documents the status quo (and my original "patch looks fine to me" stands as approval if you need any), or follow your proposal to remove that special case. What do the C/C++/cpp maintainers think? Gerald