]> git.saurik.com Git - bison.git/blame - data/c.m4
Merge remote-tracking branch 'origin/maint'
[bison.git] / data / c.m4
CommitLineData
08af01c2 1 -*- Autoconf -*-
fb8135fa
AD
2
3# C M4 Macros for Bison.
7d424de1 4
34136e65 5# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
fb8135fa 6
f16b0819 7# This program is free software: you can redistribute it and/or modify
fb8135fa 8# it under the terms of the GNU General Public License as published by
f16b0819 9# the Free Software Foundation, either version 3 of the License, or
fb8135fa 10# (at your option) any later version.
f16b0819 11#
fb8135fa
AD
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
f16b0819 16#
fb8135fa 17# You should have received a copy of the GNU General Public License
f16b0819 18# along with this program. If not, see <http://www.gnu.org/licenses/>.
fb8135fa 19
22172d47
AD
20
21# b4_tocpp(STRING)
22# ----------------
23# Convert STRING into a valid C macro name.
24m4_define([b4_tocpp],
25[m4_toupper(m4_bpatsubst(m4_quote($1), [[^a-zA-Z0-9]+], [_]))])
26
27
28# b4_cpp_guard(FILE)
29# ------------------
30# A valid C macro name to use as a CPP header guard for FILE.
31m4_define([b4_cpp_guard],
32[b4_tocpp(m4_defn([b4_prefix])/[$1])])
33
34
35# b4_cpp_guard_open(FILE)
36# b4_cpp_guard_close(FILE)
37# ------------------------
38# Open/close CPP inclusion guards for FILE.
39m4_define([b4_cpp_guard_open],
40[#ifndef b4_cpp_guard([$1])
41# define b4_cpp_guard([$1])])
42
43m4_define([b4_cpp_guard_close],
44[#endif b4_comment([!b4_cpp_guard([$1])])])
45
46
2a8d363a
AD
47## ---------------- ##
48## Identification. ##
49## ---------------- ##
fb8135fa 50
6ab1adbe
AD
51# b4_comment_(TEXT, OPEN, CONTINUE, END)
52# -------------------------------------
30bb2edc
AD
53# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
54# Avoid adding indentation to the first line, as the indentation comes
6ab1adbe
AD
55# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
56#
57# Prefix all the output lines with PREFIX.
58m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
30bb2edc 59\(.\)], [
6ab1adbe
AD
60$3\1])$4])
61
62
63# b4_c_comment(TEXT, [PREFIX])
64# ----------------------------
65# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
66# Avoid adding indentation to the first line, as the indentation comes
67# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]).
68#
69# Prefix all the output lines with PREFIX.
70m4_define([b4_c_comment],
71[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
72
73
74# b4_comment(TEXT, [PREFIX])
75# --------------------------
76# By default, C comments.
77m4_define([b4_comment], [b4_c_comment($@)])
78
fb8135fa 79
2a8d363a
AD
80# b4_identification
81# -----------------
d9df47b6
JD
82# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
83# b4_pull_flag if they use the values of the %define variables api.pure or
67212941 84# api.push-pull.
2a8d363a 85m4_define([b4_identification],
d9df47b6
JD
86[[/* Identify Bison output. */
87#define YYBISON 1
2a8d363a 88
55f64b82 89/* Bison version. */
d9df47b6 90#define YYBISON_VERSION "]b4_version["
55f64b82 91
2a8d363a 92/* Skeleton name. */
d9df47b6 93#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
2a8d363a
AD
94
95/* Pure parsers. */
d9df47b6
JD
96#define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[
97
98/* Push parsers. */
99#define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[
100
101/* Pull parsers. */
102#define YYPULL ]b4_pull_flag])[
2a8d363a
AD
103
104/* Using locations. */
bc0f5737 105#define YYLSP_NEEDED ]b4_locations_if([1], [0])[
d9df47b6 106]])
2a8d363a
AD
107
108
7ec2d4cd
AD
109## ---------------- ##
110## Default values. ##
111## ---------------- ##
112
1b818f33
AD
113# If the %union is not named, its name is YYSTYPE.
114m4_define_default([b4_union_name], [YYSTYPE])
7ec2d4cd 115
90b9908d
PB
116# If the %name-prefix is not given, it is yy.
117m4_define_default([b4_prefix], [yy])
cd48d21d 118
2a8d363a
AD
119## ------------------------ ##
120## Pure/impure interfaces. ##
121## ------------------------ ##
122
2a8d363a
AD
123# b4_user_args
124# ------------
125m4_define([b4_user_args],
126[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
127
128
129# b4_parse_param
130# --------------
131# If defined, b4_parse_param arrives double quoted, but below we prefer
132# it to be single quoted.
2a8d363a 133m4_define([b4_parse_param],
7ecec4dd 134b4_parse_param)
2a8d363a 135
8f7e3cf9 136
613d8952
AD
137# b4_parse_param_for(DECL, FORMAL, BODY)
138# ---------------------------------------
139# Iterate over the user parameters, binding the declaration to DECL,
140# the formal name to FORMAL, and evaluating the BODY.
141m4_define([b4_parse_param_for],
142[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
6bbb2ed5 143[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
613d8952
AD
144m4_pushdef([$2], m4_shift($1_$2))dnl
145$3[]dnl
146m4_popdef([$2])dnl
147m4_popdef([$1])dnl
148])])
149
beadb220
AD
150# b4_parse_param_use([VAL], [LOC])
151# --------------------------------
152# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
613d8952 153m4_define([b4_parse_param_use],
1e5d6540
AD
154[m4_ifvaln([$1], [ YYUSE([$1]);])dnl
155b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
beadb220 156b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
613d8952
AD
157])dnl
158])
2a8d363a 159
8e1687ae 160
fb8135fa
AD
161## ------------ ##
162## Data Types. ##
163## ------------ ##
164
a762e609
AD
165# b4_int_type(MIN, MAX)
166# ---------------------
167# Return the smallest int type able to handle numbers ranging from
168# MIN to MAX (included).
169m4_define([b4_int_type],
170[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
f1886bb2 171 b4_ints_in($@, [-128], [127]), [1], [signed char],
a762e609 172
779e7ceb
PE
173 b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
174 b4_ints_in($@, [-32768], [32767]), [1], [short int],
a762e609
AD
175
176 m4_eval([0 <= $1]), [1], [unsigned int],
177
e9690142 178 [int])])
a762e609 179
f1886bb2 180
a762e609
AD
181# b4_int_type_for(NAME)
182# ---------------------
183# Return the smallest int type able to handle numbers ranging from
184# `NAME_min' to `NAME_max' (included).
185m4_define([b4_int_type_for],
186[b4_int_type($1_min, $1_max)])
fb8135fa 187
cf98343c 188
87412882
JD
189# b4_table_value_equals(TABLE, VALUE, LITERAL)
190# --------------------------------------------
191# Without inducing a comparison warning from the compiler, check if the
192# literal value LITERAL equals VALUE from table TABLE, which must have
f2b30bdf
JD
193# TABLE_min and TABLE_max defined. YYID must be defined as an identity
194# function that suppresses warnings about constant conditions.
87412882
JD
195m4_define([b4_table_value_equals],
196[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
197 || m4_indir([b4_]$1[_max]) < $3), [1],
198 [[YYID (0)]],
199 [[((]$2[) == (]$3[))]])])
cf98343c 200
ef51bfa7 201
8e1687ae
PE
202## ---------##
203## Values. ##
204## ---------##
205
8e1687ae 206
ef51bfa7
AD
207# b4_null_define
208# --------------
209# Portability issues: define a YY_NULL appropriate for the current
210# language (C, C++98, or C++11).
211m4_define([b4_null_define],
212[# ifndef YY_NULL
213# if defined __cplusplus && 201103L <= __cplusplus
214# define YY_NULL nullptr
215# else
216# define YY_NULL 0
217# endif
218# endif[]dnl
219])
220
221
222# b4_null
223# -------
224# Return a null pointer constant.
225m4_define([b4_null], [YY_NULL])
8e1687ae 226
ba206cf4
AD
227# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
228# -------------------------------------------------------------
0991e29b 229# Define "yy<TABLE-NAME>" which contents is CONTENT.
ba206cf4 230m4_define([b4_integral_parser_table_define],
1e5d6540 231[m4_ifvaln([$3], [b4_c_comment([$3], [ ])])dnl
0991e29b
AD
232static const b4_int_type_for([$2]) yy$1[[]] =
233{
234 $2
235};dnl
236])
cf98343c
AD
237
238
fb8135fa
AD
239## ------------------------- ##
240## Assigning token numbers. ##
241## ------------------------- ##
242
243# b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
244# -----------------------------------------
245# Output the definition of this token as #define.
246m4_define([b4_token_define],
4c6622c2 247[#define b4_percent_define_get([api.tokens.prefix])$1 $2
fb8135fa
AD
248])
249
250
cf147260
AD
251# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
252# -------------------------------------------------------
253# Output the definition of the tokens (if there are) as #defines.
254m4_define([b4_token_defines],
6bbb2ed5 255[m4_if([$#$1], [1], [],
cf147260
AD
256[/* Tokens. */
257m4_map([b4_token_define], [$@])])
258])
259
260
fb8135fa
AD
261# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
262# ---------------------------------------
263# Output the definition of this token as an enum.
264m4_define([b4_token_enum],
4c6622c2 265[b4_percent_define_get([api.tokens.prefix])$1 = $2])
fb8135fa
AD
266
267
cf147260
AD
268# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
269# -----------------------------------------------------
270# Output the definition of the tokens (if there are) as enums.
271m4_define([b4_token_enums],
6bbb2ed5 272[m4_if([$#$1], [1], [],
fb8135fa 273[/* Tokens. */
6b8c3254
PE
274#ifndef YYTOKENTYPE
275# define YYTOKENTYPE
fb8135fa
AD
276 /* Put the tokens into the symbol table, so that GDB and other debuggers
277 know about them. */
278 enum yytokentype {
279m4_map_sep([ b4_token_enum], [,
280],
e9690142 281 [$@])
fb8135fa 282 };
095b9f05 283#endif
cf147260
AD
284])])
285
286
287# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
288# -------------------------------------------------------------
b931235e
JD
289# Output the definition of the tokens (if there are any) as enums and, if POSIX
290# Yacc is enabled, as #defines.
cf147260 291m4_define([b4_token_enums_defines],
b931235e 292[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], [])
fb8135fa 293])
4a2a22f4
AD
294
295
1fa5d8bb
AD
296## ----------------- ##
297## Semantic Values. ##
298## ----------------- ##
299
300
301# b4_symbol_value(VAL, [TYPE])
302# ----------------------------
303# Given a semantic value VAL ($$, $1 etc.), extract its value of type
304# TYPE if TYPE is given, otherwise just return VAL. The result can be
305# used safetly, it is put in parens to avoid nasty precedence issues.
306# TYPE is *not* put in braces, provide some if needed.
307m4_define([b4_symbol_value],
308[($1[]m4_ifval([$2], [.$2]))])
309
310
ae7453f2 311
0245f82d
AD
312## --------------------------------------------- ##
313## Defining C functions in both K&R and ANSI-C. ##
314## --------------------------------------------- ##
4a2a22f4
AD
315
316
1b9c21fb
PE
317# b4_modern_c
318# -----------
319# A predicate useful in #if to determine whether C is ancient or modern.
320#
321# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
322# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
323# reasons, but it defines __C99__FUNC__ so check that as well.
324# Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
7a0db73e 325# Consider a C++ compiler to be modern if it defines __cplusplus.
1b9c21fb
PE
326#
327m4_define([b4_c_modern],
02650b7f
PE
328 [[(defined __STDC__ || defined __C99__FUNC__ \
329 || defined __cplusplus || defined _MSC_VER)]])
1b9c21fb 330
0245f82d
AD
331# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
332# ----------------------------------------------------------
4a2a22f4 333# Declare the function NAME.
0245f82d 334m4_define([b4_c_function_def],
1b9c21fb 335[#if b4_c_modern
0245f82d 336b4_c_ansi_function_def($@)
4a2a22f4 337#else
0245f82d 338$2
a3764451
EB
339$1 (b4_c_knr_formal_names(m4_shift2($@)))
340b4_c_knr_formal_decls(m4_shift2($@))
4a2a22f4
AD
341#endif[]dnl
342])
343
344
0245f82d
AD
345# b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
346# ---------------------------------------------------------------
347# Declare the function NAME in ANSI.
348m4_define([b4_c_ansi_function_def],
349[$2
a3764451 350$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
0245f82d
AD
351])
352
353
354# b4_c_ansi_formals([DECL1, NAME1], ...)
355# --------------------------------------
4a2a22f4 356# Output the arguments ANSI-C definition.
0245f82d 357m4_define([b4_c_ansi_formals],
6bbb2ed5
EB
358[m4_if([$#], [0], [void],
359 [$#$1], [1], [void],
e9690142 360 [m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
4a2a22f4 361
0245f82d
AD
362m4_define([b4_c_ansi_formal],
363[$1])
4a2a22f4
AD
364
365
0245f82d
AD
366# b4_c_knr_formal_names([DECL1, NAME1], ...)
367# ------------------------------------------
4a2a22f4 368# Output the argument names.
0245f82d
AD
369m4_define([b4_c_knr_formal_names],
370[m4_map_sep([b4_c_knr_formal_name], [, ], [$@])])
4a2a22f4 371
0245f82d 372m4_define([b4_c_knr_formal_name],
4a2a22f4
AD
373[$2])
374
375
0245f82d
AD
376# b4_c_knr_formal_decls([DECL1, NAME1], ...)
377# ------------------------------------------
4a2a22f4 378# Output the K&R argument declarations.
0245f82d
AD
379m4_define([b4_c_knr_formal_decls],
380[m4_map_sep([b4_c_knr_formal_decl],
e9690142 381 [
4a2a22f4 382],
e9690142 383 [$@])])
4a2a22f4 384
0245f82d
AD
385m4_define([b4_c_knr_formal_decl],
386[ $1;])
21964f43
AD
387
388
389
0245f82d
AD
390## ------------------------------------------------------------ ##
391## Declaring (prototyping) C functions in both K&R and ANSI-C. ##
392## ------------------------------------------------------------ ##
21964f43
AD
393
394
0245f82d
AD
395# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
396# -----------------------------------------------------------
397# Declare the function NAME.
398m4_define([b4_c_function_decl],
6ceccee8 399[#if b4_c_modern
0245f82d
AD
400b4_c_ansi_function_decl($@)
401#else
402$2 $1 ();
403#endif[]dnl
404])
21964f43
AD
405
406
0245f82d
AD
407# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
408# ----------------------------------------------------------------
409# Declare the function NAME.
410m4_define([b4_c_ansi_function_decl],
a3764451 411[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
0245f82d
AD
412])
413
414
415
416
417## --------------------- ##
418## Calling C functions. ##
419## --------------------- ##
420
421
422# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
423# -----------------------------------------------------------
424# Call the function NAME with arguments NAME1, NAME2 etc.
425m4_define([b4_c_function_call],
a3764451 426[$1 (b4_c_args(m4_shift2($@)))[]dnl
0245f82d
AD
427])
428
429
430# b4_c_args([DECL1, NAME1], ...)
431# ------------------------------
432# Output the arguments NAME1, NAME2...
433m4_define([b4_c_args],
434[m4_map_sep([b4_c_arg], [, ], [$@])])
435
436m4_define([b4_c_arg],
437[$2])
437c2d80
AD
438
439
440## ----------- ##
441## Synclines. ##
442## ----------- ##
443
90b9908d 444# b4_sync_start(LINE, FILE)
8ec0a172 445# -----------------------
90b9908d 446m4_define([b4_sync_start], [[#]line $1 $2])
8ec0a172 447
613d8952
AD
448
449## -------------- ##
450## User actions. ##
451## -------------- ##
452
8e1687ae
PE
453# b4_case(LABEL, STATEMENTS)
454# --------------------------
455m4_define([b4_case],
456[ case $1:
457$2
2141aded 458b4_syncline([@oline@], [@ofile@])
8e1687ae
PE
459 break;])
460
b0400cc6 461
ca2a6d15
PH
462# b4_predicate_case(LABEL, CONDITIONS)
463# ------------------------------------
464m4_define([b4_predicate_case],
465[ case $1:
466 if (! ($2)) YYERROR;
467b4_syncline([@oline@], [@ofile@])
468 break;])
469
470
14740648
PE
471# b4_yydestruct_generate(FUNCTION-DECLARATOR)
472# -------------------------------------------
b0400cc6 473# Generate the "yydestruct" function, which declaration is issued using
14740648 474# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
b0400cc6 475# or "b4_c_function_def" for K&R.
cf147260 476m4_define_default([b4_yydestruct_generate],
b0400cc6
AD
477[[/*-----------------------------------------------.
478| Release the memory associated to this symbol. |
479`-----------------------------------------------*/
480
12ce2df6 481/*ARGSUSED*/
b0400cc6
AD
482]$1([yydestruct],
483 [static void],
a0e68930 484 [[const char *yymsg], [yymsg]],
7bd6c77e 485 [[int yytype], [yytype]],
4b367315 486 [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
327afc7c 487b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
4b367315 488m4_ifset([b4_parse_param], [, b4_parse_param]))[
b0400cc6 489{
1e5d6540
AD
490]b4_parse_param_use([yyvaluep], [yylocationp])dnl
491[ if (!yymsg)
a0e68930
AD
492 yymsg = "Deleting";
493 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
494
b0400cc6
AD
495 switch (yytype)
496 {
3bb21113
AD
497]b4_symbol_foreach([b4_symbol_destructor])dnl
498[ default:
e9690142 499 break;
b0400cc6
AD
500 }
501}]dnl
502])
7bd6c77e
AD
503
504
a0af42fc
AD
505# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
506# ------------------------------------------------
507# Generate the "yy_symbol_print" function, which declaration is issued using
14740648 508# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
7bd6c77e 509# or "b4_c_function_def" for K&R.
a0af42fc
AD
510m4_define_default([b4_yy_symbol_print_generate],
511[[
512/*--------------------------------.
14740648
PE
513| Print this symbol on YYOUTPUT. |
514`--------------------------------*/
7bd6c77e 515
12ce2df6 516/*ARGSUSED*/
a0af42fc 517]$1([yy_symbol_value_print],
7bd6c77e 518 [static void],
e9690142
JD
519 [[FILE *yyoutput], [yyoutput]],
520 [[int yytype], [yytype]],
521 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
50cce58e 522b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
4b367315 523m4_ifset([b4_parse_param], [, b4_parse_param]))[
7bd6c77e 524{
c5026327
AD
525 FILE *yyo = yyoutput;
526]b4_parse_param_use([yyo], [yylocationp])dnl
1e5d6540 527[ if (!yyvaluep)
fc257703
AD
528 return;]
529dnl glr.c does not feature yytoknum.
530m4_if(b4_skeleton, ["yacc.c"],
531[[# ifdef YYPRINT
619404e3
AD
532 if (yytype < YYNTOKENS)
533 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
534# endif
fc257703
AD
535]])dnl
536[ switch (yytype)
7bd6c77e 537 {
3bb21113 538]b4_symbol_foreach([b4_symbol_printer])dnl
3fc16193 539[ default:
e9690142 540 break;
7bd6c77e 541 }
a0af42fc
AD
542}
543
544
545/*--------------------------------.
546| Print this symbol on YYOUTPUT. |
547`--------------------------------*/
548
549]$1([yy_symbol_print],
550 [static void],
e9690142
JD
551 [[FILE *yyoutput], [yyoutput]],
552 [[int yytype], [yytype]],
553 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
50cce58e 554b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
a0af42fc
AD
555m4_ifset([b4_parse_param], [, b4_parse_param]))[
556{
557 if (yytype < YYNTOKENS)
558 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
559 else
560 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
561
327afc7c 562]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
a0af42fc
AD
563 YYFPRINTF (yyoutput, ": ");
564])dnl
565[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
327afc7c 566b4_locations_if([, yylocationp])[]b4_user_args[);
2f4f028d 567 YYFPRINTF (yyoutput, ")");
4b367315
AD
568}]dnl
569])
c0828abf
AD
570
571## -------------- ##
572## Declarations. ##
573## -------------- ##
574
575# b4_declare_yylstype
576# ------------------
577# Declaration that might either go into the header (if --defines)
578# or open coded in the parser body. Declare YYSTYPE and YYLTYPE.
579m4_define([b4_declare_yylstype],
580[[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
581]m4_ifdef([b4_stype],
582[[typedef union ]b4_union_name[
583{
584]b4_user_stype[
585} YYSTYPE;
586# define YYSTYPE_IS_TRIVIAL 1]],
587[m4_if(b4_tag_seen_flag, 0,
588[[typedef int YYSTYPE;
589# define YYSTYPE_IS_TRIVIAL 1]])])[
590# define yystype YYSTYPE /* obsolescent; will be withdrawn */
591# define YYSTYPE_IS_DECLARED 1
592#endif]b4_locations_if([[
593
594#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
595typedef struct YYLTYPE
596{
597 int first_line;
598 int first_column;
599 int last_line;
600 int last_column;
601} YYLTYPE;
602# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
603# define YYLTYPE_IS_DECLARED 1
604# define YYLTYPE_IS_TRIVIAL 1
605#endif]])
606])