(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.

(YYSTYPE): Declare as union YYSTYPE if the user
does not specify a union tag.  This is for compatibility with
Solaris 9 yacc.
This commit is contained in:
Paul Eggert
2002-12-24 07:41:47 +00:00
parent fa8c3ebca3
commit 050c471b8e

View File

@@ -30,9 +30,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])
## ------------------------ ## ## ------------------------ ##
## Pure/impure interfaces. ## ## Pure/impure interfaces. ##
@@ -186,26 +183,28 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[
# 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 yacc.c. */ /* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],
[typedef int yystype;])[ [typedef int YYSTYPE;])[
# define YYSTYPE yystype # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
#endif #endif
]b4_location_if([#ifndef YYLTYPE ]b4_location_if([#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 YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1 # define YYLTYPE_IS_TRIVIAL 1
#endif #endif
])[ ])[
@@ -1194,14 +1193,15 @@ b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
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 yacc.c. */ /* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],
[typedef int yystype;]) [typedef int YYSTYPE;])
# define YYSTYPE yystype # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
#endif #endif
@@ -1209,15 +1209,17 @@ 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 YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif #endif
m4_if(b4_pure, [0], m4_if(b4_pure, [0],