ado@ALW.NIH.GOV (Arthur David Olson) (09/03/89)
(We're running SunOS 4.0.3 on a Sun 3/280.)
Description:
If a static function is (incorrectly) declared after the first time it
is called, gcc gives both a correct "was declared implicitly `extern'
and later `static'" diagnostic and an incorrect "defined but not used"
diagnostic (if the -Wunused flag is used).
Repeat-By:
Script started on Sat Sep 2 16:08:30 1989
elsie$ cat try.c
int
main()
{
return func();
}
static int
func()
{
return 0;
}
elsie$ /usr/local/bin/gcc -v -Wunused try.c
gcc version 1.35
/usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Wunused -D__HAVE_68881__ -Dmc68020 try.c /tmp/cca16144.cpp
GNU CPP version 1.35
/usr/local/lib/gcc-cc1 /tmp/cca16144.cpp -quiet -dumpbase try.c -Wunused -version -o /tmp/cca16144.s
GNU C version 1.35 (68k, MIT syntax) compiled by GNU C version 1.35.
try.c: In function func:
try.c:9: warning: `func' was declared implicitly `extern' and later `static'
try.c: At top level:
try.c:9: warning: `func' defined but not used
as -mc68020 -o try.o /tmp/cca16144.s
ld -e start -dc -dp /lib/crt0.o /lib/Mcrt1.o try.o /usr/local/lib/gcc-gnulib -lc
elsie$ a.out
elsie$ exit
script done on Sat Sep 2 16:08:49 1989
--
Arthur David Olson ado@alw.nih.gov ADO is a trademark of Ampex.