aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2014-12-11 15:13:33 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2014-12-11 15:13:33 +0000
commitc4100eaea3acd1a0d88050ad721f36470a0a6e5d (patch)
tree6688e37de9262fa9b6efc826ef89c8b02ae776ba /gcc/fortran/match.c
parent217d0904fab9c653eeefe27d94cb73f5516c4d83 (diff)
downloadgcc-c4100eaea3acd1a0d88050ad721f36470a0a6e5d.zip
gcc-c4100eaea3acd1a0d88050ad721f36470a0a6e5d.tar.gz
gcc-c4100eaea3acd1a0d88050ad721f36470a0a6e5d.tar.bz2
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)
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/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. From-SVN: r218627
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 3b81a46..e322608 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -3548,7 +3548,7 @@ alloc_opt_list:
/* The next 2 conditionals check C631. */
if (ts.type != BT_UNKNOWN)
{
- gfc_error ("SOURCE tag at %L conflicts with the typespec at %L",
+ gfc_error_1 ("SOURCE tag at %L conflicts with the typespec at %L",
&tmp->where, &old_locus);
goto cleanup;
}
@@ -3585,7 +3585,7 @@ alloc_opt_list:
/* Check F08:C637. */
if (ts.type != BT_UNKNOWN)
{
- gfc_error ("MOLD tag at %L conflicts with the typespec at %L",
+ gfc_error_1 ("MOLD tag at %L conflicts with the typespec at %L",
&tmp->where, &old_locus);
goto cleanup;
}
@@ -3611,7 +3611,7 @@ alloc_opt_list:
/* Check F08:C637. */
if (source && mold)
{
- gfc_error ("MOLD tag at %L conflicts with SOURCE tag at %L",
+ gfc_error_1 ("MOLD tag at %L conflicts with SOURCE tag at %L",
&mold->where, &source->where);
goto cleanup;
}
@@ -4315,7 +4315,7 @@ gfc_match_common (void)
if (sym->attr.in_common)
{
- gfc_error ("Symbol '%s' at %C is already in a COMMON block",
+ gfc_error ("Symbol %qs at %C is already in a COMMON block",
sym->name);
goto cleanup;
}
@@ -4838,7 +4838,9 @@ recursive_stmt_fcn (gfc_expr *e, gfc_symbol *sym)
match
gfc_match_st_function (void)
{
- gfc_error_buf old_error;
+ gfc_error_buf old_error_1;
+ output_buffer old_error;
+
gfc_symbol *sym;
gfc_expr *expr;
match m;
@@ -4847,7 +4849,7 @@ gfc_match_st_function (void)
if (m != MATCH_YES)
return m;
- gfc_push_error (&old_error);
+ gfc_push_error (&old_error, &old_error_1);
if (!gfc_add_procedure (&sym->attr, PROC_ST_FUNCTION, sym->name, NULL))
goto undo_error;
@@ -4859,7 +4861,8 @@ gfc_match_st_function (void)
if (m == MATCH_NO)
goto undo_error;
- gfc_free_error (&old_error);
+ gfc_free_error (&old_error, &old_error_1);
+
if (m == MATCH_ERROR)
return m;
@@ -4877,7 +4880,7 @@ gfc_match_st_function (void)
return MATCH_YES;
undo_error:
- gfc_pop_error (&old_error);
+ gfc_pop_error (&old_error, &old_error_1);
return MATCH_NO;
}