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]

Re: static followed by non-static fails to give a warning.


 > From: "L. Peter Deutsch" <ghost@aladdin.com>
 > 
 > Harbison & Steele's C Reference Manual says that when a function is declared
 > as static, the function must be defined in the same file *as static*.  In
 > conformance with this, a significant number of ANSI compilers give a
 > warning, and a few give an error, for the following 2-line program:
 > 
 > 	static void f(void);
 > 	void f(void) { }
 > 
 > However, egcs (egcs-2.90.27 980315 (egcs-1.0.2 release), Red Hat Linux 5.1)
 > doesn't even give a warning, even in -pedantic mode.
 > 
 > The lack of a warning hurts Ghostscript's portability: I do all my
 > development with gcc / egcs, so I have to rely on a few beta testers to find
 > this problem, and it slips by a significant fraction of the time.  This is
 > the only construct that consistently causes problems, now that I've learned
 > pretty thoroughly not to use any of the dozens of GNU extensions that there
 > is no way to turn off.
 > 
 > Please consider adding a warning for this questionable construct.
 > 				Thanks -
 > L. Peter Deutsch         |       Aladdin Enterprises :::: ghost@aladdin.com


	I started working on this back in Oct 98, but dropped it
temporarily.  See the discussion starting with:

http://www.cygnus.com/ml/egcs-patches/1998-Oct/0729.html

	There was some discussion about when to activate it and I
think the consensus was to put it in -Wtraditional.  

	Anyway, thanks for the reminder.  I'll dust it off and get
something installed into the sources for the next release.

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.


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