public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "alisdairm at me dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/94535] __LINE__ value changed for funciton macro invocations spanning multiple lines
Date: Wed, 08 Apr 2020 20:33:54 +0000	[thread overview]
Message-ID: <bug-94535-4-yHdwsmmb4F@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94535-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Alisdair Meredith <alisdairm at me dot com> ---
Thanks for the speedy response, really appreciated!

I believe this is well-defined behavior, but can accept that the value of
__LINE__ may be unspecified - I do struggle with pre-processor wording.

There is no multiline "macro function" here, there is an invocation of a macro,
and the invocation spans multiple lines.  Our actual use case looks more like:

   INVOKE_MACRO(ARG1,
                ARG2,
                ARG3);

Where the line-wraps are forced by coding convention and line-length limits. 
This is not a control-line that defined a macro, so I believe the token
sequence is taken after discarding irrelevant whitespace.  The issue is whether
__LINE__ should correspond to the line with the opening paren, the closing
paren, or one of the lines in-between.  Until gcc9, AFAICT, all compilers
agreed on the line with the opening paren.  Even if it is unspecified behavior
(so free to choose) it would be helpful to preserve a compatibility with past
gcc compilers, and all other tested compilers, unless there is a strong reason
to want the change.  If there were more compiler divergence on the issue, I
would be less concerned.

  parent reply	other threads:[~2020-04-08 20:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 20:17 [Bug preprocessor/94535] New: __LINE__ value changed for " alisdairm at me dot com
2020-04-08 20:21 ` [Bug preprocessor/94535] " pinskia at gcc dot gnu.org
2020-04-08 20:33 ` alisdairm at me dot com [this message]
2020-04-08 20:48 ` [Bug preprocessor/94535] __LINE__ value changed for function-like " pinskia at gcc dot gnu.org
2020-04-08 20:55 ` alisdairm at me dot com
2020-04-08 20:57 ` pinskia at gcc dot gnu.org
2020-04-08 21:00 ` msebor at gcc dot gnu.org
2020-04-08 21:18 ` alisdairm at me dot com
2020-04-08 21:20 ` alisdairm at me dot com
2020-04-08 21:33 ` alisdairm at me dot com
2020-04-08 21:36 ` msebor at gcc dot gnu.org
2020-04-09  8:25 ` jakub at gcc dot gnu.org
2020-05-15 14:04 ` alisdairm at me dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94535-4-yHdwsmmb4F@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).