Commit cba16cca by Jason Merrill Committed by Jason Merrill

decl.c (check_redeclaration_exception_specification): Depend on -Wsystem-headers…

decl.c (check_redeclaration_exception_specification): Depend on -Wsystem-headers rather than -pedantic.

	* decl.c (check_redeclaration_exception_specification): Depend on
	-Wsystem-headers rather than -pedantic.

From-SVN: r223778
parent f4252989
2015-05-27 Jason Merrill <jason@redhat.com> 2015-05-27 Jason Merrill <jason@redhat.com>
* decl.c (check_redeclaration_exception_specification): Depend on
-Wsystem-headers rather than -pedantic.
* decl.c (warn_extern_redeclared_static): Use the location of * decl.c (warn_extern_redeclared_static): Use the location of
newdecl in diagnostics, not input_location. newdecl in diagnostics, not input_location.
(validate_constexpr_redeclaration): Likewise. (validate_constexpr_redeclaration): Likewise.
......
...@@ -1213,14 +1213,19 @@ check_redeclaration_exception_specification (tree new_decl, ...@@ -1213,14 +1213,19 @@ check_redeclaration_exception_specification (tree new_decl,
all declarations, including the definition and an explicit all declarations, including the definition and an explicit
specialization, of that function shall have an specialization, of that function shall have an
exception-specification with the same set of type-ids. */ exception-specification with the same set of type-ids. */
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (old_decl)) if (! DECL_IS_BUILTIN (old_decl)
&& ! DECL_IS_BUILTIN (old_decl)
&& flag_exceptions && flag_exceptions
&& !comp_except_specs (new_exceptions, old_exceptions, ce_normal)) && !comp_except_specs (new_exceptions, old_exceptions, ce_normal))
{ {
error ("declaration of %q+F has a different exception specifier", const char *msg
new_decl); = "declaration of %q+F has a different exception specifier";
inform (0, "from previous declaration %q+F", old_decl); bool complained = true;
if (! DECL_IN_SYSTEM_HEADER (old_decl))
error (msg, new_decl);
else
complained = pedwarn (0, OPT_Wsystem_headers, msg, new_decl);
if (complained)
inform (0, "from previous declaration %q+F", old_decl);
} }
} }
......
#include <stdlib.h>
extern double atof (const char *);
// { dg-do compile { target *-*-*gnu } }
// { dg-options "-Wsystem-headers" }
#include <stdlib.h>
extern double atof (const char *); // { dg-warning "different exception spec" }
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