* [PATCH] Improve sorry message for -fzero-call-used-regs
@ 2022-09-18 9:07 Torbjörn SVENSSON
2022-09-19 7:44 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Torbjörn SVENSSON @ 2022-09-18 9:07 UTC (permalink / raw)
To: gcc-patches; +Cc: Torbjörn SVENSSON
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(-)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Improve sorry message for -fzero-call-used-regs
2022-09-18 9:07 [PATCH] Improve sorry message for -fzero-call-used-regs Torbjörn SVENSSON
@ 2022-09-19 7:44 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-09-19 7:44 UTC (permalink / raw)
To: Torbjörn SVENSSON; +Cc: gcc-patches
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-19 7:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-18 9:07 [PATCH] Improve sorry message for -fzero-call-used-regs Torbjörn SVENSSON
2022-09-19 7:44 ` Richard Biener
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).