From c4100eaea3acd1a0d88050ad721f36470a0a6e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Thu, 11 Dec 2014 15:13:33 +0000 Subject: re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc/ChangeLog: 2014-12-11 Manuel López-Ibáñez PR fortran/44054 * diagnostic.c (diagnostic_action_after_output): Make it extern. Take diagnostic_t argument instead of diagnostic_info. Count also DK_WERROR towards max_errors. (diagnostic_report_diagnostic): Update call according to the above. (error_recursion): Likewise. * diagnostic.h (diagnostic_action_after_output): Declare. * pretty-print.c (pp_formatted_text_data): Delete. (pp_append_r): Call output_buffer_append_r. (pp_formatted_text): Call output_buffer_formatted_text. (pp_last_position_in_text): Call output_buffer_last_position_in_text. * pretty-print.h (output_buffer_formatted_text): New. (output_buffer_append_r): New. (output_buffer_last_position_in_text): New. gcc/fortran/ChangeLog: 2014-12-11 Manuel López-Ibáñez PR fortran/44054 * error.c (pp_error_buffer): New static variable. (pp_warning_buffer): Make it a pointer. (gfc_output_buffer_empty_p): New. (gfc_error_init_1): Call gfc_buffer_error. (gfc_buffer_error): Do not use pp_warning_buffer.flush_p as the buffered_p flag. (gfc_clear_warning): Likewise. (gfc_warning_check): Call gfc_clear_warning. Only check the new pp_warning_buffer if the old warning_buffer was empty. Call diagnostic_action_after_output. (gfc_error_1): Renamed from gfc_error. (gfc_error): New. (gfc_clear_error): Clear also pp_error_buffer. (gfc_error_flag_test): Check also pp_error_buffer. (gfc_error_check): Likewise. Only check the new pp_error_buffer if the old error_buffer was empty. (gfc_move_output_buffer_from_to): New. (gfc_push_error): Use it here. Take also an output_buffer as argument. (gfc_pop_error): Likewise. (gfc_free_error): Likewise. (gfc_diagnostics_init): Use XNEW and placement-new to init pp_error_buffer and pp_warning_buffer. Set flush_p to false for both pp_warning_buffer and pp_error_buffer. * Update gfc_push_error, gfc_pop_error and gfc_free_error calls according to the above changes. * Use gfc_error_1 for all gfc_error calls that use multiple locations. * Use %qs instead of '%s' for many gfc_error calls. From-SVN: r218627 --- gcc/diagnostic.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'gcc/diagnostic.c') diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 2c2477f..7cbdb79 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -51,8 +51,6 @@ along with GCC; see the file COPYING3. If not see /* Prototypes. */ static void error_recursion (diagnostic_context *) ATTRIBUTE_NORETURN; -static void diagnostic_action_after_output (diagnostic_context *, - diagnostic_info *); static void real_abort (void) ATTRIBUTE_NORETURN; /* Name of program invoked, sans directories. */ @@ -483,11 +481,11 @@ bt_err_callback (void *data ATTRIBUTE_UNUSED, const char *msg, int errnum) /* Take any action which is expected to happen after the diagnostic is written out. This function does not always return. */ -static void +void diagnostic_action_after_output (diagnostic_context *context, - diagnostic_info *diagnostic) + diagnostic_t diag_kind) { - switch (diagnostic->kind) + switch (diag_kind) { case DK_DEBUG: case DK_NOTE: @@ -507,7 +505,8 @@ diagnostic_action_after_output (diagnostic_context *context, } if (context->max_errors != 0 && ((unsigned) (diagnostic_kind_count (context, DK_ERROR) - + diagnostic_kind_count (context, DK_SORRY)) + + diagnostic_kind_count (context, DK_SORRY) + + diagnostic_kind_count (context, DK_WERROR)) >= context->max_errors)) { fnotice (stderr, @@ -864,7 +863,7 @@ diagnostic_report_diagnostic (diagnostic_context *context, (*diagnostic_starter (context)) (context, diagnostic); pp_output_formatted_text (context->printer); (*diagnostic_finalizer (context)) (context, diagnostic); - diagnostic_action_after_output (context, diagnostic); + diagnostic_action_after_output (context, diagnostic->kind); diagnostic->message.format_spec = saved_format_spec; diagnostic->x_data = NULL; @@ -1264,8 +1263,6 @@ fnotice (FILE *file, const char *cmsgid, ...) static void error_recursion (diagnostic_context *context) { - diagnostic_info diagnostic; - if (context->lock < 3) pp_newline_and_flush (context->printer); @@ -1273,9 +1270,8 @@ error_recursion (diagnostic_context *context) "Internal compiler error: Error reporting routines re-entered.\n"); /* Call diagnostic_action_after_output to get the "please submit a bug - report" message. It only looks at the kind field of diagnostic_info. */ - diagnostic.kind = DK_ICE; - diagnostic_action_after_output (context, &diagnostic); + report" message. */ + diagnostic_action_after_output (context, DK_ICE); /* Do not use gcc_unreachable here; that goes through internal_error and therefore would cause infinite recursion. */ -- cgit v1.1