]> git.saurik.com Git - bison.git/blob - data/c.m4
tables: scope reduction
[bison.git] / data / c.m4
1 -*- Autoconf -*-
2
3 # C M4 Macros for Bison.
4
5 # Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
6
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
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.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 m4_include(b4_pkgdatadir/[c-like.m4])
21
22 # b4_tocpp(STRING)
23 # ----------------
24 # Convert STRING into a valid C macro name.
25 m4_define([b4_tocpp],
26 [m4_toupper(m4_bpatsubst(m4_quote($1), [[^a-zA-Z0-9]+], [_]))])
27
28
29 # b4_cpp_guard(FILE)
30 # ------------------
31 # A valid C macro name to use as a CPP header guard for FILE.
32 m4_define([b4_cpp_guard],
33 [[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
34
35
36 # b4_cpp_guard_open(FILE)
37 # b4_cpp_guard_close(FILE)
38 # ------------------------
39 # If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
40 m4_define([b4_cpp_guard_open],
41 [m4_ifval(m4_quote($1),
42 [#ifndef b4_cpp_guard([$1])
43 # define b4_cpp_guard([$1])])])
44
45 m4_define([b4_cpp_guard_close],
46 [m4_ifval(m4_quote($1),
47 [#endif b4_comment([!b4_cpp_guard([$1])])])])
48
49
50 ## ---------------- ##
51 ## Identification. ##
52 ## ---------------- ##
53
54 # b4_comment_(TEXT, OPEN, CONTINUE, END)
55 # --------------------------------------
56 # Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
57 # Avoid adding indentation to the first line, as the indentation comes
58 # from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
59 #
60 # Prefix all the output lines with PREFIX.
61 m4_define([b4_comment_],
62 [$2[]m4_bpatsubst(m4_expand([$1]), [
63 \(.\)], [
64 $3\1])$4])
65
66
67 # b4_comment(TEXT, [PREFIX])
68 # --------------------------
69 # Put TEXT in comment. Prefix all the output lines with PREFIX.
70 m4_define([b4_comment],
71 [b4_comment_([$1], [$2/* ], [$2 ], [ */])])
72
73
74 # b4_identification
75 # -----------------
76 # Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
77 # b4_pull_flag if they use the values of the %define variables api.pure or
78 # api.push-pull.
79 m4_define([b4_identification],
80 [[/* Identify Bison output. */
81 #define YYBISON 1
82
83 /* Bison version. */
84 #define YYBISON_VERSION "]b4_version["
85
86 /* Skeleton name. */
87 #define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
88
89 /* Pure parsers. */
90 #define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[
91
92 /* Push parsers. */
93 #define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[
94
95 /* Pull parsers. */
96 #define YYPULL ]b4_pull_flag])[
97 ]])
98
99
100 ## ---------------- ##
101 ## Default values. ##
102 ## ---------------- ##
103
104 # b4_api_prefix, b4_api_PREFIX
105 # ----------------------------
106 # Corresponds to %define api.prefix
107 b4_percent_define_default([[api.prefix]], [[yy]])
108 m4_define([b4_api_prefix],
109 [b4_percent_define_get([[api.prefix]])])
110 m4_define([b4_api_PREFIX],
111 [m4_toupper(b4_api_prefix)])
112
113
114 # b4_prefix
115 # ---------
116 # If the %name-prefix is not given, it is api.prefix.
117 m4_define_default([b4_prefix], [b4_api_prefix])
118
119 # If the %union is not named, its name is YYSTYPE.
120 m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
121
122
123 ## ------------------------ ##
124 ## Pure/impure interfaces. ##
125 ## ------------------------ ##
126
127 # b4_lex_formals
128 # --------------
129 # All the yylex formal arguments.
130 # b4_lex_param arrives quoted twice, but we want to keep only one level.
131 m4_define([b4_lex_formals],
132 [b4_pure_if([[[[YYSTYPE *yylvalp]], [[&yylval]]][]dnl
133 b4_locations_if([, [[YYLTYPE *yyllocp], [&yylloc]]])])dnl
134 m4_ifdef([b4_lex_param], [, ]b4_lex_param)])
135
136
137 # b4_lex
138 # ------
139 # Call yylex.
140 m4_define([b4_lex],
141 [b4_function_call([yylex], [int], b4_lex_formals)])
142
143
144 # b4_user_args
145 # ------------
146 m4_define([b4_user_args],
147 [m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])])
148
149
150 # b4_parse_param
151 # --------------
152 # If defined, b4_parse_param arrives double quoted, but below we prefer
153 # it to be single quoted.
154 m4_define([b4_parse_param],
155 b4_parse_param)
156
157
158 # b4_parse_param_for(DECL, FORMAL, BODY)
159 # ---------------------------------------
160 # Iterate over the user parameters, binding the declaration to DECL,
161 # the formal name to FORMAL, and evaluating the BODY.
162 m4_define([b4_parse_param_for],
163 [m4_foreach([$1_$2], m4_defn([b4_parse_param]),
164 [m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
165 m4_pushdef([$2], m4_shift($1_$2))dnl
166 $3[]dnl
167 m4_popdef([$2])dnl
168 m4_popdef([$1])dnl
169 ])])
170
171 # b4_parse_param_use([VAL], [LOC])
172 # --------------------------------
173 # `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
174 m4_define([b4_parse_param_use],
175 [m4_ifvaln([$1], [ YYUSE([$1]);])dnl
176 b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
177 b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
178 ])dnl
179 ])
180
181
182 ## ------------ ##
183 ## Data Types. ##
184 ## ------------ ##
185
186 # b4_int_type(MIN, MAX)
187 # ---------------------
188 # Return the smallest int type able to handle numbers ranging from
189 # MIN to MAX (included).
190 m4_define([b4_int_type],
191 [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
192 b4_ints_in($@, [-128], [127]), [1], [signed char],
193
194 b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
195 b4_ints_in($@, [-32768], [32767]), [1], [short int],
196
197 m4_eval([0 <= $1]), [1], [unsigned int],
198
199 [int])])
200
201
202 # b4_int_type_for(NAME)
203 # ---------------------
204 # Return the smallest int type able to handle numbers ranging from
205 # `NAME_min' to `NAME_max' (included).
206 m4_define([b4_int_type_for],
207 [b4_int_type($1_min, $1_max)])
208
209
210 # b4_table_value_equals(TABLE, VALUE, LITERAL)
211 # --------------------------------------------
212 # Without inducing a comparison warning from the compiler, check if the
213 # literal value LITERAL equals VALUE from table TABLE, which must have
214 # TABLE_min and TABLE_max defined.
215 m4_define([b4_table_value_equals],
216 [m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
217 || m4_indir([b4_]$1[_max]) < $3), [1],
218 [[0]],
219 [(!!(($2) == ($3)))])])
220
221
222 ## ---------##
223 ## Values. ##
224 ## ---------##
225
226
227 # b4_null_define
228 # --------------
229 # Portability issues: define a YY_NULL appropriate for the current
230 # language (C, C++98, or C++11).
231 m4_define([b4_null_define],
232 [# ifndef YY_NULL
233 # if defined __cplusplus && 201103L <= __cplusplus
234 # define YY_NULL nullptr
235 # else
236 # define YY_NULL 0
237 # endif
238 # endif[]dnl
239 ])
240
241
242 # b4_null
243 # -------
244 # Return a null pointer constant.
245 m4_define([b4_null], [YY_NULL])
246
247 # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
248 # -------------------------------------------------------------
249 # Define "yy<TABLE-NAME>" which contents is CONTENT.
250 m4_define([b4_integral_parser_table_define],
251 [m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
252 static const b4_int_type_for([$2]) yy$1[[]] =
253 {
254 $2
255 };dnl
256 ])
257
258
259 ## ------------------------- ##
260 ## Assigning token numbers. ##
261 ## ------------------------- ##
262
263 # b4_token_define(TOKEN-NUM)
264 # --------------------------
265 # Output the definition of this token as #define.
266 m4_define([b4_token_define],
267 [b4_token_format([#define %s %s], [$1])])
268
269 # b4_token_defines
270 # ----------------
271 # Output the definition of the tokens.
272 m4_define([b4_token_defines],
273 [b4_any_token_visible_if([/* Tokens. */
274 m4_join([
275 ], b4_symbol_map([b4_token_define]))
276 ])])
277
278
279 # b4_token_enum(TOKEN-NUM)
280 # ------------------------
281 # Output the definition of this token as an enum.
282 m4_define([b4_token_enum],
283 [b4_token_format([%s = %s], [$1])])
284
285
286 # b4_token_enums
287 # --------------
288 # Output the definition of the tokens (if there are) as enums.
289 m4_define([b4_token_enums],
290 [b4_any_token_visible_if([[/* Token type. */
291 #ifndef ]b4_api_PREFIX[TOKENTYPE
292 # define ]b4_api_PREFIX[TOKENTYPE
293 enum ]b4_api_prefix[tokentype
294 {
295 ]m4_join([,
296 ],
297 b4_symbol_map([b4_token_enum]))[
298 };
299 #endif
300 ]])])
301
302
303 # b4_token_enums_defines
304 # ----------------------
305 # Output the definition of the tokens (if there are any) as enums and,
306 # if POSIX Yacc is enabled, as #defines.
307 m4_define([b4_token_enums_defines],
308 [b4_token_enums[]b4_yacc_if([b4_token_defines])])
309
310
311 ## ----------------- ##
312 ## Semantic Values. ##
313 ## ----------------- ##
314
315
316 # b4_symbol_value(VAL, [TYPE])
317 # ----------------------------
318 # Given a semantic value VAL ($$, $1 etc.), extract its value of type
319 # TYPE if TYPE is given, otherwise just return VAL. The result can be
320 # used safetly, it is put in parens to avoid nasty precedence issues.
321 # TYPE is *not* put in braces, provide some if needed.
322 m4_define([b4_symbol_value],
323 [($1[]m4_ifval([$2], [.$2]))])
324
325
326
327 ## ---------------------- ##
328 ## Defining C functions. ##
329 ## ---------------------- ##
330
331
332 # b4_function_define(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
333 # -----------------------------------------------------------
334 # Declare the function NAME in C.
335 m4_define([b4_function_define],
336 [$2
337 $1 (b4_formals(m4_shift2($@)))[]dnl
338 ])
339
340
341 # b4_formals([DECL1, NAME1], ...)
342 # -------------------------------
343 # The formal arguments of a C function definition.
344 m4_define([b4_formals],
345 [m4_if([$#], [0], [void],
346 [$#$1], [1], [void],
347 [m4_map_sep([b4_formal], [, ], [$@])])])
348
349 m4_define([b4_formal],
350 [$1])
351
352
353
354 ## ----------------------- ##
355 ## Declaring C functions. ##
356 ## ----------------------- ##
357
358
359 # b4_function_declare(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
360 # ------------------------------------------------------------
361 # Declare the function NAME.
362 m4_define([b4_function_declare],
363 [$2 $1 (b4_formals(m4_shift2($@)));[]dnl
364 ])
365
366
367
368
369 ## --------------------- ##
370 ## Calling C functions. ##
371 ## --------------------- ##
372
373
374 # b4_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
375 # -----------------------------------------------------------
376 # Call the function NAME with arguments NAME1, NAME2 etc.
377 m4_define([b4_function_call],
378 [$1 (b4_args(m4_shift2($@)))[]dnl
379 ])
380
381
382 # b4_args([DECL1, NAME1], ...)
383 # ----------------------------
384 # Output the arguments NAME1, NAME2...
385 m4_define([b4_args],
386 [m4_map_sep([b4_arg], [, ], [$@])])
387
388 m4_define([b4_arg],
389 [$2])
390
391
392 ## ----------- ##
393 ## Synclines. ##
394 ## ----------- ##
395
396 # b4_sync_start(LINE, FILE)
397 # -------------------------
398 m4_define([b4_sync_start], [[#]line $1 $2])
399
400
401 ## -------------- ##
402 ## User actions. ##
403 ## -------------- ##
404
405 # b4_case(LABEL, STATEMENTS)
406 # --------------------------
407 m4_define([b4_case],
408 [ case $1:
409 $2
410 b4_syncline([@oline@], [@ofile@])
411 break;])
412
413
414 # b4_predicate_case(LABEL, CONDITIONS)
415 # ------------------------------------
416 m4_define([b4_predicate_case],
417 [ case $1:
418 if (! ($2)) YYERROR;
419 b4_syncline([@oline@], [@ofile@])
420 break;])
421
422
423 # b4_yydestruct_define
424 # --------------------
425 # Define the "yydestruct" function.
426 m4_define_default([b4_yydestruct_define],
427 [[/*-----------------------------------------------.
428 | Release the memory associated to this symbol. |
429 `-----------------------------------------------*/
430
431 ]b4_function_define([yydestruct],
432 [static void],
433 [[const char *yymsg], [yymsg]],
434 [[int yytype], [yytype]],
435 [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
436 b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
437 m4_ifset([b4_parse_param], [, b4_parse_param]))[
438 {
439 ]b4_parse_param_use([yyvaluep], [yylocationp])dnl
440 [ if (!yymsg)
441 yymsg = "Deleting";
442 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
443
444 switch (yytype)
445 {
446 ]b4_symbol_foreach([b4_symbol_destructor])dnl
447 [ default:
448 break;
449 }
450 }]dnl
451 ])
452
453
454 # b4_yy_symbol_print_define
455 # -------------------------
456 # Define the "yy_symbol_print" function.
457 m4_define_default([b4_yy_symbol_print_define],
458 [[
459 /*--------------------------------.
460 | Print this symbol on YYOUTPUT. |
461 `--------------------------------*/
462
463 ]b4_function_define([yy_symbol_value_print],
464 [static void],
465 [[FILE *yyoutput], [yyoutput]],
466 [[int yytype], [yytype]],
467 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
468 b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
469 m4_ifset([b4_parse_param], [, b4_parse_param]))[
470 {
471 FILE *yyo = yyoutput;
472 ]b4_parse_param_use([yyo], [yylocationp])dnl
473 [ if (!yyvaluep)
474 return;]
475 dnl glr.c does not feature yytoknum.
476 m4_if(b4_skeleton, ["yacc.c"],
477 [[# ifdef YYPRINT
478 if (yytype < YYNTOKENS)
479 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
480 # endif
481 ]])dnl
482 [ switch (yytype)
483 {
484 ]b4_symbol_foreach([b4_symbol_printer])dnl
485 [ default:
486 break;
487 }
488 }
489
490
491 /*--------------------------------.
492 | Print this symbol on YYOUTPUT. |
493 `--------------------------------*/
494
495 ]b4_function_define([yy_symbol_print],
496 [static void],
497 [[FILE *yyoutput], [yyoutput]],
498 [[int yytype], [yytype]],
499 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
500 b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
501 m4_ifset([b4_parse_param], [, b4_parse_param]))[
502 {
503 if (yytype < YYNTOKENS)
504 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
505 else
506 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
507
508 ]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
509 YYFPRINTF (yyoutput, ": ");
510 ])dnl
511 [ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
512 b4_locations_if([, yylocationp])[]b4_user_args[);
513 YYFPRINTF (yyoutput, ")");
514 }]dnl
515 ])
516
517 ## -------------- ##
518 ## Declarations. ##
519 ## -------------- ##
520
521 # b4_value_type_define
522 # --------------------
523 m4_define([b4_value_type_define],
524 [[/* Value type. */
525 #if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
526 ]m4_ifdef([b4_stype],
527 [[typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE;
528 union ]b4_union_name[
529 {
530 ]b4_user_stype[
531 };
532 # define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
533 [m4_if(b4_tag_seen_flag, 0,
534 [[typedef int ]b4_api_PREFIX[STYPE;
535 # define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
536 # define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
537 #endif
538 ]])
539
540
541 # b4_location_type_define
542 # -----------------------
543 m4_define([b4_location_type_define],
544 [[/* Location type. */
545 #if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
546 typedef struct ]b4_api_PREFIX[LTYPE ]b4_api_PREFIX[LTYPE;
547 struct ]b4_api_PREFIX[LTYPE
548 {
549 int first_line;
550 int first_column;
551 int last_line;
552 int last_column;
553 };
554 # define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
555 # define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
556 #endif
557 ]])
558
559
560 # b4_declare_yylstype
561 # -------------------
562 # Declarations that might either go into the header (if --defines) or
563 # in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
564 m4_define([b4_declare_yylstype],
565 [b4_value_type_define[]b4_locations_if([
566 b4_location_type_define])
567
568 b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
569 ]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
570 ])
571
572
573 # b4_YYDEBUG_define
574 # ------------------
575 m4_define([b4_YYDEBUG_define],
576 [[/* Debug traces. */
577 ]m4_if(b4_api_prefix, [yy],
578 [[#ifndef YYDEBUG
579 # define YYDEBUG ]b4_parse_trace_if([1], [0])[
580 #endif]],
581 [[#ifndef ]b4_api_PREFIX[DEBUG
582 # if defined YYDEBUG
583 #if YYDEBUG
584 # define ]b4_api_PREFIX[DEBUG 1
585 # else
586 # define ]b4_api_PREFIX[DEBUG 0
587 # endif
588 # else /* ! defined YYDEBUG */
589 # define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
590 # endif /* ! defined YYDEBUG */
591 #endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
592 ])
593
594 # b4_declare_yydebug
595 # ------------------
596 m4_define([b4_declare_yydebug],
597 [b4_YYDEBUG_define[
598 #if ]b4_api_PREFIX[DEBUG
599 extern int ]b4_prefix[debug;
600 #endif][]dnl
601 ])
602
603 # b4_yylloc_default_define
604 # ------------------------
605 # Define YYLLOC_DEFAULT.
606 m4_define([b4_yylloc_default_define],
607 [[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
608 If N is 0, then set CURRENT to the empty location which ends
609 the previous symbol: RHS[0] (always defined). */
610
611 #ifndef YYLLOC_DEFAULT
612 # define YYLLOC_DEFAULT(Current, Rhs, N) \
613 do \
614 if (N) \
615 { \
616 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
617 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
618 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
619 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
620 } \
621 else \
622 { \
623 (Current).first_line = (Current).last_line = \
624 YYRHSLOC (Rhs, 0).last_line; \
625 (Current).first_column = (Current).last_column = \
626 YYRHSLOC (Rhs, 0).last_column; \
627 } \
628 while (0)
629 #endif
630 ]])
631
632 # b4_yy_location_print_define
633 # ---------------------------
634 # Define YY_LOCATION_PRINT.
635 m4_define([b4_yy_location_print_define],
636 [b4_locations_if([[
637 /* YY_LOCATION_PRINT -- Print the location on the stream.
638 This macro was not mandated originally: define only if we know
639 we won't break user code: when these are the locations we know. */
640
641 #ifndef YY_LOCATION_PRINT
642 # if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
643
644 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
645
646 __attribute__((__unused__))
647 ]b4_function_define([yy_location_print_],
648 [static unsigned],
649 [[FILE *yyo], [yyo]],
650 [[YYLTYPE const * const yylocp], [yylocp]])[
651 {
652 unsigned res = 0;
653 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
654 if (0 <= yylocp->first_line)
655 {
656 res += fprintf (yyo, "%d", yylocp->first_line);
657 if (0 <= yylocp->first_column)
658 res += fprintf (yyo, ".%d", yylocp->first_column);
659 }
660 if (0 <= yylocp->last_line)
661 {
662 if (yylocp->first_line < yylocp->last_line)
663 {
664 res += fprintf (yyo, "-%d", yylocp->last_line);
665 if (0 <= end_col)
666 res += fprintf (yyo, ".%d", end_col);
667 }
668 else if (0 <= end_col && yylocp->first_column < end_col)
669 res += fprintf (yyo, "-%d", end_col);
670 }
671 return res;
672 }
673
674 # define YY_LOCATION_PRINT(File, Loc) \
675 yy_location_print_ (File, &(Loc))
676
677 # else
678 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
679 # endif
680 #endif]],
681 [[/* This macro is provided for backward compatibility. */
682 #ifndef YY_LOCATION_PRINT
683 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
684 #endif]])
685 ])
686
687 # b4_yyloc_default
688 # ----------------
689 # Expand to a possible default value for yylloc.
690 m4_define([b4_yyloc_default],
691 [[
692 # if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
693 = { ]m4_join([, ],
694 m4_defn([b4_location_initial_line]),
695 m4_defn([b4_location_initial_column]),
696 m4_defn([b4_location_initial_line]),
697 m4_defn([b4_location_initial_column]))[ }
698 # endif
699 ]])