[Bug preprocessor/94535] __LINE__ value changed for function-like macro invocations spanning multiple lines

alisdairm at me dot com gcc-bugzilla@gcc.gnu.org
Wed Apr 8 21:33:20 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94535

--- Comment #10 from Alisdair Meredith <alisdairm at me dot com> ---
And double-checking the C++ Standard again, I think I have wording in favor of
my report and contradicting the recommended best practice for the pending C
standard:

[cpp.line]p2 "The line number of the current source line is one greater than
the
number of new-line characters read or introduced in translation phase 1 (5.2)
while processing the source file to the current token."

We will not start interpreting the tokens for macro expansion until after
seeing
the closing paren for the invocation, which means counting all the newlines up
to
the closing paren, and so reporting the higher line number.

The joys of a shared pre-processor specification.


More information about the Gcc-bugs mailing list