This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: non-static definition after static declaration
- To: gcc-patches at gcc dot gnu dot org, phdm at macqel dot be
- Subject: Re: non-static definition after static declaration
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sat, 27 Nov 1999 00:34:46 -0500 (EST)
> From: "Philippe De Muyter" <phdm@macqel.be>
>
> Problem :
> "/share/src/gnu/egcs-19991122/gcc/integrate.c", line 2355: redeclaration of mark
> _stores
> "/share/src/gnu/egcs-19991122/gcc/integrate.c", line 2358: cannot recover from e
> arlier errors: goodbye!
> gnumake[2]: *** [integrate.o] Error 1
> ...
> "/share/src/gnu/egcs-19991122/gcc/regclass.c", line 777: redeclaration of dump_r
> egclass
> "/share/src/gnu/egcs-19991122/gcc/regclass.c", line 778: cannot recover from ear
> lier errors: goodbye!
> gnumake[2]: *** [regclass.o] Error 1
>
> Fix :
> As we want to be able to bootstrap gcc with old compilers, I think we should
> add `-Wtraditional' in WARN_CFLAGS.
>
> Fri Nov 26 10:42:54 1999 Philippe De Muyter <phdm@macqel.be>
>
> * integrate.c (mark_stores): Function definition made void, to match
> previous declaration.
> * regclass.c (dump_regclass): Ditto.
> * Makefile.in (WARN_CFLAGS): Macro augmented by `-Wtraditional'.
>
> [...]
>
> --- ./gcc/Makefile.in Fri Nov 26 10:35:18 1999
> +++ ./gcc/Makefile.in Thu Nov 25 18:47:50 1999
> @@ -70,7 +70,7 @@
> TCFLAGS =
> CFLAGS = -g @stage1_warn_cflags@
> BOOT_CFLAGS = -O2 $(CFLAGS)
> -WARN_CFLAGS = -W -Wall
> +WARN_CFLAGS = -W -Wall -Wtraditional
> # These exists to be overridden by the x-* and t-* files, respectively.
> X_CFLAGS =
> T_CFLAGS =
I have mixed feelings about this, -Wtraditional does other things
besides warnings about the use of `static'. Some of it tends to be
needlessly noisy which I'd like to avoid so that people don't ignore
warnings when the S:N ratio becomes poor. In particular a full
bootstrap of a recent snapshot on solaris2.7 yields:
> Number of warning types:
> 126 integer constant is unsigned in ANSI C, signed with -traditional
> 15 `long' switch expression not converted to `int' in ANSI C
> 8 macro arg `???' would be stringified with -traditional.
> 5 non-static declaration for `???' follows static
Without the language subdirs, we get:
> Number of warning types:
> 99 integer constant is unsigned in ANSI C, signed with -traditional
> 2 non-static declaration for `???' follows static
(In the case of the sparc, 61 out of the 99 come from sparc.c. On
mips, I only get around 34 total.)
At the least, we'd only want to have the -Wtraditional in effect for
the top level gcc dir to build the C compiler. Since we require gcc
for the language subdirs, we have no need to run the -Wtraditional
warning flag against those files. This would require some Makefile
hackery to work though.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions