From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7897) id 3F9853858D1E; Mon, 19 Sep 2022 11:08:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F9853858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663585686; bh=UR3kNlP0KKJNRWhfPlTQeFHRffccWrOc4ytYr6PHzJE=; h=From:To:Subject:Date:From; b=GtC1W1f9p7yU2F1APxljj0TZ62V7B735ciw8saLMt7l1ycB1XUwvPxOWz4h0KXiwo SQny7leToWyu0mia0TzkuVTiClZz2fLA32hx7dB4ynRlMOX9fuzkpJlLDvfl0fpHo+ lh8+UhXDYqtwKZ26j6cYWlTNQYWeACpBdw8n+gFE= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Torbjorn Svensson To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2721] Improve sorry message for -fzero-call-used-regs X-Act-Checkin: gcc X-Git-Author: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= X-Git-Refname: refs/heads/master X-Git-Oldrev: 4637a1d293c978816ad622ba33e3a32a78640edd X-Git-Newrev: 6efc494a24bb423f1f9ef8dbdc65ca189072eb8d Message-Id: <20220919110806.3F9853858D1E@sourceware.org> Date: Mon, 19 Sep 2022 11:08:06 +0000 (GMT) List-Id: https://gcc.gnu.org/g:6efc494a24bb423f1f9ef8dbdc65ca189072eb8d commit r13-2721-g6efc494a24bb423f1f9ef8dbdc65ca189072eb8d Author: Torbjörn SVENSSON Date: Thu Sep 15 08:59:30 2022 +0200 Improve sorry message for -fzero-call-used-regs 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-19 Torbjörn SVENSSON gcc/ChangeLog: * targhooks.cc (default_zero_call_used_regs): Improve sorry message. Signed-off-by: Torbjörn SVENSSON Diff: --- gcc/targhooks.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc index b15ae19bcb6..d17d393baed 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"); } }