DJ Delorie <[EMAIL PROTECTED]> writes:
| > [3] shows which options is used to enable/disable that diagnostic
| > (assumming it is controled by a particular switch). In either case
| > the main diagnostic is always emitted.
|
| No, [3] will also enable/disable the warning, as the OPT_* is used to
| look up the variable, and the variable is checked. If you do [1] you
| end up checking the variable twice.
Right, I missed:
if (diagnostic->option_index
&& ! option_enabled (diagnostic->option_index))
return;
and was reading only
if (diagnostic_count_diagnostic (context, diagnostic))
{
const char *saved_format_spec = diagnostic->message.format_spec;
if (context->show_option_requested && diagnostic->option_index)
diagnostic->message.format_spec
= ACONCAT ((diagnostic->message.format_spec,
" [", cl_options[diagnostic->option_index].opt_text, "]",
NULL));
pp_prepare_to_format (context->printer, &diagnostic->message,
&diagnostic->location);
(*diagnostic_starter (context)) (context, diagnostic);
pp_format_text (context->printer, &diagnostic->message);
(*diagnostic_finalizer (context)) (context, diagnostic);
pp_flush (context->printer);
diagnostic_action_after_output (context, diagnostic);
diagnostic->message.format_spec = saved_format_spec;
}
Is that behaviour documented somewhere I missed?
-- Gaby