aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-15 11:08:10 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-15 11:08:10 +0000
commitc58d34ea2083844f465ff3f3e595c9c896253feb (patch)
tree37bc21c8fd16ea5e3a0c78d472d5549b86a7ed15 /gcc/diagnostic.c
parentecc0b0cee14466e780b78b19758a3b2f0be4e798 (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 24aceec558c..2304e14c761 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -470,8 +470,18 @@ diagnostic_action_after_output (diagnostic_context *context,
diagnostic_finish (context);
exit (FATAL_EXIT_CODE);
}
- /* -fmax-error handling is just before the next diagnostic is
- emitted. */
+ if (context->max_errors != 0
+ && ((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;
case DK_ICE:
@@ -824,7 +834,9 @@ diagnostic_report_diagnostic (diagnostic_context *context,
-Wno-error=*. */
if (context->warning_as_error_requested
&& diagnostic->kind == DK_WARNING)
- diagnostic->kind = DK_ERROR;
+ {
+ diagnostic->kind = DK_ERROR;
+ }
if (diagnostic->option_index
&& diagnostic->option_index != permissive_error_option (context))
@@ -880,25 +892,6 @@ diagnostic_report_diagnostic (diagnostic_context *context,
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++;
if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)