This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/1517: Erroneous warnings for nested functions with -Wmissing-declarations



>Number:         1517
>Category:       c
>Synopsis:       synopsis of the problem (one line)>
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 27 12:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Jaeger
>Release:        2.97 20001226 (experimental)
>Organization:
private
>Environment:
System: Linux gromit 2.4.0-test13-pre4 #56 Fri Dec 22 09:16:50 CET 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /cvs/gcc/configure --prefix=/opt/gcc-2.97.test --enable-shared --enable-threads=posix --with-gnu-as --with-gnu-ld --disable-nls --with-system-zlib --enable-languages=c,objc,c++,f77
>Description:
	A nested function with prototype definitions in C gives a
	warning when using -Wmisssing-declarations.  For static
	functions I don't get a warning - and nested functions should
	be treated the same way.
>How-To-Repeat:
	Compile the following program with -Wmissing-declarations:
int
main (void)
{

  int a;
  
  int nested (int b)
    {
      return b + 2;
    }

  return (a + nested (a));  
}

$ /opt/gcc-2.97.test/bin/gcc t.c -Wmissing-declarations 
t.c: In function `main':
t.c:9: warning: no previous declaration for `nested'



>Fix:
	Adding a prototype with "auto" works but I prefer to not
	change the code, this should be treated the same way as static
	functions.
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]