Skip to content

Commit

Permalink
Don't #define yyparse when using bison/flex
Browse files Browse the repository at this point in the history
With bison/flex, the more modern way to allow multiple yacc/lex
grammars to be linked into a single executable is to use the

        bison: -p, --name-prefix=,PREFIX/, -Dapi.prefix=PREFIX
        flex: -Pprefix, --prefix=STRING

options, these take care of renaming all the machine-generated
global entry points, some of which are new.  When these options are
used "yylex", "yyparse", ... are already defined and our (potentially
incomplete) attempt to do the same conflicts with the "right" new
way to handle this.  This patch gets us out of the way when the job
has already been taken care of by the parser-generator.

Originally by Christos Zoulas.
  • Loading branch information
nicowilliams committed Mar 17, 2017
1 parent bba35d0 commit 537e9ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/hx509/sel.h
Expand Up @@ -67,14 +67,18 @@ struct hx_expr_input {

extern struct hx_expr_input _hx509_expr_input;

#define yyparse _hx509_sel_yyparse
#if !defined(yylex)
#define yylex _hx509_sel_yylex
#define yywrap _hx509_sel_yywrap
#endif
#if !defined(yyparse)
#define yyparse _hx509_sel_yyparse
#define yyerror _hx509_sel_yyerror
#define yylval _hx509_sel_yylval
#define yychar _hx509_sel_yychar
#define yydebug _hx509_sel_yydebug
#define yynerrs _hx509_sel_yynerrs
#define yywrap _hx509_sel_yywrap
#endif

int _hx509_sel_yyparse(void);
int _hx509_sel_yylex(void);
Expand Down

0 comments on commit 537e9ad

Please sign in to comment.