[Bug c++/81587] GCC doesn't warn about calling functions that don't exist

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 28 01:39:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81587

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC does warn for unused types and variables in local scope so it makes sense
that it also warn for unused functions declared in local scope.  You might want
to open a new bug report and request a warning for locally declared but unused
functions.

$ cat t.C && gcc -S -Wall t.C
void f (void)
{
  typedef int I;
  int i;
  void g ();
}
t.C: In function ‘void f()’:
t.C:4:7: warning: unused variable ‘i’ [-Wunused-variable]
   int i;
       ^
t.C:3:15: warning: typedef ‘I’ locally defined but not used
[-Wunused-local-typedefs]
   typedef int I;
               ^


More information about the Gcc-bugs mailing list