help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GACK!


From: John Millaway
Subject: Re: GACK!
Date: Thu, 5 Sep 2002 10:24:08 -0700 (PDT)

> It states that function prototypes are provided for the generated
> .c file if supported by the environment.  That used to be true, but
> is no longer so -- only old-style non-prototyped declarations are
> provided unless one goes through contortions to get normal ANSI
> C89, C90, C95, or C99 prototypes.

That's not what's supposed to happen. Let's make sure we are on the same page
when we speak about "prototypes" and "definitions", because it's easy to
confuse the issue. To clarify, this is what you are supposed to get by default:

     // prototype
    int foo(int, char*);

     // C89 definition
    int foo (x.y) 
         int x; char* y;
    {
     ....
    }

And this is what you are supposed to get with YY_NO_TRADITIONAL_FUNC_DEFS:

    // same prototype as above
    int foo (int, char*);

    // But C99 definition
    int foo (int x, char* y)
    {
    ...
    }

Finally, if you are on a system that autoconf thinks can't handle prototypes,
then the YY_PROTOS() macro will evaluate to an empty argument list, and all
your prototypes will look like this, regardless of the C99-related macros.

    //  prototype on wacky system
    int foo ();


> Can this behavior please be reversed; I don't object to giving the
> gcc folks a way to force old-style declarations, but let's not put
> the burden on everybody else.

Agreed. I regret the decision. The gcc people can add the reversal macro with
with a one-liner shell script if they need to.



> This is really, really bad.  In a project with 60 object files, it
> is unreasonable to have to specify the extraordinarily verbose
> -DYY_NO_TRADITIONAL_FUNC_DEFS for all compilations when it ought not
> to be needed for any object files (i.e. the project in question is
> not "bootstrapping gcc").  A separate compilation command in a
> makefile for the flex object isn't possible with gmake, because
> gmake overrides it with the recipe based on SUFFIXES.

Huh? Just add the following line in your gmake Makefile:

    CPPFLAGS +=  -DYY_NO_TRADITIONAL_FUNC_DEF

-john


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]