[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 20:55:24 GMT 2020


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

--- Comment #4 from Alisdair Meredith <alisdairm at me dot com> ---
(In reply to Andrew Pinski from comment #3)

> I miss-remembered the issue, the issue was only with preprocessor directives
> inside macro functions (this changed in GCC 3.3 and above really).
> 
> But I still think both line #s are correct.  is the line at the opening of
> the macro function or the closing?

I have been bitten by that UB as well in the past, and can see the confusion :)

I believe I got it backwards in my previous message:
historically gcc and other compilers produced __LINE__ from the closing paren,
and from gcc 9 it is now determined by the opening paren.


More information about the Gcc-bugs mailing list