From: Jason Merrill <jason@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>,
Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Don't quote nothrow in diagnostic
Date: Mon, 26 Sep 2022 12:34:04 -0400 [thread overview]
Message-ID: <5b9a9ee4-f6ed-14d3-b069-e3222739f8d2@redhat.com> (raw)
In-Reply-To: <CAFiYyc1Ph+sHE_P9uuoFj-hSoWhpeo+-zzvPY=bs=J-sYQ-U9g@mail.gmail.com>
On 9/26/22 03:50, Richard Biener wrote:
> On Fri, Sep 23, 2022 at 8:41 PM Marek Polacek via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> In <https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602057.html>
>> Jason noticed that we quote "nothrow" in diagnostics even though it's
>> not a keyword in C++. Just removing the quotes didn't work because
>> then -Wformat-diag complains, so this patch replaces it with "no-throw".
>>
>> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
>
> That doesn't look like an improvement to me. Can we quote 'nothrow()' instead?
nothrow() is a syntax error; the C++11 keyword is 'noexcept'.
std::nothrow is a dummy placement argument used to indicate that a
new-expression should return null rather than throw on failure.
But bizarrely, the library traits use the word "nothrow". Marek's patch
clarifies that we are not trying to refer to anything in the language.
> I'd rather leave it alone than changing it to no-throw. Why does -Wformat-diag
> complain? If we shouldn't quote nothrow that should be adjusted?
I think -Wformat-diag complains because "nothrow" is an attribute; it
also includes some other attribute names in the list of "keywords".
I would also be fine with just removing the quotes and removing nothrow
from c_keywords.
Jason
next prev parent reply other threads:[~2022-09-26 16:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 18:40 Marek Polacek
2022-09-26 7:50 ` Richard Biener
2022-09-26 16:34 ` Jason Merrill [this message]
2022-09-26 19:54 ` [PATCH v2] " Marek Polacek
2022-09-27 8:41 ` Richard Biener
2022-09-27 13:00 ` Marek Polacek
2022-09-27 13:19 ` Jason Merrill
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=5b9a9ee4-f6ed-14d3-b069-e3222739f8d2@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=polacek@redhat.com \
--cc=richard.guenther@gmail.com \
/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).