From: Ulya Trofimovich Date: Sat, 13 Jul 2019 17:36:03 +0000 (+0100) Subject: Disable ceratain warnings on bison-generated output (we have no control over it). X-Git-Tag: 1.2~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a89e9ec3dc12ba678590500de814c3a7c543e6d6;p=re2c Disable ceratain warnings on bison-generated output (we have no control over it). --- diff --git a/bootstrap/lib/lex.cc b/bootstrap/lib/lex.cc index eb5fc303..9375236f 100644 --- a/bootstrap/lib/lex.cc +++ b/bootstrap/lib/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Wed May 8 14:28:22 2019 */ +/* Generated by re2c 1.1.1 on Sat Jul 13 18:32:57 2019 */ #line 1 "../lib/lex.re" #include diff --git a/bootstrap/lib/parse.cc b/bootstrap/lib/parse.cc index e31732ae..d61d8114 100644 --- a/bootstrap/lib/parse.cc +++ b/bootstrap/lib/parse.cc @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018 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 @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4" +#define YYBISON_VERSION "3.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -66,22 +66,34 @@ #include +#include #include "src/util/c99_stdint.h" #include "src/parse/ast.h" #include "lib/lex.h" +// disable certain GCC and/or Clang warnings, as we have no control over +// autogenerated code (Clang also understands '#pragma GCC') +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wmissing-variable-declarations" +#pragma GCC diagnostic ignored "-Wunreachable-code" +#pragma GCC diagnostic ignored "-Wunreachable-code-break" + using namespace re2c; extern "C" { int yylex(const char *&pattern); -void yyerror(const char *pattern, const char*); +void yyerror(const char *pattern, const char*) RE2C_GXX_ATTRIBUTE((noreturn)); } // extern "C" -#line 85 "lib/parse.cc" /* yacc.c:339 */ +#line 97 "lib/parse.cc" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -127,12 +139,12 @@ extern int yydebug; union YYSTYPE { -#line 25 "../lib/parse.ypp" /* yacc.c:355 */ +#line 37 "../lib/parse.ypp" /* yacc.c:355 */ const re2c::AST *regexp; re2c::ASTBounds bounds; -#line 136 "lib/parse.cc" /* yacc.c:355 */ +#line 148 "lib/parse.cc" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -149,7 +161,7 @@ int yyparse (const char *&pattern); /* Copy the second part of user declarations. */ -#line 153 "lib/parse.cc" /* yacc.c:358 */ +#line 165 "lib/parse.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -170,13 +182,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -188,7 +200,7 @@ typedef short int yytype_int16; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -240,7 +252,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -408,7 +420,7 @@ union yyalloc #define YYMAXUTOK 260 #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ @@ -447,8 +459,8 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 39, 39, 42, 43, 47, 48, 52, 53, 54, - 55, 56, 60, 61, 62 + 0, 51, 51, 54, 55, 59, 60, 64, 65, 66, + 67, 68, 72, 73, 74 }; #endif @@ -682,7 +694,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, const char *&pattern) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -908,6 +920,7 @@ yysyntax_error (YYSIZE_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")); @@ -1114,7 +1127,7 @@ yyparse (const char *&pattern) yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; @@ -1225,61 +1238,61 @@ yyreduce: switch (yyn) { case 2: -#line 39 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 51 "../lib/parse.ypp" /* yacc.c:1651 */ { regexp = (yyval.regexp); } -#line 1231 "lib/parse.cc" /* yacc.c:1646 */ +#line 1244 "lib/parse.cc" /* yacc.c:1651 */ break; case 4: -#line 43 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 55 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_alt((yyvsp[-2].regexp), (yyvsp[0].regexp)); } -#line 1237 "lib/parse.cc" /* yacc.c:1646 */ +#line 1250 "lib/parse.cc" /* yacc.c:1651 */ break; case 6: -#line 48 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 60 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_cat((yyvsp[-1].regexp), (yyvsp[0].regexp)); } -#line 1243 "lib/parse.cc" /* yacc.c:1646 */ +#line 1256 "lib/parse.cc" /* yacc.c:1651 */ break; case 8: -#line 53 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 65 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_iter((yyvsp[-1].regexp), 0, AST::MANY); } -#line 1249 "lib/parse.cc" /* yacc.c:1646 */ +#line 1262 "lib/parse.cc" /* yacc.c:1651 */ break; case 9: -#line 54 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 66 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_iter((yyvsp[-1].regexp), 1, AST::MANY); } -#line 1255 "lib/parse.cc" /* yacc.c:1646 */ +#line 1268 "lib/parse.cc" /* yacc.c:1651 */ break; case 10: -#line 55 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 67 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_iter((yyvsp[-1].regexp), 0, 1); } -#line 1261 "lib/parse.cc" /* yacc.c:1646 */ +#line 1274 "lib/parse.cc" /* yacc.c:1651 */ break; case 11: -#line 56 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 68 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max); } -#line 1267 "lib/parse.cc" /* yacc.c:1646 */ +#line 1280 "lib/parse.cc" /* yacc.c:1651 */ break; case 13: -#line 61 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 73 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_cap(ast_nil(NOWHERE)); } -#line 1273 "lib/parse.cc" /* yacc.c:1646 */ +#line 1286 "lib/parse.cc" /* yacc.c:1651 */ break; case 14: -#line 62 "../lib/parse.ypp" /* yacc.c:1646 */ +#line 74 "../lib/parse.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_cap((yyvsp[-1].regexp)); } -#line 1279 "lib/parse.cc" /* yacc.c:1646 */ +#line 1292 "lib/parse.cc" /* yacc.c:1651 */ break; -#line 1283 "lib/parse.cc" /* yacc.c:1646 */ +#line 1296 "lib/parse.cc" /* yacc.c:1651 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1507,14 +1520,17 @@ yyreturn: #endif return yyresult; } -#line 65 "../lib/parse.ypp" /* yacc.c:1906 */ +#line 77 "../lib/parse.ypp" /* yacc.c:1910 */ + +#pragma GCC diagnostic pop extern "C" { void yyerror(const char *pattern, const char *msg) { fprintf(stderr, "%s (on RE %s)", msg, pattern); + exit(1); } int yylex(const char *&pattern) diff --git a/bootstrap/lib/parse.h b/bootstrap/lib/parse.h index 9608408b..9be559c7 100644 --- a/bootstrap/lib/parse.h +++ b/bootstrap/lib/parse.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018 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 @@ -56,12 +56,12 @@ extern int yydebug; union YYSTYPE { -#line 25 "../lib/parse.ypp" /* yacc.c:1909 */ +#line 37 "../lib/parse.ypp" /* yacc.c:1913 */ const re2c::AST *regexp; re2c::ASTBounds bounds; -#line 65 "lib/parse.h" /* yacc.c:1909 */ +#line 65 "lib/parse.h" /* yacc.c:1913 */ }; typedef union YYSTYPE YYSTYPE; diff --git a/bootstrap/src/parse/lex.cc b/bootstrap/src/parse/lex.cc index e28d2200..10c77319 100644 --- a/bootstrap/src/parse/lex.cc +++ b/bootstrap/src/parse/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Sat Jul 13 11:00:45 2019 */ +/* Generated by re2c 1.1.1 on Sat Jul 13 18:25:08 2019 */ #line 1 "../src/parse/lex.re" #include #include "src/util/c99_stdint.h" diff --git a/bootstrap/src/parse/lex.h b/bootstrap/src/parse/lex.h index e2aa68e7..7eed37b6 100644 --- a/bootstrap/src/parse/lex.h +++ b/bootstrap/src/parse/lex.h @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Sat Jul 13 11:00:45 2019 */ +/* Generated by re2c 1.1.1 on Sat Jul 13 18:25:08 2019 */ #ifndef _RE2C_PARSE_LEX_ #define _RE2C_PARSE_LEX_ diff --git a/bootstrap/src/parse/parser.cc b/bootstrap/src/parse/parser.cc index b6d023ec..9c80a26a 100644 --- a/bootstrap/src/parse/parser.cc +++ b/bootstrap/src/parse/parser.cc @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018 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 @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4" +#define YYBISON_VERSION "3.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -65,14 +65,26 @@ #line 1 "../src/parse/parser.ypp" /* yacc.c:339 */ +// disable certain GCC and/or Clang warnings, as we have no control over +// autogenerated code (Clang also understands '#pragma GCC') +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wmissing-variable-declarations" +#pragma GCC diagnostic ignored "-Wunreachable-code" +#pragma GCC diagnostic ignored "-Wunreachable-code-break" + #include "src/parse/parse.h" + using namespace re2c; extern "C" { int yylex(context_t &context); -void yyerror(context_t &context, const char*); +void yyerror(context_t &context, const char*) RE2C_GXX_ATTRIBUTE((noreturn)); } // extern "C" @@ -86,7 +98,7 @@ static spec_t &find(specs_t &specs, const std::string &name) } -#line 90 "src/parse/parser.cc" /* yacc.c:339 */ +#line 102 "src/parse/parser.cc" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -142,7 +154,7 @@ extern int yydebug; union YYSTYPE { -#line 30 "../src/parse/parser.ypp" /* yacc.c:355 */ +#line 42 "../src/parse/parser.ypp" /* yacc.c:355 */ const re2c::AST * regexp; re2c::Code * code; @@ -151,7 +163,7 @@ union YYSTYPE std::string * str; re2c::CondList * clist; -#line 155 "src/parse/parser.cc" /* yacc.c:355 */ +#line 167 "src/parse/parser.cc" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -168,7 +180,7 @@ int yyparse (re2c::context_t &context); /* Copy the second part of user declarations. */ -#line 172 "src/parse/parser.cc" /* yacc.c:358 */ +#line 184 "src/parse/parser.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -189,13 +201,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -207,7 +219,7 @@ typedef short int yytype_int16; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -259,7 +271,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -427,7 +439,7 @@ union yyalloc #define YYMAXUTOK 270 #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ @@ -467,11 +479,11 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 62, 62, 64, 65, 66, 67, 71, 79, 85, - 86, 89, 89, 92, 95, 98, 101, 107, 113, 119, - 125, 132, 133, 138, 145, 146, 152, 153, 157, 158, - 162, 164, 168, 169, 176, 182, 183, 187, 188, 189, - 193, 194, 206 + 0, 74, 74, 76, 77, 78, 79, 83, 91, 97, + 98, 101, 101, 104, 107, 110, 113, 119, 125, 131, + 137, 144, 145, 150, 157, 158, 164, 165, 169, 170, + 174, 176, 180, 181, 188, 194, 195, 199, 200, 201, + 205, 206, 218 }; #endif @@ -741,7 +753,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, re2c::context_t &context) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -967,6 +979,7 @@ yysyntax_error (YYSIZE_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")); @@ -1173,7 +1186,7 @@ yyparse (re2c::context_t &context) yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; @@ -1284,13 +1297,13 @@ yyreduce: switch (yyn) { case 3: -#line 64 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 76 "../src/parse/parser.ypp" /* yacc.c:1651 */ { context.input.lex_conf(context.opts); } -#line 1290 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1303 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 7: -#line 71 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 83 "../src/parse/parser.ypp" /* yacc.c:1651 */ { if (!context.symtab.insert(std::make_pair(*(yyvsp[-2].str), (yyvsp[-1].regexp))).second) { context.input.msg.fatal(context.input.tok_loc() @@ -1298,157 +1311,157 @@ yyreduce: } delete (yyvsp[-2].str); } -#line 1302 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1315 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 8: -#line 79 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 91 "../src/parse/parser.ypp" /* yacc.c:1651 */ { context.input.msg.fatal(context.input.tok_loc() , "trailing contexts are not allowed in named definitions"); } -#line 1311 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1324 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 9: -#line 85 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 97 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.str) = (yyvsp[-1].str); } -#line 1317 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1330 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 13: -#line 92 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 104 "../src/parse/parser.ypp" /* yacc.c:1651 */ { find(context.specs, "").rules.push_back(ASTRule((yyvsp[-1].regexp), (yyvsp[0].code))); } -#line 1325 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1338 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 14: -#line 95 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 107 "../src/parse/parser.ypp" /* yacc.c:1651 */ { find(context.specs, "").defs.push_back((yyvsp[0].code)); } -#line 1333 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1346 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 15: -#line 98 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 110 "../src/parse/parser.ypp" /* yacc.c:1651 */ { find(context.specs, "").eofs.push_back((yyvsp[0].code)); } -#line 1341 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1354 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 16: -#line 101 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 113 "../src/parse/parser.ypp" /* yacc.c:1651 */ { for(CondList::const_iterator i = (yyvsp[-2].clist)->begin(); i != (yyvsp[-2].clist)->end(); ++i) { find(context.specs, *i).rules.push_back(ASTRule((yyvsp[-1].regexp), (yyvsp[0].code))); } delete (yyvsp[-2].clist); } -#line 1352 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1365 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 17: -#line 107 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 119 "../src/parse/parser.ypp" /* yacc.c:1651 */ { for(CondList::const_iterator i = (yyvsp[-2].clist)->begin(); i != (yyvsp[-2].clist)->end(); ++i) { find(context.specs, *i).defs.push_back((yyvsp[0].code)); } delete (yyvsp[-2].clist); } -#line 1363 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1376 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 18: -#line 113 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 125 "../src/parse/parser.ypp" /* yacc.c:1651 */ { for(CondList::const_iterator i = (yyvsp[-2].clist)->begin(); i != (yyvsp[-2].clist)->end(); ++i) { find(context.specs, *i).eofs.push_back((yyvsp[0].code)); } delete (yyvsp[-2].clist); } -#line 1374 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1387 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 19: -#line 119 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 131 "../src/parse/parser.ypp" /* yacc.c:1651 */ { for (CondList::const_iterator i = (yyvsp[-1].clist)->begin(); i != (yyvsp[-1].clist)->end(); ++i) { find(context.specs, *i).setup.push_back((yyvsp[0].code)); } delete (yyvsp[-1].clist); } -#line 1385 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1398 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 20: -#line 125 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 137 "../src/parse/parser.ypp" /* yacc.c:1651 */ { const AST *r = ast_nil(context.input.tok_loc()); find(context.specs, "0").rules.push_back(ASTRule(r, (yyvsp[0].code))); delete (yyvsp[-1].clist); } -#line 1395 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1408 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 22: -#line 133 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 145 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.code) = (yyvsp[0].code); (yyval.code)->cond = *(yyvsp[-1].str); delete (yyvsp[-1].str); } -#line 1405 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1418 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 23: -#line 138 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 150 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.code) = new Code(context.input.tok_loc()); (yyval.code)->cond = *(yyvsp[0].str); delete (yyvsp[0].str); } -#line 1415 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1428 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 24: -#line 145 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 157 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_cap((yyvsp[0].regexp)); } -#line 1421 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1434 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 25: -#line 146 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 158 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_cat(ast_cap((yyvsp[-2].regexp)), ast_cat(ast_tag(context.input.tok_loc(), NULL, false), (yyvsp[0].regexp))); } -#line 1430 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1443 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 27: -#line 153 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 165 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_alt((yyvsp[-2].regexp), (yyvsp[0].regexp)); } -#line 1436 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1449 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 29: -#line 158 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 170 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_diff((yyvsp[-2].regexp), (yyvsp[0].regexp)); } -#line 1442 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1455 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 31: -#line 164 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 176 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_cat((yyvsp[-1].regexp), (yyvsp[0].regexp)); } -#line 1448 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1461 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 33: -#line 169 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 181 "../src/parse/parser.ypp" /* yacc.c:1651 */ { switch((yyvsp[0].op)) { case '*': (yyval.regexp) = ast_iter((yyvsp[-1].regexp), 0, AST::MANY); break; @@ -1456,43 +1469,43 @@ yyreduce: case '?': (yyval.regexp) = ast_iter((yyvsp[-1].regexp), 0, 1); break; } } -#line 1460 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1473 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 34: -#line 176 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 188 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max); } -#line 1468 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1481 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 36: -#line 183 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 195 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.op) = ((yyvsp[-1].op) == (yyvsp[0].op)) ? (yyvsp[-1].op) : '*'; } -#line 1474 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1487 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 37: -#line 187 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 199 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.op) = '*'; } -#line 1480 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1493 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 38: -#line 188 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 200 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.op) = '+'; } -#line 1486 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1499 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 39: -#line 189 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 201 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.op) = '?'; } -#line 1492 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1505 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 41: -#line 194 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 206 "../src/parse/parser.ypp" /* yacc.c:1651 */ { symtab_t::iterator i = context.symtab.find(*(yyvsp[0].str)); if (i == context.symtab.end()) { @@ -1505,17 +1518,17 @@ yyreduce: } delete (yyvsp[0].str); } -#line 1509 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1522 "src/parse/parser.cc" /* yacc.c:1651 */ break; case 42: -#line 206 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 218 "../src/parse/parser.ypp" /* yacc.c:1651 */ { (yyval.regexp) = ast_cap((yyvsp[-1].regexp)); } -#line 1515 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1528 "src/parse/parser.cc" /* yacc.c:1651 */ break; -#line 1519 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1532 "src/parse/parser.cc" /* yacc.c:1651 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1743,9 +1756,11 @@ yyreturn: #endif return yyresult; } -#line 209 "../src/parse/parser.ypp" /* yacc.c:1906 */ +#line 221 "../src/parse/parser.ypp" /* yacc.c:1910 */ +#pragma GCC diagnostic pop + extern "C" { void yyerror(context_t &context, const char* s) @@ -1760,8 +1775,7 @@ int yylex(context_t &context) } // extern "C" -namespace re2c -{ +namespace re2c { void parse(Scanner &input, specs_t &specs, symtab_t &symtab, Opt &opts) { diff --git a/bootstrap/src/parse/parser.h b/bootstrap/src/parse/parser.h index 0ff93616..e047d59c 100644 --- a/bootstrap/src/parse/parser.h +++ b/bootstrap/src/parse/parser.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018 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 @@ -66,7 +66,7 @@ extern int yydebug; union YYSTYPE { -#line 30 "../src/parse/parser.ypp" /* yacc.c:1909 */ +#line 42 "../src/parse/parser.ypp" /* yacc.c:1913 */ const re2c::AST * regexp; re2c::Code * code; @@ -75,7 +75,7 @@ union YYSTYPE std::string * str; re2c::CondList * clist; -#line 79 "src/parse/parser.h" /* yacc.c:1909 */ +#line 79 "src/parse/parser.h" /* yacc.c:1913 */ }; typedef union YYSTYPE YYSTYPE; diff --git a/lib/parse.ypp b/lib/parse.ypp index 373273ba..9c9c7753 100644 --- a/lib/parse.ypp +++ b/lib/parse.ypp @@ -1,17 +1,29 @@ %{ #include +#include #include "src/util/c99_stdint.h" #include "src/parse/ast.h" #include "lib/lex.h" +// disable certain GCC and/or Clang warnings, as we have no control over +// autogenerated code (Clang also understands '#pragma GCC') +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wmissing-variable-declarations" +#pragma GCC diagnostic ignored "-Wunreachable-code" +#pragma GCC diagnostic ignored "-Wunreachable-code-break" + using namespace re2c; extern "C" { int yylex(const char *&pattern); -void yyerror(const char *pattern, const char*); +void yyerror(const char *pattern, const char*) RE2C_GXX_ATTRIBUTE((noreturn)); } // extern "C" @@ -64,11 +76,14 @@ primary %% +#pragma GCC diagnostic pop + extern "C" { void yyerror(const char *pattern, const char *msg) { fprintf(stderr, "%s (on RE %s)", msg, pattern); + exit(1); } int yylex(const char *&pattern) diff --git a/src/parse/parser.ypp b/src/parse/parser.ypp index a374326c..9d9d9c93 100644 --- a/src/parse/parser.ypp +++ b/src/parse/parser.ypp @@ -1,13 +1,25 @@ %{ +// disable certain GCC and/or Clang warnings, as we have no control over +// autogenerated code (Clang also understands '#pragma GCC') +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wmissing-variable-declarations" +#pragma GCC diagnostic ignored "-Wunreachable-code" +#pragma GCC diagnostic ignored "-Wunreachable-code-break" + #include "src/parse/parse.h" + using namespace re2c; extern "C" { int yylex(context_t &context); -void yyerror(context_t &context, const char*); +void yyerror(context_t &context, const char*) RE2C_GXX_ATTRIBUTE((noreturn)); } // extern "C" @@ -208,6 +220,8 @@ primary %% +#pragma GCC diagnostic pop + extern "C" { void yyerror(context_t &context, const char* s)