mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +00:00
glr: eliminate last bits of unwanted locations.
* data/glr.c (YYLTYPE): Do not define when locations are not demanded. Adjust all dependencies.
This commit is contained in:
9
NEWS
9
NEWS
@@ -9,7 +9,14 @@ Bison News
|
|||||||
|
|
||||||
** yacc.c: YYBACKUP works as expected.
|
** yacc.c: YYBACKUP works as expected.
|
||||||
|
|
||||||
** glr.c: __attribute__ is preserved:
|
** glr.c improvements:
|
||||||
|
|
||||||
|
*** Location support is eliminated when not requested:
|
||||||
|
|
||||||
|
GLR parsers used to include location-related code even when
|
||||||
|
locations were not requested, and therefore not even usable.
|
||||||
|
|
||||||
|
*** __attribute__ is preserved:
|
||||||
|
|
||||||
__attribute__ is no longer disabled when __STRICT_ANSI__ is defined
|
__attribute__ is no longer disabled when __STRICT_ANSI__ is defined
|
||||||
(i.e., when -std is passed to GCC).
|
(i.e., when -std is passed to GCC).
|
||||||
|
|||||||
29
data/glr.c
29
data/glr.c
@@ -207,23 +207,19 @@ b4_token_enums(b4_tokens)
|
|||||||
[[typedef int YYSTYPE;
|
[[typedef int YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]])])[
|
# define YYSTYPE_IS_TRIVIAL 1]])])[
|
||||||
#endif
|
#endif
|
||||||
|
]b4_locations_if([[
|
||||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
||||||
typedef struct YYLTYPE
|
typedef struct YYLTYPE
|
||||||
{
|
{
|
||||||
]b4_locations_if([
|
|
||||||
int first_line;
|
int first_line;
|
||||||
int first_column;
|
int first_column;
|
||||||
int last_line;
|
int last_line;
|
||||||
int last_column;
|
int last_column;
|
||||||
],[
|
|
||||||
char yydummy;
|
|
||||||
])[
|
|
||||||
} YYLTYPE;
|
} YYLTYPE;
|
||||||
# define YYLTYPE_IS_DECLARED 1
|
# define YYLTYPE_IS_DECLARED 1
|
||||||
# define YYLTYPE_IS_TRIVIAL 1
|
# define YYLTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
]])[
|
||||||
]b4_percent_code_get([[provides]])[]dnl
|
]b4_percent_code_get([[provides]])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -566,9 +562,8 @@ m4_if(b4_prefix[], [yy], [],
|
|||||||
#define b4_prefix[]char yychar
|
#define b4_prefix[]char yychar
|
||||||
#define b4_prefix[]lval yylval
|
#define b4_prefix[]lval yylval
|
||||||
#define b4_prefix[]lloc yylloc])],
|
#define b4_prefix[]lloc yylloc])],
|
||||||
[YYSTYPE yylval;
|
[YYSTYPE yylval;]b4_locations_if([[
|
||||||
|
YYLTYPE yylloc;]])[
|
||||||
YYLTYPE yylloc;
|
|
||||||
|
|
||||||
int yynerrs;
|
int yynerrs;
|
||||||
int yychar;])[
|
int yychar;])[
|
||||||
@@ -774,9 +769,9 @@ struct yyGLRState {
|
|||||||
yySemanticOption* yyfirstVal;
|
yySemanticOption* yyfirstVal;
|
||||||
/** Semantic value for this state. */
|
/** Semantic value for this state. */
|
||||||
YYSTYPE yysval;
|
YYSTYPE yysval;
|
||||||
} yysemantics;
|
} yysemantics;]b4_locations_if([[
|
||||||
/** Source location for this state. */
|
/** Source location for this state. */
|
||||||
YYLTYPE yyloc;
|
YYLTYPE yyloc;]])[
|
||||||
};
|
};
|
||||||
|
|
||||||
struct yyGLRStateSet {
|
struct yyGLRStateSet {
|
||||||
@@ -798,8 +793,8 @@ struct yySemanticOption {
|
|||||||
yyGLRState* yystate;
|
yyGLRState* yystate;
|
||||||
/** The lookahead for this reduction. */
|
/** The lookahead for this reduction. */
|
||||||
int yyrawchar;
|
int yyrawchar;
|
||||||
YYSTYPE yyval;
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
YYLTYPE yyloc;
|
YYLTYPE yyloc;]])[
|
||||||
/** Next sibling in chain of options. To facilitate merging,
|
/** Next sibling in chain of options. To facilitate merging,
|
||||||
* options are chained in decreasing order by address. */
|
* options are chained in decreasing order by address. */
|
||||||
yySemanticOption* yynext;
|
yySemanticOption* yynext;
|
||||||
@@ -820,8 +815,8 @@ struct yyGLRStack {
|
|||||||
[
|
[
|
||||||
int yyerrcnt;
|
int yyerrcnt;
|
||||||
int yyrawchar;
|
int yyrawchar;
|
||||||
YYSTYPE yyval;
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
YYLTYPE yyloc;
|
YYLTYPE yyloc;]])[
|
||||||
])[
|
])[
|
||||||
YYJMP_BUF yyexception_buffer;
|
YYJMP_BUF yyexception_buffer;
|
||||||
yyGLRStackItem* yyitems;
|
yyGLRStackItem* yyitems;
|
||||||
@@ -880,8 +875,8 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
|||||||
{
|
{
|
||||||
YYASSERT (s->yyresolved);
|
YYASSERT (s->yyresolved);
|
||||||
yyvsp[i].yystate.yyresolved = yytrue;
|
yyvsp[i].yystate.yyresolved = yytrue;
|
||||||
yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;
|
yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;]b4_locations_if([[
|
||||||
yyvsp[i].yystate.yyloc = s->yyloc;
|
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
||||||
s = yyvsp[i].yystate.yypred = s->yypred;
|
s = yyvsp[i].yystate.yypred = s->yypred;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user