This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING^2] PR 26494 -pedantic-errors can be overridden by -W*
- From: Ian Lance Taylor <iant at google dot com>
- To: Manuel LÃpez-Ib ÃÃez <lopezibanez at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: 13 Feb 2007 07:47:05 -0800
- Subject: Re: [PING^2] PR 26494 -pedantic-errors can be overridden by -W*
- References: <6c33472e0701241107x4d144bf5v13538fb7bb79797b@mail.gmail.com> <Pine.LNX.4.64.0701241913120.14238@digraph.polyomino.org.uk> <6c33472e0701250152i244ba1p561c2736b018141b@mail.gmail.com> <6c33472e0702110328k56625a47ib3394652c39e728e@mail.gmail.com> <6c33472e0702110329t6d809970g94edbc05d21dd41c@mail.gmail.com>
"Manuel LÃpez-IbÃÃez" <lopezibanez@gmail.com> writes:
Well, since you're touching this code, you get to fix it.
> +/* Enable a warning option as an error. This is used by -Werror= and
> + also by legacy Werror-implicit-function-declaration. */
> +
> +void
> +enable_warning_as_error (const char *arg, int value, unsigned int lang_mask)
> +{
> + char *new_option;
> + int option_index;
> + new_option = XNEWVEC (char, strlen (arg) + 2);
> + new_option[0] = 'W';
> + strcpy (new_option+1, arg);
Please add spaces around the '+'.
> + option_index = find_opt (new_option, lang_mask);
> + if (option_index == N_OPTS)
> + {
> + error ("-Werror=%s: No option -%s", arg, new_option);
> + }
> + else
> + {
> + int kind = value ? DK_ERROR : DK_WARNING;
> + diagnostic_classify_diagnostic (global_dc, option_index, kind);
> +
> + /* -Werror=foo implies -Wfoo. */
> + if (cl_options[option_index].var_type == CLVC_BOOLEAN
> + && cl_options[option_index].flag_var
> + && kind == DK_ERROR)
> + *(int *) cl_options[option_index].flag_var = 1;
> + free (new_option);
> + }
> +}
Please move the free of new_option outside the conditional.
OK with those changes.
Thanks.
Ian