From a9a8a54c46eff474b4a2832f2d3038274be75abf Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 22 Oct 2020 21:15:06 -0700 Subject: Fix NVCC Regression in Parser (#1458) * Fix NVCC Regression in Parser Fix a regression with the recompilation of the parser that shows up with NVCC and GNUmake on Summit. * Modify Parser's makefile to remove #line and rename bison's output file to .cpp Co-authored-by: Weiqun Zhang --- Source/Parser/wp_parser.tab.cpp | 612 +++++++++++++++++----------------------- 1 file changed, 256 insertions(+), 356 deletions(-) (limited to 'Source/Parser/wp_parser.tab.cpp') diff --git a/Source/Parser/wp_parser.tab.cpp b/Source/Parser/wp_parser.tab.cpp index 56bff07bb..581cf7fdf 100644 --- a/Source/Parser/wp_parser.tab.cpp +++ b/Source/Parser/wp_parser.tab.cpp @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.5.1. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, - Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 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 @@ -41,14 +40,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.5.1" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -65,8 +61,8 @@ -/* First part of user prologue. */ -#line 2 "wp_parser.y" +/* Copy the first part of user declarations. */ + #include #include @@ -74,26 +70,13 @@ #include "wp_parser_y.h" int yylex (void); -#line 78 "wp_parser.tab.c" -# ifndef YY_CAST -# ifdef __cplusplus -# define YY_CAST(Type, Val) static_cast (Val) -# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) -# else -# define YY_CAST(Type, Val) ((Type) (Val)) -# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) -# endif -# endif + # ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr # else -# define YY_NULLPTR ((void*)0) +# define YY_NULLPTR 0 # endif # endif @@ -105,8 +88,8 @@ # define YYERROR_VERBOSE 0 #endif -/* Use api.header.include to #include this header - instead of duplicating it here. */ +/* In a future release of Bison, this section will be replaced + by #include "wp_parser.tab.h". */ #ifndef YY_YY_WP_PARSER_TAB_H_INCLUDED # define YY_YY_WP_PARSER_TAB_H_INCLUDED /* Debug traces. */ @@ -142,9 +125,10 @@ extern int yydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + union YYSTYPE { -#line 19 "wp_parser.y" + struct wp_node* n; amrex_real d; @@ -152,9 +136,9 @@ union YYSTYPE enum wp_f1_t f1; enum wp_f2_t f2; -#line 156 "wp_parser.tab.c" }; + typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -167,81 +151,36 @@ int yyparse (void); #endif /* !YY_YY_WP_PARSER_TAB_H_INCLUDED */ +/* Copy the second part of user declarations. */ + #ifdef short # undef short #endif -/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure - and (if available) are included - so that the code can choose integer types of a good width. */ - -#ifndef __PTRDIFF_MAX__ -# include /* INFRINGES ON USER NAME SPACE */ -# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_STDINT_H -# endif -#endif - -/* Narrow types that promote to a signed type and that can represent a - signed or unsigned integer of at least N bits. In tables they can - save space and decrease cache pressure. Promoting to a signed type - helps avoid bugs in integer arithmetic. */ - -#ifdef __INT_LEAST8_MAX__ -typedef __INT_LEAST8_TYPE__ yytype_int8; -#elif defined YY_STDINT_H -typedef int_least8_t yytype_int8; +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; #else -typedef signed char yytype_int8; +typedef unsigned char yytype_uint8; #endif -#ifdef __INT_LEAST16_MAX__ -typedef __INT_LEAST16_TYPE__ yytype_int16; -#elif defined YY_STDINT_H -typedef int_least16_t yytype_int16; +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; #else -typedef short yytype_int16; +typedef signed char yytype_int8; #endif -#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST8_TYPE__ yytype_uint8; -#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST8_MAX <= INT_MAX) -typedef uint_least8_t yytype_uint8; -#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX -typedef unsigned char yytype_uint8; +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; #else -typedef short yytype_uint8; +typedef unsigned short int yytype_uint16; #endif -#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ -typedef __UINT_LEAST16_TYPE__ yytype_uint16; -#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST16_MAX <= INT_MAX) -typedef uint_least16_t yytype_uint16; -#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX -typedef unsigned short yytype_uint16; +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; #else -typedef int yytype_uint16; -#endif - -#ifndef YYPTRDIFF_T -# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ -# define YYPTRDIFF_T __PTRDIFF_TYPE__ -# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ -# elif defined PTRDIFF_MAX -# ifndef ptrdiff_t -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYPTRDIFF_T ptrdiff_t -# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# else -# define YYPTRDIFF_T long -# define YYPTRDIFF_MAXIMUM LONG_MAX -# endif +typedef short int yytype_int16; #endif #ifndef YYSIZE_T @@ -249,27 +188,15 @@ typedef int yytype_uint16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned +# define YYSIZE_T unsigned int # endif #endif -#define YYSIZE_MAXIMUM \ - YY_CAST (YYPTRDIFF_T, \ - (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ - ? YYPTRDIFF_MAXIMUM \ - : YY_CAST (YYSIZE_T, -1))) - -#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) - -/* Stored state numbers (used for stacks). */ -typedef yytype_int8 yy_state_t; - -/* State numbers in computations. */ -typedef int yy_state_fast_t; +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -283,19 +210,30 @@ typedef int yy_state_fast_t; # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else -# define YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + #ifndef YY_ATTRIBUTE_UNUSED -# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) # else -# define YY_ATTRIBUTE_UNUSED +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif @@ -306,13 +244,13 @@ typedef int yy_state_fast_t; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -325,20 +263,6 @@ typedef int yy_state_fast_t; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif -#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ -# define YY_IGNORE_USELESS_CAST_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") -# define YY_IGNORE_USELESS_CAST_END \ - _Pragma ("GCC diagnostic pop") -#endif -#ifndef YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_END -#endif - - -#define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE @@ -415,17 +339,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yy_state_t yyss_alloc; + yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -438,11 +362,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYPTRDIFF_T yynewbytes; \ + YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) @@ -454,12 +378,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYPTRDIFF_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -482,18 +406,17 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 50 +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 272 - -/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex. */ -static const yytype_int8 yytranslate[] = + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -527,7 +450,7 @@ static const yytype_int8 yytranslate[] = #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_int8 yyrline[] = +static const yytype_uint8 yyrline[] = { 0, 67, 67, 68, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, @@ -550,7 +473,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_int16 yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 94, 265, 266, 267, 268, 269, 270, 61, 60, 62, @@ -558,14 +481,14 @@ static const yytype_int16 yytoknum[] = }; # endif -#define YYPACT_NINF (-24) +#define YYPACT_NINF -24 -#define yypact_value_is_default(Yyn) \ - ((Yyn) == YYPACT_NINF) +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-24))) -#define YYTABLE_NINF (-1) +#define YYTABLE_NINF -1 -#define yytable_value_is_error(Yyn) \ +#define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -582,7 +505,7 @@ static const yytype_int16 yypact[] = /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ -static const yytype_int8 yydefact[] = +static const yytype_uint8 yydefact[] = { 2, 0, 1, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 20, 19, 0, 3, 0, 0, 0, @@ -606,7 +529,7 @@ static const yytype_int8 yydefgoto[] = /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int8 yytable[] = +static const yytype_uint8 yytable[] = { 13, 14, 15, 11, 30, 31, 12, 17, 0, 0, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, @@ -654,7 +577,7 @@ static const yytype_int8 yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_int8 yystos[] = +static const yytype_uint8 yystos[] = { 0, 30, 0, 4, 5, 6, 7, 20, 21, 26, 31, 26, 26, 31, 31, 31, 8, 9, 11, 12, @@ -664,7 +587,7 @@ static const yytype_int8 yystos[] = }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_int8 yyr1[] = +static const yytype_uint8 yyr1[] = { 0, 29, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, @@ -672,7 +595,7 @@ static const yytype_int8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_int8 yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 0, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, @@ -692,22 +615,22 @@ static const yytype_int8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (0) +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) /* Error token number */ #define YYTERROR 1 @@ -747,39 +670,37 @@ do { \ } while (0) -/*-----------------------------------. -| Print this symbol's value on YYO. | -`-----------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ static void -yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyoutput = yyo; - YYUSE (yyoutput); + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyo, yytoknum[yytype], *yyvaluep); + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*---------------------------. -| Print this symbol on YYO. | -`---------------------------*/ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ static void -yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyo, "%s %s (", + YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyo, yytype, yyvaluep); - YYFPRINTF (yyo, ")"); + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. @@ -788,7 +709,7 @@ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -811,20 +732,20 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { - int yylno = yyrline[yyrule]; + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[+yyssp[yyi + 1 - yynrhs]], - &yyvsp[(yyi + 1) - (yynrhs)] + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } @@ -868,13 +789,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +# define yystrlen strlen # else /* Return the length of YYSTR. */ -static YYPTRDIFF_T +static YYSIZE_T yystrlen (const char *yystr) { - YYPTRDIFF_T yylen; + YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -910,12 +831,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYPTRDIFF_T +static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYPTRDIFF_T yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -928,10 +849,7 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - else - goto append; - - append: + /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; @@ -946,10 +864,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (yyres) - return yystpcpy (yyres, yystr) - yyres; - else + if (! yyres) return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; } # endif @@ -962,19 +880,19 @@ yytnamerr (char *yyres, const char *yystr) *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int -yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - yy_state_t *yyssp, int yytoken) +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat: reported tokens (one for the "unexpected", - one per "expected"). */ + /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Actual size of YYARG. */ + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ int yycount = 0; - /* Cumulated lengths of YYARG. */ - YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -1001,9 +919,7 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, */ if (yytoken != YYEMPTY) { - int yyn = yypact[+*yyssp]; - YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - yysize = yysize0; + int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1028,12 +944,11 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYPTRDIFF_T yysize1 - = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; + yysize = yysize1; } } } @@ -1045,7 +960,6 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break - default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1056,13 +970,10 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, } { - /* Don't count the "%s"s in the final size, but reserve room for - the terminator. */ - YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; + yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1088,8 +999,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, } else { - ++yyp; - ++yyformat; + yyp++; + yyformat++; } } return 0; @@ -1132,7 +1043,7 @@ int yynerrs; int yyparse (void) { - yy_state_fast_t yystate; + int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1144,16 +1055,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss; - yy_state_t *yyssp; + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYPTRDIFF_T yystacksize; + YYSIZE_T yystacksize; int yyn; int yyresult; @@ -1167,7 +1078,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1188,54 +1099,46 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; - /*------------------------------------------------------------. -| yynewstate -- push a new state, which is found in yystate. | +| yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ -yynewstate: + yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - -/*--------------------------------------------------------------------. -| yysetstate -- set current state (the top of the stack) to yystate. | -`--------------------------------------------------------------------*/ -yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - YY_IGNORE_USELESS_CAST_BEGIN - *yyssp = YY_CAST (yy_state_t, yystate); - YY_IGNORE_USELESS_CAST_END + yysetstate: + *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) -#if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; -#else { /* Get the current used size of the three stacks, in elements. */ - YYPTRDIFF_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; -# if defined yyoverflow +#ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ - yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * YYSIZEOF (*yyssp), - &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); + yyss = yyss1; yyvs = yyvs1; } -# else /* defined YYSTACK_RELOCATE */ +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1244,43 +1147,42 @@ yysetstate: yystacksize = YYMAXDEPTH; { - yy_state_t *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = - YY_CAST (union yyalloc *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif +#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YY_IGNORE_USELESS_CAST_BEGIN - YYDPRINTF ((stderr, "Stack size increased to %ld\n", - YY_CAST (long, yystacksize))); - YY_IGNORE_USELESS_CAST_END + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; - /*-----------. | yybackup. | `-----------*/ yybackup: + /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1330,13 +1232,15 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - /* Discard the shifted token. */ - yychar = YYEMPTY; goto yynewstate; @@ -1351,7 +1255,7 @@ yydefault: /*-----------------------------. -| yyreduce -- do a reduction. | +| yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1371,136 +1275,135 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 3: -#line 68 "wp_parser.y" - { + case 3: + + { wp_defexpr((yyvsp[-1].n)); } -#line 1380 "wp_parser.tab.c" + break; case 4: -#line 77 "wp_parser.y" - { (yyval.n) = wp_newnumber((yyvsp[0].d)); } -#line 1386 "wp_parser.tab.c" + + { (yyval.n) = wp_newnumber((yyvsp[0].d)); } + break; case 5: -#line 78 "wp_parser.y" - { (yyval.n) = wp_newsymbol((yyvsp[0].s)); } -#line 1392 "wp_parser.tab.c" + + { (yyval.n) = wp_newsymbol((yyvsp[0].s)); } + break; case 6: -#line 79 "wp_parser.y" - { (yyval.n) = wp_newnode(WP_ADD, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1398 "wp_parser.tab.c" + + { (yyval.n) = wp_newnode(WP_ADD, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 7: -#line 80 "wp_parser.y" - { (yyval.n) = wp_newnode(WP_SUB, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1404 "wp_parser.tab.c" + + { (yyval.n) = wp_newnode(WP_SUB, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 8: -#line 81 "wp_parser.y" - { (yyval.n) = wp_newnode(WP_MUL, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1410 "wp_parser.tab.c" + + { (yyval.n) = wp_newnode(WP_MUL, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 9: -#line 82 "wp_parser.y" - { (yyval.n) = wp_newnode(WP_DIV, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1416 "wp_parser.tab.c" + + { (yyval.n) = wp_newnode(WP_DIV, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 10: -#line 83 "wp_parser.y" - { (yyval.n) = (yyvsp[-1].n); } -#line 1422 "wp_parser.tab.c" + + { (yyval.n) = (yyvsp[-1].n); } + break; case 11: -#line 84 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_LT, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1428 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_LT, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 12: -#line 85 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_GT, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1434 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_GT, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 13: -#line 86 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_LEQ, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1440 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_LEQ, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 14: -#line 87 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_GEQ, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1446 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_GEQ, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 15: -#line 88 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_EQ, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1452 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_EQ, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 16: -#line 89 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_NEQ, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1458 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_NEQ, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 17: -#line 90 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_AND, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1464 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_AND, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 18: -#line 91 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_OR, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1470 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_OR, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 19: -#line 92 "wp_parser.y" - { (yyval.n) = wp_newnode(WP_NEG, (yyvsp[0].n), NULL); } -#line 1476 "wp_parser.tab.c" + + { (yyval.n) = wp_newnode(WP_NEG, (yyvsp[0].n), NULL); } + break; case 20: -#line 93 "wp_parser.y" - { (yyval.n) = (yyvsp[0].n); } -#line 1482 "wp_parser.tab.c" + + { (yyval.n) = (yyvsp[0].n); } + break; case 21: -#line 94 "wp_parser.y" - { (yyval.n) = wp_newf2(WP_POW, (yyvsp[-2].n), (yyvsp[0].n)); } -#line 1488 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2(WP_POW, (yyvsp[-2].n), (yyvsp[0].n)); } + break; case 22: -#line 95 "wp_parser.y" - { (yyval.n) = wp_newf1((yyvsp[-3].f1), (yyvsp[-1].n)); } -#line 1494 "wp_parser.tab.c" + + { (yyval.n) = wp_newf1((yyvsp[-3].f1), (yyvsp[-1].n)); } + break; case 23: -#line 96 "wp_parser.y" - { (yyval.n) = wp_newf2((yyvsp[-5].f2), (yyvsp[-3].n), (yyvsp[-1].n)); } -#line 1500 "wp_parser.tab.c" + + { (yyval.n) = wp_newf2((yyvsp[-5].f2), (yyvsp[-3].n), (yyvsp[-1].n)); } + break; -#line 1504 "wp_parser.tab.c" default: break; } @@ -1526,13 +1429,14 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - { - const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); - } + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; @@ -1564,7 +1468,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; @@ -1615,10 +1519,12 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - /* Pacify compilers when the user code never invokes YYERROR and the - label yyerrorlab therefore never appears in user code. */ - if (0) - YYERROR; + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -1680,7 +1586,6 @@ yyacceptlab: yyresult = 0; goto yyreturn; - /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -1688,7 +1593,6 @@ yyabortlab: yyresult = 1; goto yyreturn; - #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -1699,10 +1603,6 @@ yyexhaustedlab: /* Fall through. */ #endif - -/*-----------------------------------------------------. -| yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -1719,7 +1619,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[+*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1732,5 +1632,5 @@ yyreturn: #endif return yyresult; } -#line 99 "wp_parser.y" + -- cgit v1.2.3