[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error: else without a previous i f
From: |
Akim Demaille |
Subject: |
Re: error: else without a previous i f |
Date: |
Thu, 14 Jan 2010 13:16:09 +0100 |
Le 13 janv. 2010 à 21:51, Joel E. Denny a écrit :
>> #ifndef yyerror
>> #define yyerror(x) { \
>> SPRINTF(message,"unexpected %s \"%s\" (%s)", \
>> ((yychar<0)?"(?)":yytokname[YYTRANSLATE(yychar)]), \
>> (strlen(yytext)<48?yytext:"(?)"),x); \
>> syntaxerror(line_nr,pos_nr,message);\
>> }
>> #endif
>
> Thus, the Bison-generated trailing semicolon looks like a separate
> statement after your yyerror's closing brace. That ends the `if'
> construct.
>
> I have another patch coming that will just happen to change this passage
> of code in such a way that this won't be a problem anymore. However, I'm
> not sure when I'll get around to proposing it.
>
> Regardless, it would be best if you changed yyerror to a function or at
> least a function invocation.
Or use the traditional do { ... } while (0) trick.