This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING^2] PR 26494 -pedantic-errors can be overridden by -W*


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]