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 function-like macro invocations spanning multiple lines
Date: Wed, 08 Apr 2020 21:33:20 +0000	[thread overview]
Message-ID: <bug-94535-4-E3weLSY2Qm@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 #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.

  parent reply	other threads:[~2020-04-08 21: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 ` [Bug preprocessor/94535] __LINE__ value changed for funciton " alisdairm at me dot com
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 [this message]
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-E3weLSY2Qm@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).