Manoj Srivastava <[EMAIL PROTECTED] (va, manoj)> writes:

> and is strictly correct according to c99.

But the generated code is not correct according to C89.  In C89, the
behavior is undefined if a macro defined with one argument is called
with zero arguments.  Please see the official interpretation for
Defect Report #003, question 3, in
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_003.html#Question3>.

Surely flex is not intended to require C99; many compilers don't
support C99 yet, or don't fully support it.  GCC is in that category,
and people are reporting problems with GCC here.


> The fix was removed since it caused all the tests to fail

Sorry about that.  I forgot about the reentrant case.  Here is a
revised patch; I checked that "make check" works.

2005-10-21  Paul Eggert  <[EMAIL PROTECTED]>

        * main.c (readin): Don't output an invalid macro definition for
        yywrap; some C compilers complain about this.

--- flex-2.5.31-34/main.c       2005-10-10 16:43:31.000000000 -0700
+++ flex-2.5.31-34-yywrap/main.c        2005-10-21 00:53:40.000000000 -0700
@@ -1560,7 +1560,10 @@ void readin ()
     }
 
        if (!do_yywrap) {
-               outn ("\n#define yywrap(n) 1");
+               if (reentrant)
+                       outn ("\n#define yywrap(n) 1");
+               else
+                       outn ("\n#define yywrap() 1");
                outn ("#define YY_SKIP_YYWRAP");
        }
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to