Commit 090ec702 by Fabien Chêne

decl.c (duplicate_decls): Check for the return of warning_at before emitting a note.

2014-04-04  Fabien Chêne  <fabien@gcc.gnu.org>

	* decl.c (duplicate_decls): Check for the return of warning_at
	before emitting a note.
	(warn_misplaced_attr_for_class_type): Likewise.
	(check_tag_decl): Likewise.

From-SVN: r209131
parent eabcc725
2014-04-04 Fabien Chêne <fabien@gcc.gnu.org>
* decl.c (duplicate_decls): Check for the return of warning_at
before emitting a note.
(warn_misplaced_attr_for_class_type): Likewise.
(check_tag_decl): Likewise.
2014-04-04 Paolo Carlini <paolo.carlini@oracle.com> 2014-04-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58207 PR c++/58207
......
...@@ -1648,8 +1648,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1648,8 +1648,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& prototype_p (TREE_TYPE (newdecl))) && prototype_p (TREE_TYPE (newdecl)))
{ {
/* Prototype decl follows defn w/o prototype. */ /* Prototype decl follows defn w/o prototype. */
warning_at (DECL_SOURCE_LOCATION (newdecl), 0, if (warning_at (DECL_SOURCE_LOCATION (newdecl), 0,
"prototype specified for %q#D", newdecl); "prototype specified for %q#D", newdecl))
inform (DECL_SOURCE_LOCATION (olddecl), inform (DECL_SOURCE_LOCATION (olddecl),
"previous non-prototype definition here"); "previous non-prototype definition here");
} }
...@@ -4241,9 +4241,9 @@ warn_misplaced_attr_for_class_type (source_location location, ...@@ -4241,9 +4241,9 @@ warn_misplaced_attr_for_class_type (source_location location,
{ {
gcc_assert (OVERLOAD_TYPE_P (class_type)); gcc_assert (OVERLOAD_TYPE_P (class_type));
warning_at (location, OPT_Wattributes, if (warning_at (location, OPT_Wattributes,
"attribute ignored in declaration " "attribute ignored in declaration "
"of %q#T", class_type); "of %q#T", class_type))
inform (location, inform (location,
"attribute for %q#T must follow the %qs keyword", "attribute for %q#T must follow the %qs keyword",
class_type, class_key_or_enum_as_string (class_type)); class_type, class_key_or_enum_as_string (class_type));
...@@ -4373,9 +4373,9 @@ check_tag_decl (cp_decl_specifier_seq *declspecs, ...@@ -4373,9 +4373,9 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
No attribute-specifier-seq shall appertain to an explicit No attribute-specifier-seq shall appertain to an explicit
instantiation. */ instantiation. */
{ {
warning_at (loc, OPT_Wattributes, if (warning_at (loc, OPT_Wattributes,
"attribute ignored in explicit instantiation %q#T", "attribute ignored in explicit instantiation %q#T",
declared_type); declared_type))
inform (loc, inform (loc,
"no attribute can be applied to " "no attribute can be applied to "
"an explicit instantiation"); "an explicit instantiation");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment