On 10/17/2016 03:18 PM, Bernd Edlinger wrote:
+@item -Wbuiltin-function-redefined @r{(C++ and Objective-C++ only)} +@opindex Wbuiltin-function-redefined +@opindex Wno-builtin-function-redefined +Do warn if built-in functions are redefined. This option is only +supported for C++ and Objective-C++. It is implied by @option{-Wall}, +which can be disabled with @option{-Wno-builtin-function-redefined}.
There's no redefinition here (only a redeclaration), so perhaps -Wbuiltin-redeclaration-mismatch?
I'm not even sure we need a new warning. Can we combine this warning with the block that currently follows?
else if ((DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) { /* A near match; override the builtin. */ if (TREE_PUBLIC (newdecl)) warning_at (DECL_SOURCE_LOCATION (newdecl), 0, "new declaration %q#D ambiguates built-in " "declaration %q#D", newdecl, olddecl); else warning (OPT_Wshadow, DECL_BUILT_IN (olddecl) ? G_("shadowing built-in function %q#D") : G_("shadowing library function %q#D"), olddecl); }
It seems to me that if we have an extern "C" declaration that doesn't match the built-in, we should just warn.
I looked at some of the testcases you mentioned in the bug report, and those declarations aren't extern "C", so we shouldn't be warning about them. Does your current patch still warn about those?
Jason