(b4_location_type): Remove.

(YYSTYPE): Renamed from yystype.
(YYSTYPE_IS_DECLARED): New macro, used to prevent double-typedef.
(struct YYLTYPE): Renamed from struct yyltype.
(YYLTYPE): Renamed from yyltype.
(yyltype, yystype): New (and obsolescent) macros,
for backward compatibility.
This commit is contained in:
Paul Eggert
2002-12-24 07:40:58 +00:00
parent 75eb3bc4e7
commit fa8c3ebca3

View File

@@ -28,9 +28,6 @@ m4_include([c.m4])
m4_define_default([b4_stack_depth_max], [10000]) m4_define_default([b4_stack_depth_max], [10000])
m4_define_default([b4_stack_depth_init], [200]) m4_define_default([b4_stack_depth_init], [200])
# Location type.
m4_define_default([b4_location_type], [yyltype])
## ------------------------ ## ## ------------------------ ##
@@ -183,26 +180,26 @@ b4_pre_prologue[
# define YYERROR_VERBOSE ]b4_error_verbose[ # define YYERROR_VERBOSE ]b4_error_verbose[
#endif #endif
#ifndef YYSTYPE #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype], ]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename]) [b4_syncline([b4_stype_line], [b4_filename])
typedef union b4_stype yystype; typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
/* Line __line__ of glr.c. */ /* Line __line__ of glr.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],
[typedef int yystype;])[ [typedef int YYSTYPE;])[
# define YYSTYPE yystype # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
#endif #endif
#ifndef YYLTYPE #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
typedef struct yyltype typedef struct YYLTYPE
{ {
int first_line; int first_line;
int first_column; int first_column;
int last_line; int last_line;
int last_column; int last_column;
} yyltype; } YYLTYPE;
# define YYLTYPE ]b4_location_type[ # define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1 # define YYLTYPE_IS_TRIVIAL 1
#endif #endif
@@ -513,8 +510,9 @@ int yydebug;
properly redirected to new data. */ properly redirected to new data. */
#define YYHEADROOM 2 #define YYHEADROOM 2
#if ! defined (YYSTACKEXPANDABLE) \ #if (! defined (YYSTACKEXPANDABLE) \
&& (! defined (__cplusplus) || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)) && (! defined (__cplusplus) \
|| (]b4_location_if([YYLTYPE_IS_TRIVIAL && ])[YYSTYPE_IS_TRIVIAL)))
#define YYSTACKEXPANDABLE 1 #define YYSTACKEXPANDABLE 1
#else #else
#define YYSTACKEXPANDABLE 0 #define YYSTACKEXPANDABLE 0
@@ -1955,14 +1953,14 @@ b4_copyright([Skeleton parser for GLR parsing with Bison], [2002])
b4_token_defines(b4_tokens) b4_token_defines(b4_tokens)
#ifndef YYSTYPE #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
m4_ifdef([b4_stype], m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename]) [b4_syncline([b4_stype_line], [b4_filename])
typedef union b4_stype yystype; typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
/* Line __line__ of glr.c. */ /* Line __line__ of glr.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],
[typedef int yystype;]) [typedef int YYSTYPE;])
# define YYSTYPE yystype # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
#endif #endif
@@ -1970,15 +1968,16 @@ b4_pure_if([],
[extern YYSTYPE b4_prefix[]lval;]) [extern YYSTYPE b4_prefix[]lval;])
b4_location_if( b4_location_if(
[#ifndef YYLTYPE [#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
typedef struct yyltype typedef struct YYLTYPE
{ {
int first_line; int first_line;
int first_column; int first_column;
int last_line; int last_line;
int last_column; int last_column;
} yyltype; } YYLTYPE;
# define YYLTYPE yyltype # define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif #endif
m4_if(b4_pure, [0], m4_if(b4_pure, [0],