mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 09:13:04 +00:00
(code_start): Initialize it to scanner_cursor,
not loc->end, since loc->end might contain garbage and this leads to undefined behavior on some platforms. (id_loc, token_start): Use (IF_LINTed) initial values that do not depend on *loc, so that the reader doesn't give the the false impression that *loc is initialized. (<INITIAL>"%%"): Do not bother setting code_start, since its value does not survive the return.
This commit is contained in:
@@ -136,15 +136,16 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
int token_type IF_LINT (= 0);
|
int token_type IF_LINT (= 0);
|
||||||
|
|
||||||
/* Location of most recent identifier, when applicable. */
|
/* Location of most recent identifier, when applicable. */
|
||||||
location id_loc IF_LINT (= *loc);
|
location id_loc IF_LINT (= empty_location);
|
||||||
|
|
||||||
/* Where containing code started, when applicable.
|
/* Where containing code started, when applicable. Its initial
|
||||||
Once the second %% seen, we are looking for the epilogue. */
|
value is relevant only when yylex is invoked in the SC_EPILOGUE
|
||||||
boundary code_start = loc->end;
|
start condition. */
|
||||||
|
boundary code_start = scanner_cursor;
|
||||||
|
|
||||||
/* Where containing comment or string or character literal started,
|
/* Where containing comment or string or character literal started,
|
||||||
when applicable. */
|
when applicable. */
|
||||||
boundary token_start IF_LINT (= loc->start);
|
boundary token_start IF_LINT (= scanner_cursor);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
@@ -271,10 +272,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
"%%" {
|
"%%" {
|
||||||
static int percent_percent_count;
|
static int percent_percent_count;
|
||||||
if (++percent_percent_count == 2)
|
if (++percent_percent_count == 2)
|
||||||
{
|
BEGIN SC_EPILOGUE;
|
||||||
code_start = loc->start;
|
|
||||||
BEGIN SC_EPILOGUE;
|
|
||||||
}
|
|
||||||
return PERCENT_PERCENT;
|
return PERCENT_PERCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user