mirror of git://gcc.gnu.org/git/gcc.git
revert: diagnostic.c (diagnostic_action_after_output): Remove max error handling here ....
Revert * diagnostic.c (diagnostic_action_after_output): Remove max error handling here .... (diagnostic_report_diagnostic): ... do it here instead. testsuite/ * c-c++-common/fmax-errors.c: Make sure note is emitted. From-SVN: r241198
This commit is contained in:
parent
35d9424444
commit
64190f049a
|
|
@ -1,9 +1,3 @@
|
||||||
2016-10-14 Nathan Sidwell <nathan@acm.org>
|
|
||||||
|
|
||||||
* diagnostic.c (diagnostic_action_after_output): Remove fatal
|
|
||||||
and max error handling here ....
|
|
||||||
(diagnostic_report_diagnostic): ... do it here instead.
|
|
||||||
|
|
||||||
2016-10-14 David Malcolm <dmalcolm@redhat.com>
|
2016-10-14 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
* print-rtl-function.c (print_edge): Omit "(flags)" when none are
|
* print-rtl-function.c (print_edge): Omit "(flags)" when none are
|
||||||
|
|
|
||||||
|
|
@ -470,8 +470,18 @@ diagnostic_action_after_output (diagnostic_context *context,
|
||||||
diagnostic_finish (context);
|
diagnostic_finish (context);
|
||||||
exit (FATAL_EXIT_CODE);
|
exit (FATAL_EXIT_CODE);
|
||||||
}
|
}
|
||||||
/* -fmax-error handling is just before the next diagnostic is
|
if (context->max_errors != 0
|
||||||
emitted. */
|
&& ((unsigned) (diagnostic_kind_count (context, DK_ERROR)
|
||||||
|
+ diagnostic_kind_count (context, DK_SORRY)
|
||||||
|
+ diagnostic_kind_count (context, DK_WERROR))
|
||||||
|
>= context->max_errors))
|
||||||
|
{
|
||||||
|
fnotice (stderr,
|
||||||
|
"compilation terminated due to -fmax-errors=%u.\n",
|
||||||
|
context->max_errors);
|
||||||
|
diagnostic_finish (context);
|
||||||
|
exit (FATAL_EXIT_CODE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DK_ICE:
|
case DK_ICE:
|
||||||
|
|
@ -824,7 +834,9 @@ diagnostic_report_diagnostic (diagnostic_context *context,
|
||||||
-Wno-error=*. */
|
-Wno-error=*. */
|
||||||
if (context->warning_as_error_requested
|
if (context->warning_as_error_requested
|
||||||
&& diagnostic->kind == DK_WARNING)
|
&& diagnostic->kind == DK_WARNING)
|
||||||
diagnostic->kind = DK_ERROR;
|
{
|
||||||
|
diagnostic->kind = DK_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (diagnostic->option_index
|
if (diagnostic->option_index
|
||||||
&& diagnostic->option_index != permissive_error_option (context))
|
&& diagnostic->option_index != permissive_error_option (context))
|
||||||
|
|
@ -880,25 +892,6 @@ diagnostic_report_diagnostic (diagnostic_context *context,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diagnostic->kind != DK_NOTE && context->max_errors)
|
|
||||||
{
|
|
||||||
/* Check, before emitting the diagnostic, whether we would
|
|
||||||
exceed the limit. This way we will emit notes relevant to
|
|
||||||
the final emitted error. */
|
|
||||||
int count = (diagnostic_kind_count (context, DK_ERROR)
|
|
||||||
+ diagnostic_kind_count (context, DK_SORRY)
|
|
||||||
+ diagnostic_kind_count (context, DK_WERROR));
|
|
||||||
|
|
||||||
if ((unsigned) count >= context->max_errors)
|
|
||||||
{
|
|
||||||
fnotice (stderr,
|
|
||||||
"compilation terminated due to -fmax-errors=%u.\n",
|
|
||||||
context->max_errors);
|
|
||||||
diagnostic_finish (context);
|
|
||||||
exit (FATAL_EXIT_CODE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context->lock++;
|
context->lock++;
|
||||||
|
|
||||||
if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
|
if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
2016-10-14 Nathan Sidwell <nathan@acm.org>
|
|
||||||
|
|
||||||
* c-c++-common/fmax-errors.c: Add error with note.
|
|
||||||
|
|
||||||
2016-10-14 Jakub Jelinek <jakub@redhat.com>
|
2016-10-14 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR middle-end/77959
|
PR middle-end/77959
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,11 @@
|
||||||
/* PR c/44782 */
|
/* PR c/44782 */
|
||||||
/* { dg-do compile } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "-fmax-errors=3 -Wall" } */
|
/* { dg-options "-fmax-errors=3" } */
|
||||||
|
|
||||||
void foo (unsigned int i, unsigned int j)
|
void foo (unsigned int i, unsigned int j)
|
||||||
{
|
{
|
||||||
(i) (); /* { dg-error "" } */
|
(i) (); /* { dg-error "" } */
|
||||||
(j) (); /* { dg-error "" } */
|
(j) (); /* { dg-error "" } */
|
||||||
|
(i+j) (); /* { dg-error "" } */
|
||||||
i + j; /* { dg-warning "" } */
|
|
||||||
|
|
||||||
(k) (); /* { dg-error "" } */
|
|
||||||
/* Make sure we see the notes related to the final error we emit. */
|
|
||||||
/* { dg-message "identifier" "" { target c } 12 } */
|
|
||||||
|
|
||||||
/* Warnings after the final error should not appear. */
|
|
||||||
i + j; /* no warning. */
|
|
||||||
|
|
||||||
(i*j) (); /* no error here due to -fmax-errors */
|
(i*j) (); /* no error here due to -fmax-errors */
|
||||||
|
|
||||||
} /* { dg-prune-output "compilation terminated" } */
|
} /* { dg-prune-output "compilation terminated" } */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue