mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
api.prefix: do not use #define to handle YYSTYPE_IS_TRIVIAL etc.
The following mixture is insane: #define YYSTYPE_IS_TRIVIAL PREFIX_STYPE_IS_TRIVIAL #if (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL) since, of course YYSTYPE_IS_TRIVIAL is defined. Instead we could define YYSTYPE_IS_TRIVIAL as PREFIX_STYPE_IS_TRIVIAL only when the later is defined, but let's avoid stacking CPP on top of M4: rather, use #if (defined PREFIX_STYPE_IS_TRIVIAL && PREFIX_STYPE_IS_TRIVIAL) * data/glr.c, data/yacc.c: Use YYSTYPE_IS_TRIVIAL, YYSTYPE_IS_DECLARED, YYLTYPE_IS_TRIVIAL and YYLTYPE_IS_DECLARED under their api.prefix-renamed name.
This commit is contained in:
14
data/glr.c
14
data/glr.c
@@ -190,12 +190,8 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
|||||||
b4_percent_code_get([[top]])[
|
b4_percent_code_get([[top]])[
|
||||||
]m4_if(b4_api_prefix, [yy], [],
|
]m4_if(b4_api_prefix, [yy], [],
|
||||||
[[/* Substitute the type names. */
|
[[/* Substitute the type names. */
|
||||||
#define YYSTYPE ]b4_api_PREFIX[STYPE
|
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
||||||
#define YYSTYPE_IS_TRIVIAL ]b4_api_PREFIX[STYPE_IS_TRIVIAL
|
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
||||||
#define YYSTYPE_IS_DECLARED ]b4_api_PREFIX[STYPE_IS_DECLARED]b4_locations_if([[
|
|
||||||
#define YYLTYPE ]b4_api_PREFIX[LTYPE
|
|
||||||
#define YYLTYPE_IS_TRIVIAL ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
#define YYLTYPE_IS_DECLARED ]b4_api_PREFIX[LTYPE_IS_DECLARED]])])[
|
|
||||||
]m4_if(b4_prefix, [yy], [],
|
]m4_if(b4_prefix, [yy], [],
|
||||||
[[/* Substitute the variable and function names. */
|
[[/* Substitute the variable and function names. */
|
||||||
#define yyparse ]b4_prefix[parse
|
#define yyparse ]b4_prefix[parse
|
||||||
@@ -613,8 +609,8 @@ int yydebug;
|
|||||||
|
|
||||||
#ifndef YYSTACKEXPANDABLE
|
#ifndef YYSTACKEXPANDABLE
|
||||||
# if (! defined __cplusplus \
|
# if (! defined __cplusplus \
|
||||||
|| (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
|
|| (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
|
||||||
&& ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))
|
&& ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL))
|
||||||
# define YYSTACKEXPANDABLE 1
|
# define YYSTACKEXPANDABLE 1
|
||||||
# else
|
# else
|
||||||
# define YYSTACKEXPANDABLE 0
|
# define YYSTACKEXPANDABLE 0
|
||||||
@@ -2319,7 +2315,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
yylval = yyval_default;
|
yylval = yyval_default;
|
||||||
]b4_locations_if([
|
]b4_locations_if([
|
||||||
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
16
data/yacc.c
16
data/yacc.c
@@ -309,12 +309,8 @@ b4_copyright([Bison implementation for Yacc-like parsers in C],
|
|||||||
b4_percent_code_get([[top]])[]dnl
|
b4_percent_code_get([[top]])[]dnl
|
||||||
m4_if(b4_api_prefix, [yy], [],
|
m4_if(b4_api_prefix, [yy], [],
|
||||||
[[/* Substitute the type names. */
|
[[/* Substitute the type names. */
|
||||||
#define YYSTYPE ]b4_api_PREFIX[STYPE
|
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
||||||
#define YYSTYPE_IS_TRIVIAL ]b4_api_PREFIX[STYPE_IS_TRIVIAL
|
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
||||||
#define YYSTYPE_IS_DECLARED ]b4_api_PREFIX[STYPE_IS_DECLARED]b4_locations_if([[
|
|
||||||
#define YYLTYPE ]b4_api_PREFIX[LTYPE
|
|
||||||
#define YYLTYPE_IS_TRIVIAL ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
#define YYLTYPE_IS_DECLARED ]b4_api_PREFIX[LTYPE_IS_DECLARED]])])[
|
|
||||||
]m4_if(b4_prefix, [yy], [],
|
]m4_if(b4_prefix, [yy], [],
|
||||||
[[/* Substitute the variable and function names. */]b4_pull_if([[
|
[[/* Substitute the variable and function names. */]b4_pull_if([[
|
||||||
#define yyparse ]b4_prefix[parse]])b4_push_if([[
|
#define yyparse ]b4_prefix[parse]])b4_push_if([[
|
||||||
@@ -498,8 +494,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
|||||||
|
|
||||||
#if (! defined yyoverflow \
|
#if (! defined yyoverflow \
|
||||||
&& (! defined __cplusplus \
|
&& (! defined __cplusplus \
|
||||||
|| (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
|
|| (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
|
||||||
&& ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
&& ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL)))
|
||||||
|
|
||||||
/* A type that is properly aligned for any stack member. */
|
/* A type that is properly aligned for any stack member. */
|
||||||
union yyalloc
|
union yyalloc
|
||||||
@@ -776,7 +772,7 @@ while (YYID (0))
|
|||||||
we won't break user code: when these are the locations we know. */
|
we won't break user code: when these are the locations we know. */
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
#ifndef YY_LOCATION_PRINT
|
||||||
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
# define YY_LOCATION_PRINT(File, Loc) \
|
||||||
fprintf (File, "%d.%d-%d.%d", \
|
fprintf (File, "%d.%d-%d.%d", \
|
||||||
(Loc).first_line, (Loc).first_column, \
|
(Loc).first_line, (Loc).first_column, \
|
||||||
@@ -1585,7 +1581,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yyvsp = yyvs;]b4_locations_if([[
|
yyvsp = yyvs;]b4_locations_if([[
|
||||||
yylsp = yyls;
|
yylsp = yyls;
|
||||||
|
|
||||||
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
/* Initialize the default location before parsing starts. */
|
/* Initialize the default location before parsing starts. */
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
||||||
|
|||||||
Reference in New Issue
Block a user