[C++ PATCH] Minor fix for warn_args_num
Marek Polacek
polacek@redhat.com
Thu May 21 13:49:00 GMT 2015
I've just noticed that we print "note: declared here" even for builtins.
E.g.:
void
foo (void)
{
__builtin_return ();
}
q.cc: In function âvoid foo()â:
q.cc:4:21: error: too few arguments to function âvoid __builtin_return(void*)â
__builtin_return ();
^
<built-in>: note: declared here
That doesn't seem to be too useful and the C FE doesn't do it.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2015-05-21 Marek Polacek <polacek@redhat.com>
* typeck.c (warn_args_num): Don't print "declare here" for builtins.
diff --git gcc/cp/typeck.c gcc/cp/typeck.c
index ba99c30..8aadeca 100644
--- gcc/cp/typeck.c
+++ gcc/cp/typeck.c
@@ -3598,8 +3598,8 @@ warn_args_num (location_t loc, tree fndecl, bool too_many_p)
? G_("too many arguments to function %q#D")
: G_("too few arguments to function %q#D"),
fndecl);
- inform (DECL_SOURCE_LOCATION (fndecl),
- "declared here");
+ if (!DECL_BUILT_IN (fndecl))
+ inform (DECL_SOURCE_LOCATION (fndecl), "declared here");
}
else
{
Marek
More information about the Gcc-patches
mailing list