aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.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/symbol.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/symbol.c')
-rw-r--r--gcc/fortran/symbol.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 92a15d0..aab144a 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -1701,18 +1701,18 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where)
if (type != BT_UNKNOWN && !(sym->attr.function && sym->attr.implicit_type))
{
if (sym->attr.use_assoc)
- gfc_error ("Symbol '%s' at %L conflicts with symbol from module '%s', "
+ gfc_error_1 ("Symbol '%s' at %L conflicts with symbol from module '%s', "
"use-associated at %L", sym->name, where, sym->module,
&sym->declared_at);
else
- gfc_error ("Symbol '%s' at %L already has basic type of %s", sym->name,
+ gfc_error ("Symbol %qs at %L already has basic type of %s", sym->name,
where, gfc_basic_typename (type));
return false;
}
if (sym->attr.procedure && sym->ts.interface)
{
- gfc_error ("Procedure '%s' at %L may not have basic type of %s",
+ gfc_error ("Procedure %qs at %L may not have basic type of %s",
sym->name, where, gfc_basic_typename (ts->type));
return false;
}
@@ -1895,7 +1895,7 @@ gfc_add_component (gfc_symbol *sym, const char *name,
{
if (strcmp (p->name, name) == 0)
{
- gfc_error ("Component '%s' at %C already declared at %L",
+ gfc_error_1 ("Component '%s' at %C already declared at %L",
name, &p->loc);
return false;
}
@@ -1906,7 +1906,7 @@ gfc_add_component (gfc_symbol *sym, const char *name,
if (sym->attr.extension
&& gfc_find_component (sym->components->ts.u.derived, name, true, true))
{
- gfc_error ("Component '%s' at %C already in the parent type "
+ gfc_error_1 ("Component '%s' at %C already in the parent type "
"at %L", name, &sym->components->ts.u.derived->declared_at);
return false;
}
@@ -2061,7 +2061,7 @@ gfc_find_component (gfc_symbol *sym, const char *name,
&& !is_parent_comp))
{
if (!silent)
- gfc_error ("Component '%s' at %C is a PRIVATE component of '%s'",
+ gfc_error ("Component %qs at %C is a PRIVATE component of %qs",
name, sym->name);
return NULL;
}
@@ -2079,7 +2079,7 @@ gfc_find_component (gfc_symbol *sym, const char *name,
}
if (p == NULL && !silent)
- gfc_error ("'%s' at %C is not a member of the '%s' structure",
+ gfc_error ("%qs at %C is not a member of the %qs structure",
name, sym->name);
return p;
@@ -2218,7 +2218,7 @@ gfc_define_st_label (gfc_st_label *lp, gfc_sl_type type, locus *label_locus)
labelno = lp->value;
if (lp->defined != ST_LABEL_UNKNOWN)
- gfc_error ("Duplicate statement label %d at %L and %L", labelno,
+ gfc_error_1 ("Duplicate statement label %d at %L and %L", labelno,
&lp->where, label_locus);
else
{
@@ -2628,10 +2628,10 @@ ambiguous_symbol (const char *name, gfc_symtree *st)
{
if (st->n.sym->module)
- gfc_error ("Name '%s' at %C is an ambiguous reference to '%s' "
- "from module '%s'", name, st->n.sym->name, st->n.sym->module);
+ gfc_error ("Name %qs at %C is an ambiguous reference to %qs "
+ "from module %qs", name, st->n.sym->name, st->n.sym->module);
else
- gfc_error ("Name '%s' at %C is an ambiguous reference to '%s' "
+ gfc_error ("Name %qs at %C is an ambiguous reference to %qs "
"from current program unit", name, st->n.sym->name);
}
@@ -2852,7 +2852,7 @@ gfc_get_sym_tree (const char *name, gfc_namespace *ns, gfc_symtree **result,
&& (ns->has_import_set || p->attr.imported)))
{
/* Symbol is from another namespace. */
- gfc_error ("Symbol '%s' at %C has already been host associated",
+ gfc_error ("Symbol %qs at %C has already been host associated",
name);
return 2;
}
@@ -3895,7 +3895,7 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym)
J3/04-007, Section 15.2.3, C1505. */
if (curr_comp->attr.pointer != 0)
{
- gfc_error ("Component '%s' at %L cannot have the "
+ gfc_error_1 ("Component '%s' at %L cannot have the "
"POINTER attribute because it is a member "
"of the BIND(C) derived type '%s' at %L",
curr_comp->name, &(curr_comp->loc),
@@ -3905,7 +3905,7 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym)
if (curr_comp->attr.proc_pointer != 0)
{
- gfc_error ("Procedure pointer component '%s' at %L cannot be a member"
+ gfc_error_1 ("Procedure pointer component '%s' at %L cannot be a member"
" of the BIND(C) derived type '%s' at %L", curr_comp->name,
&curr_comp->loc, derived_sym->name,
&derived_sym->declared_at);
@@ -3916,7 +3916,7 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym)
J3/04-007, Section 15.2.3, C1505. */
if (curr_comp->attr.allocatable != 0)
{
- gfc_error ("Component '%s' at %L cannot have the "
+ gfc_error_1 ("Component '%s' at %L cannot have the "
"ALLOCATABLE attribute because it is a member "
"of the BIND(C) derived type '%s' at %L",
curr_comp->name, &(curr_comp->loc),