summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index fb9d1fbfd1b..01a8e35d73b 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -696,9 +696,10 @@ diagnostic_classify_diagnostic (diagnostic_context *context,
/* Record the command-line status, so we can reset it back on DK_POP. */
if (old_kind == DK_UNSPECIFIED)
{
- old_kind = context->option_enabled (option_index,
- context->option_state)
- ? DK_WARNING : DK_IGNORED;
+ old_kind = !context->option_enabled (option_index,
+ context->option_state)
+ ? DK_IGNORED : (context->warning_as_error_requested
+ ? DK_ERROR : DK_WARNING);
context->classify_diagnostic[option_index] = old_kind;
}