/* Take any action which is expected to happen after the diagnostic is written out. This function does not always return. */ static void diagnostic_action_after_output (diagnostic_context *context, diagnostic_info *diagnostic) { switch (diagnostic->kind) { case DK_DEBUG: case DK_NOTE: case DK_ANACHRONISM: case DK_WARNING: break; case DK_ERROR: case DK_SORRY: if (context->abort_on_error) real_abort (); if (context->fatal_errors) { fnotice (stderr, "compilation terminated due to -Wfatal-errors.\n"); diagnostic_finish (context); exit (FATAL_EXIT_CODE); } if (context->max_errors != 0 && ((unsigned) (diagnostic_kind_count (context, DK_ERROR) + diagnostic_kind_count (context, DK_SORRY)) >= 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: if (context->abort_on_error) real_abort (); fnotice (stderr, "Please submit a full bug report,\n" "with preprocessed source if appropriate.\n" "See %s for instructions.\n", bug_report_url); exit (ICE_EXIT_CODE); case DK_FATAL: if (context->abort_on_error) real_abort (); diagnostic_finish (context); fnotice (stderr, "compilation terminated.\n"); exit (FATAL_EXIT_CODE); default: gcc_unreachable (); } }
void diagnostic_finish (diagnostic_context *context) { /* Some of the errors may actually have been warnings. */ if (diagnostic_kind_count (context, DK_WERROR)) { /* -Werror was given. */ if (context->warning_as_error_requested) pp_verbatim (context->printer, _("%s: all warnings being treated as errors"), progname); /* At least one -Werror= was given. */ else pp_verbatim (context->printer, _("%s: some warnings being treated as errors"), progname); pp_newline_and_flush (context->printer); } diagnostic_file_cache_fini (); XDELETEVEC (context->classify_diagnostic); context->classify_diagnostic = NULL; /* diagnostic_initialize allocates context->printer using XNEW and placement-new. */ context->printer->~pretty_printer (); XDELETE (context->printer); context->printer = NULL; }