X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/64b3612ab183b8f000d3d6b2c8eb957865081d37..c5dbd909d0fcdacb46d4d601ebcadfc0f680cd56:/data/c.m4 diff --git a/data/c.m4 b/data/c.m4 index 0b91ca0d..f145c737 100644 --- a/data/c.m4 +++ b/data/c.m4 @@ -2,7 +2,7 @@ # C M4 Macros for Bison. -# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc. +# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -51,26 +51,6 @@ m4_define([b4_cpp_guard_close], ## Identification. ## ## ---------------- ## -# b4_comment_(TEXT, OPEN, CONTINUE, END) -# -------------------------------------- -# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines. -# Avoid adding indentation to the first line, as the indentation comes -# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]). -# -# Prefix all the output lines with PREFIX. -m4_define([b4_comment_], -[$2[]m4_bpatsubst(m4_expand([$1]), [ -\(.\)], [ -$3\1])$4]) - - -# b4_comment(TEXT, [PREFIX]) -# -------------------------- -# Put TEXT in comment. Prefix all the output lines with PREFIX. -m4_define([b4_comment], -[b4_comment_([$1], [$2/* ], [$2 ], [ */])]) - - # b4_identification # ----------------- # Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or @@ -172,7 +152,7 @@ m4_popdef([$1])dnl # -------------------------------- # `YYUSE' VAL, LOC if locations are enabled, and all the parse-params. m4_define([b4_parse_param_use], -[m4_ifvaln([$1], [ YYUSE([$1]);])dnl +[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); ])dnl @@ -246,7 +226,7 @@ m4_define([b4_null], [YY_NULL]) # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT) # ------------------------------------------------------------- -# Define "yy" which contents is CONTENT. +# Define "yy" whose contents is CONTENT. m4_define([b4_integral_parser_table_define], [m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl static const b4_int_type_for([$2]) yy$1[[]] = @@ -500,10 +480,8 @@ m4_if(b4_skeleton, ["yacc.c"], b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl m4_ifset([b4_parse_param], [, b4_parse_param]))[ { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); ]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); @@ -523,11 +501,11 @@ b4_locations_if([, yylocationp])[]b4_user_args[); m4_define([b4_value_type_define], [[/* Value type. */ #if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED -]m4_ifdef([b4_stype], +]m4_ifdef([b4_union_members], [[typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE; union ]b4_union_name[ { -]b4_user_stype[ +]b4_user_union_members[ }; # define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]], [m4_if(b4_tag_seen_flag, 0, @@ -653,25 +631,25 @@ __attribute__((__unused__)) int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { - res += fprintf (yyo, "%d", yylocp->first_line); + res += YYFPRINTF (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) - res += fprintf (yyo, ".%d", yylocp->first_column); + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { - res += fprintf (yyo, "-%d", yylocp->last_line); + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); if (0 <= end_col) - res += fprintf (yyo, ".%d", end_col); + res += YYFPRINTF (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) - res += fprintf (yyo, "-%d", end_col); + res += YYFPRINTF (yyo, "-%d", end_col); } return res; } -# define YY_LOCATION_PRINT(File, Loc) \ +# define YY_LOCATION_PRINT(File, Loc) \ yy_location_print_ (File, &(Loc)) # else