X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/6b4cb804b5fe6b4e2f087babab809c2b790d2b89..623a5147e67ac2f657f23fcedb660df87515c806:/data/yacc.c diff --git a/data/yacc.c b/data/yacc.c index 7bcbd7ca..5d68bd4e 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -170,11 +170,34 @@ m4_define([b4_declare_scanner_communication_variables], [[ /* The lookahead symbol. */ int yychar; +]b4_pure_if([[ +#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 \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +static YYSTYPE yyval_default;]b4_locations_if([ +b4_yyloc_default_define])[ +# define YY_INITIAL_VALUE(Value) = Value +#endif]])[ +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval;]b4_locations_if([[ +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);]b4_locations_if([[ /* Location data for the lookahead symbol. */ -YYLTYPE yylloc;]])b4_pure_if([], [[ +YYLTYPE yylloc YY_INITIAL_VALUE(yyloc_default);]])b4_pure_if([], [[ /* Number of syntax errors so far. */ int yynerrs;]])]) @@ -404,24 +427,24 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(n) (n) +# define YYID(N) (N) #else ]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[ { @@ -680,11 +703,11 @@ static const ]b4_int_type_for([b4_table])[ yytable[] = ]b4_table[ }; -#define yypact_value_is_default(yystate) \ - ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[ +#define yypact_value_is_default(Yystate) \ + ]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[ -#define yytable_value_is_error(yytable_value) \ - ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[ +#define yytable_value_is_error(Yytable_value) \ + ]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[ static const ]b4_int_type_for([b4_check])[ yycheck[] = { @@ -747,10 +770,9 @@ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 +]b4_locations_if([[ ]b4_yylloc_default_define[ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) -]b4_locations_if([[ - /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know @@ -765,18 +787,14 @@ while (YYID (0)) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif -#endif]], [[ - - -/* This macro is provided for backward compatibility. */ - +#endif]], +[[/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif]])[ /* YYLEX -- calling `yylex' with the right arguments. */ - #ifdef YYLEX_PARAM # define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM) #else @@ -1563,14 +1581,8 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[ The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs;]b4_locations_if([[ - yylsp = yyls; - -#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL - /* Initialize the default location before parsing starts. */ - yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; - yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; -#endif]]) -m4_ifdef([b4_initial_action],[ + yylsp = yyls;]])[ +]m4_ifdef([b4_initial_action],[ b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [], [m4_define([b4_at_dollar_used])yylloc])dnl /* User initialization code. */ @@ -1750,7 +1762,9 @@ yyread_pushed_token:]])[ YY_LAC_DISCARD ("shift");]])[ yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END ]b4_locations_if([ *++yylsp = yylloc;])[ goto yynewstate; @@ -1970,7 +1984,9 @@ yyerrlab1: current lookahead token, the shift below will for sure. */ YY_LAC_DISCARD ("error recovery");]])[ + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END ]b4_locations_if([[ yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of