public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
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 v2] c++: Don't quote nothrow in diagnostic
Date: Tue, 27 Sep 2022 09:19:10 -0400	[thread overview]
Message-ID: <4dd7ed71-d49a-2c9e-5cc4-8b3409af3cba@redhat.com> (raw)
In-Reply-To: <CAFiYyc2wkv+FdWGQeHOwUF5LkyYjHS55Y8NBtYVQXYhrSTm13g@mail.gmail.com>

On 9/27/22 04:41, Richard Biener wrote:
> On Mon, Sep 26, 2022 at 9:54 PM Marek Polacek <polacek@redhat.com> wrote:
>>
>> On Mon, Sep 26, 2022 at 12:34:04PM -0400, Jason Merrill wrote:
>>> 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?
>>
>> Understood.
>>
>>> 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.
>>
>> Like below?   Bootstrapped/regtested on x86_64-pc-linux-gnu.
> 
> Yes.  I assume that terms like "nothrow constructible" are used in the
> C++ standard?

Not in the language, only in library names like 
std::is_nothrow_constructible.

Jason


      parent reply	other threads:[~2022-09-27 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 18:40 [PATCH] " Marek Polacek
2022-09-26  7:50 ` Richard Biener
2022-09-26 16:34   ` Jason Merrill
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 [this message]

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=4dd7ed71-d49a-2c9e-5cc4-8b3409af3cba@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).