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

Reply via email to