Parenthesize args in yyless() and unput() replacement text
so they are safer when used with expressions. MFC after: 1 week
This commit is contained in:
parent
efbebba22a
commit
da4b9d2971
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234101
@ -122,7 +122,7 @@ extern FILE *yyin, *yyout;
|
|||||||
#define EOB_ACT_LAST_MATCH 2
|
#define EOB_ACT_LAST_MATCH 2
|
||||||
|
|
||||||
/* The funky do-while in the following #define is used to turn the definition
|
/* The funky do-while in the following #define is used to turn the definition
|
||||||
* int a single C statement (which needs a semi-colon terminator). This
|
* into a single C statement (which needs a semi-colon terminator). This
|
||||||
* avoids problems with code like:
|
* avoids problems with code like:
|
||||||
*
|
*
|
||||||
* if ( condition_holds )
|
* if ( condition_holds )
|
||||||
@ -143,12 +143,12 @@ extern FILE *yyin, *yyout;
|
|||||||
/* Undo effects of setting up yytext. */ \
|
/* Undo effects of setting up yytext. */ \
|
||||||
*yy_cp = yy_hold_char; \
|
*yy_cp = yy_hold_char; \
|
||||||
YY_RESTORE_YY_MORE_OFFSET \
|
YY_RESTORE_YY_MORE_OFFSET \
|
||||||
yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
|
yy_c_buf_p = yy_cp = yy_bp + (n) - YY_MORE_ADJ; \
|
||||||
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
|
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
|
||||||
} \
|
} \
|
||||||
while ( 0 )
|
while ( 0 )
|
||||||
|
|
||||||
#define unput(c) yyunput( c, yytext_ptr )
|
#define unput(c) yyunput( (c), yytext_ptr )
|
||||||
|
|
||||||
/* The following is because we cannot portably get our hands on size_t
|
/* The following is because we cannot portably get our hands on size_t
|
||||||
* (without autoconf's help, which isn't available because we want
|
* (without autoconf's help, which isn't available because we want
|
||||||
|
Loading…
Reference in New Issue
Block a user