From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 0208A3858C83 for ; Mon, 26 Sep 2022 07:50:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0208A3858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62a.google.com with SMTP id hy2so12205536ejc.8 for ; Mon, 26 Sep 2022 00:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=9pZWdyv95T1A5IZuSCfHOnPcc8JPsS4m+SaeGNJFiLk=; b=eK+xhyUlkyxNdodxEcQcVjB6uY0g4yyrl8nVj0UkniWWC32JRez+dFxANlpjBKCFI2 gVsl+2LSWkfbOWmQgj9Z9wd9yazpM5TSeaLx5TYcQpYwFvzarvMsATojyZ19iHsMCmZm HFMEGzJFacoPsWRhvjLwEvU6kZr65siWF45QFZo9tQI+DPAKx1zn7htRu5OOiqMfT/l6 V1G1C407TLYF0xkFvqIrEyEJHeE5JYXxLmFWQyycMXy5mYIxBohtcLlN2EmFFH4xgHm8 wB688PQEU8iUIcLSRFLnZ4m/7UNSgkIajx5NpBdOWnZshe2xe0clkAQ6tJznfbqKH323 SIMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=9pZWdyv95T1A5IZuSCfHOnPcc8JPsS4m+SaeGNJFiLk=; b=vRMgNRnOcLk6UpLcOZ7oJhbDeswZo0FM0uFTnM+l3RwRFQ/QRUKCaF7DJvFoAhLn8a pGhz9aILgIJjYE+GbEw0R6VZyOhxfcd6cpolFl62VYsmdomwj1iADtly+9AhCnof5Wau ZXWLqoE39dZWdb4/NWf8WrJBbCUrSieQzo9AZqDuwNbEDPDIAO7QFmZ169WPL9+LUXLn 1aB7RpOmGhTXPnzDmpnRP8SbKfQYv9qUXGKo3d8SvZr13f6QOJKuaSd6Ai8s691X4Ydv I84Mna7CLrsLO+4MIklcbEKmOsMhdmWcvumHcaNvYVit3hxncSKGBqDKfoNda+fDev+I qjow== X-Gm-Message-State: ACrzQf3r7D4Sp8LgIKHal+Q61+pWnzCSa9AGqX5hkV8hZTLvwpPuze/O GUSmBwGgLEggGGuXXMnFe0+WptjxU4cj5OCoSz8= X-Google-Smtp-Source: AMsMyM6YxFvecU0lDtzZXytRU++uJ9toWeR2pacn4RVLcvBj8GTPjW2kLkSm3N1PW+sQkh7wq5+koGWyopsfdf5kWTM= X-Received: by 2002:a17:906:8251:b0:781:8016:2dc9 with SMTP id f17-20020a170906825100b0078180162dc9mr17788536ejx.488.1664178614529; Mon, 26 Sep 2022 00:50:14 -0700 (PDT) MIME-Version: 1.0 References: <20220923184026.379494-1-polacek@redhat.com> In-Reply-To: <20220923184026.379494-1-polacek@redhat.com> From: Richard Biener Date: Mon, 26 Sep 2022 09:50:02 +0200 Message-ID: Subject: Re: [PATCH] c++: Don't quote nothrow in diagnostic To: Marek Polacek Cc: Jason Merrill , GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Sep 23, 2022 at 8:41 PM Marek Polacek via Gcc-patches wrote: > > In > 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 % copy assignable", t1); > + inform (loc, " %qT is not no-throw copy assignable", t1); > break; > case CPTK_HAS_NOTHROW_CONSTRUCTOR: > - inform (loc, " %qT is not % default constructible", t1); > + inform (loc, " %qT is not no-throw default constructible", t1); > break; > case CPTK_HAS_NOTHROW_COPY: > - inform (loc, " %qT is not % 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 % 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 % default constructible", t1); > + inform (loc, " %qT is not no-throw default constructible", t1); > else > - inform (loc, " %qT is not % 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 % 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 > 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 > concept Constructible = __is_constructible(T, Args...); > @@ -37,9 +37,9 @@ concept TriviallyConstructible = __is_trivially_constructible(T, Args...); > > template > 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 > concept UniqueObjReps = __has_unique_object_representations(T); > > base-commit: 8a7bcf95a82c3dd68bd4bcfbd8432eb970575bc2 > -- > 2.37.3 >