[Top][All Lists]

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

strange K&R expansion of yyparse()

From: Anthony Heading
Subject: strange K&R expansion of yyparse()
Date: Mon, 8 May 2006 19:36:52 -0400
User-agent: Mutt/1.5.4i


I've just started to trip over a problem where a parser is not compiling
using MSVC 2005.  I'm not sure why I just started encountering this now -
maybe cygwin has only just upgraded to bison 2.1?  Anyhow, for any parser
at all, the bison=2.1 / m4=1.4.4  yacc.c skeleton code looks like this:

        | yyparse.  |

        #ifdef YYPARSE_PARAM
        # if defined (__STDC__) || defined (__cplusplus)
        int yyparse (void *YYPARSE_PARAM)
        # else
        int yyparse (YYPARSE_PARAM)
        void *YYPARSE_PARAM;
        # endif
        #else /* ! YYPARSE_PARAM */
        #if defined (__STDC__) || defined (__cplusplus)
        yyparse (void)
        yyparse ()
            ;           <==========  should this semicolon be here?

        int yystate;

It looks like there's a empty string being written out as K&R function
argument.  Debugging by mixing and matching bits of bison 2.0 and bison 2.1,
I see some m4sugar macros have changed pretty radically.  Copying the bison
2.0 m4sugar file into a 2.1 tree gets rid of this semicolon.

(As a sidenote, I was a bit surprised to see that this was falling through
a K&R code path using Microsoft's latest compiler!  Googling a bit
suggests that __STDC__ is only turned on when MS extensions are disabled,
which is a reasonable strict interpretation of the purpose of the symbol,
I suppose.  Given it's 2006, should K&R support maybe not be relegated to
a special YY_ANCIENT_KR_COMPILER type of symbol?)

Pls let me know if this problem is as replicable as it seems - happy to
investigate some more if the problem is more complex than I thought...



This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries 
and affiliates.

reply via email to

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