This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] PR C/12466 (take 2)


 > From: "Kelley Cook" <kelleycook@wideopenwest.com>
 > 
 > On Tue, 30 Sep 2003 21:16:03 -0700, Richard Henderson wrote:
 > 
 > >On Tue, Sep 30, 2003 at 10:08:34PM -0400, Kelley Cook wrote:
 > >> 	* c-parse.in (parmlist_2): Mark declaration with an ellipsis as ISO C.
 > >> 	* gcc.dg/Wold-style-definition-1.c: Add in 2 ellipsis testcases.
 > 
 > >Ok.
 > 
 > Thanks for the review,
 > 
 > Unfortunately, there is a problem.  I am getting some new regressions in
 > a testcase that was added by Kaveh Ghazi.  These three functions now
 > warn about using ISO definitions when -Wtraditional is specified.
 > 
 > Snipped from gcc.dg/wtr-func-def-1.c (which is run with -Wtraditional)
 > 
 > ----
 > /* Test that we don't warn about stdarg functions.  */
 > 
 > [...]
 > ---
 > 
 > Personally, I'm inclined to think that contrary to the comment these cases 
 > should also warn under -Wtraditional since they are in fact ISO style 
 > function definintions and not in a system header.
 > 
 > My patch is fairly easy to correct if you disagree and wish to maintain the
 > current behavior.
 > How should I proceed?
 > Kelley Cook

There is a reason I did it this way.  To understand why, you have to
realize that the -Wtraditional warnings were designed to help keep GCC
itself bootable with a traditional compiler, not necessarily to be
100% faithful to traditional C.  It had to do this while using
libiberty's helper macros to enable the traditional code.  Most
importantly, the -Wtraditional flag was utilized on GCC while GCC was
in ISO C mode and thus >the helper macros were in ISO C mode.<

What did this mean?  It meant that code running through -Wtraditional
was really ISO C.  E.g. -Wtraditional didn't warn about declarations
using PARAMS on parameters.  Now since we wrote the function
_definition_ in traditional style, things were OK and we didn't get
warnings.  However because we used the VPARAMS macro (with a "V") to
automate the function definition of stdarg functions, those in
particular would appear in ISO C style to -Wtraditional.  If you
wanted to get a clean bootstrap, you had to bypass warning about
those.

With the ISO C conversion, we're no longer using the libiberty stuff.
IMHO, we can toss the historical hack for stdarg.  However we should
be aware that it would mean no one could effectively use the libiberty
macros in combination with -Wtraditional any more and still get a
clean compile.  That's OK to me because I suspect we're probably
seeing the end of anyone trying to keep things usable with a
traditional compiler.  Sometime in the future, it may be worthwhile to
kill -Wtraditional altogether.

I suggest you proceed with your patch as-is, and update my old
testcase to remove the problematic sections.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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