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: Latest gencodes.c is not ISO C compatible


On Thu, Jan 04, 2001 at 04:02:59PM -0200, Alexandre Oliva wrote:
> On Jan  4, 2001, "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> wrote:
> 
> > Alexandre,
> 
> Hi, Kaveh!
> 
> > When I bootstrap the latest CVS on irix6.2 or solaris2.7 using cc for
> > stage1 I get an error compiling gencodes.c.
> 
> Oops.
> 
> > gcc also complains:
> 
> >> gencodes.c: In function `output_predicate_decls':
> >> gencodes.c:62: warning: ANSI C forbids empty initializer braces
> 
> > I believe you introduced this construct.
> 
> Yep.  Sorry, I hadn't noticed the warning :-(
> 
> > If this patch works for you I'll install it as an "obvious" fix.
> 
> I'd rather remove the NULL entry entirely, but I realize
> PREDICATE_CODES is supposed to end with a comma, and I'm not sure a
> trailing comma is acceptable in an array initializers (or if there are
> compilers that would choke on it even if it's acceptable).  Does
> anybody know for sure?

Trailing comma on array and struct initializers is in ISO C as well as the
original K&R.  As I recall, it was specifically mentioned in K&R that it was
there to allow new elements to be added without modifying the previous line.
On the other hand, trailing commas are not allowed in enum list, except as a
GCC extension.

-- 
Michael Meissner, Red Hat, Inc.  (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482

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