bug-bison
[Top][All Lists]
Advanced

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

incorrect call generated to yydestruct-wrong number of parameters


From: Zona Walcott
Subject: incorrect call generated to yydestruct-wrong number of parameters
Date: Tue, 8 Jun 2010 18:39:21 -0700

I'm using 
% ~/StartIntegr-NewParser.7> bison -V
bison (GNU Bison) 2.4.2
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--
on  redhat Linux.

I have specified 2 parameters for parse-param  as:
%parse-param {void* scan_info, PNode *pp }
%lex-param {void *scan_info}

--  the generated yyparse function, is:
int yyparse (void* scan_info, PNode *pp);
  - yes, it's this one since I didn't define YYPARSE_PARAM and preprocessing 
shows it.


The problem:
the function yydestruct is generated with 6 parameters in the c++ version with 
the 2 parse-params listed above.
The C version of it has only 5. 

The calls generated to yydestruct are missing the scan_info parameter and have 
only 5 parameters.

I am running bison as:
bison   -v  -d  BisonSql.ypp  -- it generates BisonSql.tab.cpp

 - I did not set c++ in the ypp file - I just want to compile with c++.

Here are the specifics:
========================

here's the beginning of the generated function for yydestruct  -- in 
BisonSql.tab.cpp
  -- note the non-c++ one is missing a parameter in the function param  list 
spec, though it's listed right below. 



#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE 
*yylocationp, void* scan_info, PNode *pp)
#else
static void
yydestruct (yymsg, yytype, yyvaluep, yylocationp, pp)
    const char *yymsg;
    int yytype;
    YYSTYPE *yyvaluep;
    YYLTYPE *yylocationp;
    void* scan_info, PNode *pp;
#endif
{
  YYUSE (yyvaluep);


Here's a call generated to it:   (with context)

      else
    {
      yydestruct ("Error: discarding",
              yytoken, &yylval, &yylloc, pp);
      yychar = YYEMPTY;
    }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:


...
all the calls to yydestruct are like this.
...

in the grammar specification file, parse-param  (file.ypp) is specified as 
this: 

%parse-param {void* scan_info, PNode *pp }
%lex-param {void *scan_info}


==================

Is there a workaround for this problem?  Or am I missing something in my 
specification?

thanks,
  Zona Walcott
  4j's Development Tools
  address@hidden



reply via email to

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