From: Richard Biener <richard.guenther@gmail.com>
To: Marek Polacek <polacek@redhat.com>
Cc: Jason Merrill <jason@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Don't quote nothrow in diagnostic
Date: Mon, 26 Sep 2022 09:50:02 +0200 [thread overview]
Message-ID: <CAFiYyc1Ph+sHE_P9uuoFj-hSoWhpeo+-zzvPY=bs=J-sYQ-U9g@mail.gmail.com> (raw)
In-Reply-To: <20220923184026.379494-1-polacek@redhat.com>
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?
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?
>
> gcc/cp/ChangeLog:
>
> * constraint.cc (diagnose_trait_expr): Say "no-throw" (without quotes)
> rather than "nothrow" in quotes.
>
> gcc/testsuite/ChangeLog:
>
> * g++.dg/cpp2a/concepts-traits3.C: Adjust expected diagnostics.
> ---
> gcc/cp/constraint.cc | 14 +++++++-------
> gcc/testsuite/g++.dg/cpp2a/concepts-traits3.C | 8 ++++----
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
> index 5839bfb4b52..136647f7c9e 100644
> --- a/gcc/cp/constraint.cc
> +++ b/gcc/cp/constraint.cc
> @@ -3592,13 +3592,13 @@ diagnose_trait_expr (tree expr, tree args)
> switch (TRAIT_EXPR_KIND (expr))
> {
> case CPTK_HAS_NOTHROW_ASSIGN:
> - inform (loc, " %qT is not %<nothrow%> copy assignable", t1);
> + inform (loc, " %qT is not no-throw copy assignable", t1);
> break;
> case CPTK_HAS_NOTHROW_CONSTRUCTOR:
> - inform (loc, " %qT is not %<nothrow%> default constructible", t1);
> + inform (loc, " %qT is not no-throw default constructible", t1);
> break;
> case CPTK_HAS_NOTHROW_COPY:
> - inform (loc, " %qT is not %<nothrow%> copy constructible", t1);
> + inform (loc, " %qT is not no-throw copy constructible", t1);
> break;
> case CPTK_HAS_TRIVIAL_ASSIGN:
> inform (loc, " %qT is not trivially copy assignable", t1);
> @@ -3674,7 +3674,7 @@ diagnose_trait_expr (tree expr, tree args)
> inform (loc, " %qT is not trivially assignable from %qT", t1, t2);
> break;
> case CPTK_IS_NOTHROW_ASSIGNABLE:
> - inform (loc, " %qT is not %<nothrow%> assignable from %qT", t1, t2);
> + inform (loc, " %qT is not no-throw assignable from %qT", t1, t2);
> break;
> case CPTK_IS_CONSTRUCTIBLE:
> if (!t2)
> @@ -3690,9 +3690,9 @@ diagnose_trait_expr (tree expr, tree args)
> break;
> case CPTK_IS_NOTHROW_CONSTRUCTIBLE:
> if (!t2)
> - inform (loc, " %qT is not %<nothrow%> default constructible", t1);
> + inform (loc, " %qT is not no-throw default constructible", t1);
> else
> - inform (loc, " %qT is not %<nothrow%> constructible from %qE", t1, t2);
> + inform (loc, " %qT is not no-throw constructible from %qE", t1, t2);
> break;
> case CPTK_HAS_UNIQUE_OBJ_REPRESENTATIONS:
> inform (loc, " %qT does not have unique object representations", t1);
> @@ -3701,7 +3701,7 @@ diagnose_trait_expr (tree expr, tree args)
> inform (loc, " %qT is not convertible from %qE", t2, t1);
> break;
> case CPTK_IS_NOTHROW_CONVERTIBLE:
> - inform (loc, " %qT is not %<nothrow%> convertible from %qE", t2, t1);
> + inform (loc, " %qT is not no-throw convertible from %qE", t2, t1);
> break;
> case CPTK_REF_CONSTRUCTS_FROM_TEMPORARY:
> inform (loc, " %qT is not a reference that binds to a temporary "
> diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-traits3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-traits3.C
> index f20608b6918..6ac849d71fd 100644
> --- a/gcc/testsuite/g++.dg/cpp2a/concepts-traits3.C
> +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-traits3.C
> @@ -21,7 +21,7 @@ concept TriviallyAssignable = __is_trivially_assignable(T, U);
>
> template<class T, class U>
> concept NothrowAssignable = __is_nothrow_assignable(T, U);
> -// { dg-message "'S' is not 'nothrow' assignable from 'int'" "" { target *-*-* } .-1 }
> +// { dg-message "'S' is not no-throw assignable from 'int'" "" { target *-*-* } .-1 }
>
> template<class T, class... Args>
> concept Constructible = __is_constructible(T, Args...);
> @@ -37,9 +37,9 @@ concept TriviallyConstructible = __is_trivially_constructible(T, Args...);
>
> template<class T, class... Args>
> concept NothrowConstructible = __is_nothrow_constructible(T, Args...);
> -// { dg-message "'S' is not 'nothrow' default constructible" "" { target *-*-* } .-1 }
> -// { dg-message "'S' is not 'nothrow' constructible from 'int'" "" { target *-*-* } .-2 }
> -// { dg-message "'S' is not 'nothrow' constructible from 'int, char'" "" { target *-*-* } .-3 }
> +// { dg-message "'S' is not no-throw default constructible" "" { target *-*-* } .-1 }
> +// { dg-message "'S' is not no-throw constructible from 'int'" "" { target *-*-* } .-2 }
> +// { dg-message "'S' is not no-throw constructible from 'int, char'" "" { target *-*-* } .-3 }
>
> template<class T>
> concept UniqueObjReps = __has_unique_object_representations(T);
>
> base-commit: 8a7bcf95a82c3dd68bd4bcfbd8432eb970575bc2
> --
> 2.37.3
>
next prev parent reply other threads:[~2022-09-26 7:50 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 [this message]
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
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='CAFiYyc1Ph+sHE_P9uuoFj-hSoWhpeo+-zzvPY=bs=J-sYQ-U9g@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=polacek@redhat.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).