aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-11 15:13:33 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-11 15:13:33 +0000
commit716da296ca061b7eae92924e6cec959133ce9b67 (patch)
tree6688e37de9262fa9b6efc826ef89c8b02ae776ba /gcc/diagnostic.c
parent85c1abe4be1cb2609b34e07158109d60e94b9803 (diff)
gcc/ChangeLog:
2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> 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/testsuite/ChangeLog: 2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> * gfortran.dg/do_iterator.f90: Remove bogus dg-warning. gcc/fortran/ChangeLog: 2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218627 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 2c2477f2488..7cbdb797aed 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. */