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  <pola...@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

Reply via email to