+2013-08-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * diagnostic.c (diagnostic_classify_diagnostic): Accept zero index and
+ document its semantics.
+ (diagnostic_report_diagnostic): Adjust accordingly.
+
2013-08-07 David Malcolm <dmalcolm@redhat.com>
* config/sparc/sparc.c (insert_pass_work_around_errata): Move
/* Interface to specify diagnostic kind overrides. Returns the
previous setting, or DK_UNSPECIFIED if the parameters are out of
- range. */
+ range. If OPTION_INDEX is zero, the new setting is for all the
+ diagnostics. */
diagnostic_t
diagnostic_classify_diagnostic (diagnostic_context *context,
int option_index,
{
diagnostic_t old_kind;
- if (option_index <= 0
+ if (option_index < 0
|| option_index >= context->n_opts
|| new_kind >= DK_LAST_DIAGNOSTIC_KIND)
return DK_UNSPECIFIED;
/* This tests for #pragma diagnostic changes. */
if (context->n_classification_history > 0)
{
- int i;
/* FIXME: Stupid search. Optimize later. */
- for (i = context->n_classification_history - 1; i >= 0; i --)
+ for (int i = context->n_classification_history - 1; i >= 0; i --)
{
if (linemap_location_before_p
(line_table,
i = context->classification_history[i].option;
continue;
}
- if (context->classification_history[i].option == diagnostic->option_index)
+ int option = context->classification_history[i].option;
+ /* The option 0 is for all the diagnostics. */
+ if (option == 0 || option == diagnostic->option_index)
{
diag_class = context->classification_history[i].kind;
if (diag_class != DK_UNSPECIFIED)