This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Do not suggest -fsanitize=all (PR driver/78863).
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Martin Liška <mliska at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 21 Dec 2016 11:00:20 +0100
- Subject: Re: [PATCH] Do not suggest -fsanitize=all (PR driver/78863).
- Authentication-results: sourceware.org; auth=none
- References: <726a6397-65a6-e8e2-1c55-abe04a56460a@suse.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Dec 21, 2016 at 10:34:13AM +0100, Martin Liška wrote:
> As mentioned in the PR, we should not suggest option that is not allowed.
> Fixed by explicit removal of suggestions that are not acceptable.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?
Wouldn't it be better not to register those? Like (untested):
--- gcc/gcc.c.jj 2016-11-14 19:57:10.000000000 +0100
+++ gcc/gcc.c 2016-12-21 10:58:29.739873850 +0100
@@ -7733,6 +7733,17 @@ driver::build_option_suggestions (void)
{
for (int j = 0; sanitizer_opts[j].name != NULL; ++j)
{
+ struct cl_option optb;
+ /* -fsanitize=all is not valid, only -fno-sanitize=all.
+ So don't register the positive misspelling candidates
+ for it. */
+ if (sanitizer_opts[j].flag == ~0U && i == OPT_fsanitize_)
+ {
+ optb = *option;
+ optb.opt_text = opt_text = "-fno-sanitize=";
+ optb.cl_reject_negative = true;
+ option = &optb;
+ }
/* Get one arg at a time e.g. "-fsanitize=address". */
char *with_arg = concat (opt_text,
sanitizer_opts[j].name,
Jakub