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:18:21 +0000	[thread overview]
Message-ID: <bug-94535-4-9qOjIrQOfo@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 #8 from Alisdair Meredith <alisdairm at me dot com> ---
(In reply to Andrew Pinski from comment #6)
> Why not do this:
> static_assert(X == 3 || X == 4);
> 
> There that works for both cases.

The code example was intended to the be smallest reproducible example that
shows the value changing.  The typical failure we see is unit tests for our
testing framework, validating the message coming from our testing assert macros
and similar.  We format the error message we expect to see with a value offset
from the current line, to verify that the message captured writing to the
console (which we redirect for comparison) is the same.

We now need to adjust those tests, and similar, to account for the __LINE__
number varying in some testing invocations - which is doable.  My concern is
how many other folks are waiting to upgrade to gcc 9 and stumble over the same
issue?  If it is a dark enough corner, then maybe none :)

If this were to revert to historical behavior for gcc 10, we would just skip
those particular formatting tests on gcc9, as we have enough test coverage with
other compilers to have confidence in the message we output, and when actual
tests fire in production, they will still point to a valid line for our test
asserts.

  parent reply	other threads:[~2020-04-08 21:18 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 [this message]
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-9qOjIrQOfo@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).