Message ID | 20220918090708.4014343-1-torbjorn.svensson@foss.st.com |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp490577wrt; Sun, 18 Sep 2022 02:09:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7NXq/Y7awn8X4SDnux6aRFeSGiA9YALUBnsxfCxyC9us6+MngOlFen7l/2uaTAY+oA3nfZ X-Received: by 2002:a17:906:fe0a:b0:76f:e373:d84b with SMTP id wy10-20020a170906fe0a00b0076fe373d84bmr9062999ejb.297.1663492162413; Sun, 18 Sep 2022 02:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663492162; cv=none; d=google.com; s=arc-20160816; b=GYGJUnSmWBmA1x8DnJdtCiDtOxhDFIPS6IDarkMIrLirODl1In1z8ZhrCgwVuM+mGY EahxkhvqKFJ2irCXEn3RS0hk11Ph1XD4UlbrosiK5quS7I3cG2r99Q5BkVkMVKaiUBeI yA0t+G2xrQe4jONZAFze3++K5QQds4MzFMwDyghfoX39ulgvqE8PnOLe+elxXx1U6o1C 62XXN+iMdvVVz9AfUGLDHm7TJB1sjR/svKD/DQsklqgQl6HvXbFMLro/vUuJ5V3fKBE5 PvE25K5kVqIki/qE0wDpyPeD5TA/e/84rv6/LeslRBAZRPqBS5wOA7armObfmejKsE5S c8iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=b+K+ZdpXE4k2eWRt0P+ZJqWyN9wJ4z9ntzOxHSLB80Y=; b=WwkiQl3dqlRdN1ui/synkhzaoND8XV4BvlkWfsgjTauioxqAHK+KO3o0ecHZJ6377x 8w/OJy97FKJu8sc4UM7Z2Brz8DMRf+4V8x2KPnZXYc1IkcUSiz/78xehvMteWA/csvLB 0WfsdN48mMDuZz5BH/hxHXTuW6D+JjKFRbVNWc2r8a8RbrOLxF3CHXIOqN91q5pNuH6R LgVVvIn1KZUJpYxGFHDqr8mdQ3VuTFxxYhzO3SwY5ic1nKMvpfIo8dGCv8mzauD4mVMY 8YJHQRTUgOg6Rf4st3VC/XinPxzt07ACKYouPPxPuM45z3anRUCN0+4DmG0jp2QrsYga fuDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kYFkZy2I; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gt43-20020a1709072dab00b0074c89c5d18fsi18771480ejc.79.2022.09.18.02.09.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Sep 2022 02:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kYFkZy2I; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E3F238328E8 for <ouuuleilei@gmail.com>; Sun, 18 Sep 2022 09:09:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E3F238328E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663492161; bh=b+K+ZdpXE4k2eWRt0P+ZJqWyN9wJ4z9ntzOxHSLB80Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=kYFkZy2IhVtQ7veHpU8UrP8xGynAFfwvOcJyM4Hd2VRw4DBVqJ70P3j6yvm8aEG0u YeW8pKp55LSt3De7v2jv/BD7ySSZcZohmVjsUfq3ef9uwXpDNpGpZThUag8+4GyDFX FdTH1eU/szSeK+bGJ1zbMHD6txQOpkD2Si/VFjWU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 32602382B1B3 for <gcc-patches@gcc.gnu.org>; Sun, 18 Sep 2022 09:08:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32602382B1B3 Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28HNP6Xd022592 for <gcc-patches@gcc.gnu.org>; Sun, 18 Sep 2022 11:08:22 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3jn6atcjwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Sun, 18 Sep 2022 11:08:22 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 36FDD10002A for <gcc-patches@gcc.gnu.org>; Sun, 18 Sep 2022 11:08:21 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 41DAC215120 for <gcc-patches@gcc.gnu.org>; Sun, 18 Sep 2022 11:08:21 +0200 (CEST) Received: from jkgcxl0002.jkg.st.com (10.75.127.46) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.31; Sun, 18 Sep 2022 11:08:18 +0200 To: <gcc-patches@gcc.gnu.org> Subject: [PATCH] Improve sorry message for -fzero-call-used-regs Date: Sun, 18 Sep 2022 11:07:09 +0200 Message-ID: <20220918090708.4014343-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-18_06,2022-09-16_01,2022-06-22_01 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON_via_Gcc-patches?= <gcc-patches@gcc.gnu.org> Reply-To: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= <torbjorn.svensson@foss.st.com> Cc: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= <torbjorn.svensson@foss.st.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744297957754868726?= X-GMAIL-MSGID: =?utf-8?q?1744297957754868726?= |
Series |
Improve sorry message for -fzero-call-used-regs
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patches-check | success | Github commit url |
Commit Message
Torbjorn SVENSSON
Sept. 18, 2022, 9:07 a.m. UTC
When the -fzero-call-used-regs command line option is used with an
unsupported value, indicate that it's a value problem instead of an
option problem.
Without the patch, the error is:
In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5:
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo':
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: '-fzero-call-used-regs' not supported on this target
10 | }
| ^
With the patch, the error would be like this:
In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5:
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo':
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: Argument 'all-arg' is not supported for '-fzero-call-used-regs' on this target
10 | }
| ^
2022-09-18 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gcc/ChangeLog:
* targhooks.cc (default_zero_call_used_regs): Improve sorry
message.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
gcc/targhooks.cc | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Comments
On Sun, Sep 18, 2022 at 11:09 AM Torbjörn SVENSSON via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > When the -fzero-call-used-regs command line option is used with an > unsupported value, indicate that it's a value problem instead of an > option problem. > > Without the patch, the error is: > In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5: > gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo': > gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: '-fzero-call-used-regs' not supported on this target > 10 | } > | ^ > > With the patch, the error would be like this: > In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5: > gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo': > gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: Argument 'all-arg' is not supported for '-fzero-call-used-regs' on this target the 'A' in 'Argument' should be lower case. Otherwise LGTM. Richard. > 10 | } > | ^ > > 2022-09-18 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> > > gcc/ChangeLog: > > * targhooks.cc (default_zero_call_used_regs): Improve sorry > message. > > Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> > --- > gcc/targhooks.cc | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc > index b15ae19bcb6..8bfbc1d18f6 100644 > --- a/gcc/targhooks.cc > +++ b/gcc/targhooks.cc > @@ -93,6 +93,7 @@ along with GCC; see the file COPYING3. If not see > #include "gimple.h" > #include "cfgloop.h" > #include "tree-vectorizer.h" > +#include "options.h" > > bool > default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, > @@ -1181,9 +1182,21 @@ default_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs) > static bool issued_error; > if (!issued_error) > { > + const char *name = NULL; > + for (unsigned int i = 0; zero_call_used_regs_opts[i].name != NULL; > + ++i) > + if (flag_zero_call_used_regs == zero_call_used_regs_opts[i].flag) > + { > + name = zero_call_used_regs_opts[i].name; > + break; > + } > + > + if (!name) > + name = ""; > + > issued_error = true; > - sorry ("%qs not supported on this target", > - "-fzero-call-used-regs"); > + sorry ("Argument %qs is not supported for %qs on this target", > + name, "-fzero-call-used-regs"); > } > } > > -- > 2.25.1 >
diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc index b15ae19bcb6..8bfbc1d18f6 100644 --- a/gcc/targhooks.cc +++ b/gcc/targhooks.cc @@ -93,6 +93,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple.h" #include "cfgloop.h" #include "tree-vectorizer.h" +#include "options.h" bool default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, @@ -1181,9 +1182,21 @@ default_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs) static bool issued_error; if (!issued_error) { + const char *name = NULL; + for (unsigned int i = 0; zero_call_used_regs_opts[i].name != NULL; + ++i) + if (flag_zero_call_used_regs == zero_call_used_regs_opts[i].flag) + { + name = zero_call_used_regs_opts[i].name; + break; + } + + if (!name) + name = ""; + issued_error = true; - sorry ("%qs not supported on this target", - "-fzero-call-used-regs"); + sorry ("Argument %qs is not supported for %qs on this target", + name, "-fzero-call-used-regs"); } }