From 3c0561e0043fe870426b445890ab93204332ae39 Mon Sep 17 00:00:00 2001 From: Pavel Fedin Date: Fri, 14 Aug 2015 13:52:13 +0300 Subject: Avoid conflict with host definitions when cross-compiling Certain platforms (e. g. BSD-based ones) define some ELF constants according to host. This patch fixes problems with cross-building Linux kernel on these platforms (e. g. building ARM 32-bit version on x86-64 host). Signed-off-by: Pavel Fedin Signed-off-by: Michal Marek --- scripts/mod/modpost.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts') diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 168b43dc0a59..6a5e1515123b 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -11,6 +11,12 @@ #include "elfconfig.h" +/* On BSD-alike OSes elf.h defines these according to host's word size */ +#undef ELF_ST_BIND +#undef ELF_ST_TYPE +#undef ELF_R_SYM +#undef ELF_R_TYPE + #if KERNEL_ELFCLASS == ELFCLASS32 #define Elf_Ehdr Elf32_Ehdr -- cgit v1.2.3-59-g8ed1b From 1c722503fa81888c936a8d1a5052daec859f1a7c Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Mon, 20 Jul 2015 19:52:48 -0400 Subject: genksyms: Duplicate function pointer type definitions segfault I noticed that genksyms will segfault when it sees duplicate function pointer type declaration when I placed the same function pointer definition in two separate headers in a local branch as an intermediate step of some refactoring. This can be reproduced by piping the following minimal test case into `genksyms -r /dev/null` or alternatively, putting it into a C file attempting a build: typedef int (*f)(); typedef int (*f)(); Attaching gdb to genksyms to understand this failure is useless without changing CFLAGS to emit debuginfo. Once you have debuginfo, you will find that the failure is that `char *s` was NULL and the program executed `while(*s)`. At which point, further debugging requires familiarity with compiler front end / parser development. What happens is that flex identifies the first instance of the token "f" as IDENT and the yacc parser adds it to the symbol table. On the second instance, flex will identify "f" as TYPE, which triggers an error case in the yacc parser. Given that TYPE would have been IDENT had it not been in the symbol table, the the segmentaion fault could be avoided by treating TYPE as IDENT in the affected rule. Some might consider placing identical function pointer type declarations in different headers to be poor style might consider a failure to be beneficial. However, failing through a segmentation fault makes the cause non-obvious and can waste the time of anyone who encounters it. Signed-off-by: Richard Yao Acked-by: Madhuri Yechuri Signed-off-by: Michal Marek --- scripts/genksyms/parse.y | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index b9f4cf202302..723ab30fe9d4 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y @@ -303,6 +303,15 @@ direct_declarator: $$ = $1; } } + | TYPE + { if (current_name != NULL) { + error_with_pos("unexpected second declaration name"); + YYERROR; + } else { + current_name = (*$1)->string; + $$ = $1; + } + } | direct_declarator '(' parameter_declaration_clause ')' { $$ = $4; } | direct_declarator '(' error ')' -- cgit v1.2.3-59-g8ed1b From 5b733faca671756dd41b7e24584374e2b1fc3c4d Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 20 Aug 2015 14:13:35 +0200 Subject: genksyms: Regenerate parser Rebuild the parser after commit 1c722503fa81 (genksyms: Duplicate function pointer type definitions segfault), using bison 2.7. Signed-off-by: Michal Marek --- scripts/genksyms/parse.tab.c_shipped | 671 +++++++++++++++++------------------ scripts/genksyms/parse.tab.h_shipped | 26 +- 2 files changed, 354 insertions(+), 343 deletions(-) (limited to 'scripts') diff --git a/scripts/genksyms/parse.tab.c_shipped b/scripts/genksyms/parse.tab.c_shipped index c9f0f0ce82ff..99950b5afb0d 100644 --- a/scripts/genksyms/parse.tab.c_shipped +++ b/scripts/genksyms/parse.tab.c_shipped @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 2.5.1. */ +/* A Bison parser, made by GNU Bison 2.7. */ /* Bison implementation for Yacc-like parsers in C @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5.1" +#define YYBISON_VERSION "2.7" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,8 +58,6 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 @@ -125,11 +123,6 @@ static void record_compound(struct string_list **keyw, # endif # endif -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif - /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE @@ -138,11 +131,14 @@ static void record_compound(struct string_list **keyw, # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int yydebug; +#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -196,7 +192,6 @@ static void record_compound(struct string_list **keyw, #endif - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 @@ -204,6 +199,23 @@ typedef int YYSTYPE; # define YYSTYPE_IS_DECLARED 1 #endif +extern YYSTYPE yylval; + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + /* Copy the second part of user declarations. */ @@ -260,24 +272,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 #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -427,16 +439,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 514 +#define YYLAST 515 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 54 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 49 /* YYNRULES -- Number of rules. */ -#define YYNRULES 132 +#define YYNRULES 133 /* YYNRULES -- Number of states. */ -#define YYNSTATES 187 +#define YYNSTATES 188 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -492,13 +504,13 @@ static const yytype_uint16 yyprhs[] = 97, 101, 105, 109, 112, 115, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 143, 144, 146, 148, 151, 153, 155, 157, 159, 162, 164, 166, - 171, 176, 179, 183, 187, 190, 192, 194, 196, 201, - 206, 209, 213, 217, 220, 222, 226, 227, 229, 231, - 235, 238, 241, 243, 244, 246, 248, 253, 258, 261, - 265, 269, 273, 274, 276, 279, 283, 287, 288, 290, - 292, 295, 299, 302, 303, 305, 307, 311, 314, 317, - 319, 322, 323, 326, 330, 335, 337, 341, 343, 347, - 350, 351, 353 + 168, 173, 178, 181, 185, 189, 192, 194, 196, 198, + 203, 208, 211, 215, 219, 222, 224, 228, 229, 231, + 233, 237, 240, 243, 245, 246, 248, 250, 255, 260, + 263, 267, 271, 275, 276, 278, 281, 285, 289, 290, + 292, 294, 297, 301, 304, 305, 307, 309, 313, 316, + 319, 321, 324, 325, 328, 332, 337, 339, 343, 345, + 349, 352, 353, 355 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -520,26 +532,27 @@ static const yytype_int8 yyrhs[] = 13, -1, 9, -1, 26, -1, 6, -1, 42, -1, 50, 72, -1, -1, 73, -1, 74, -1, 73, 74, -1, 8, -1, 27, -1, 31, -1, 18, -1, 71, - 75, -1, 76, -1, 38, -1, 76, 48, 79, 49, - -1, 76, 48, 1, 49, -1, 76, 34, -1, 48, - 75, 49, -1, 48, 1, 49, -1, 71, 77, -1, - 78, -1, 38, -1, 42, -1, 78, 48, 79, 49, - -1, 78, 48, 1, 49, -1, 78, 34, -1, 48, - 77, 49, -1, 48, 1, 49, -1, 80, 37, -1, - 80, -1, 81, 47, 37, -1, -1, 81, -1, 82, - -1, 81, 47, 82, -1, 66, 83, -1, 71, 83, - -1, 84, -1, -1, 38, -1, 42, -1, 84, 48, - 79, 49, -1, 84, 48, 1, 49, -1, 84, 34, - -1, 48, 83, 49, -1, 48, 1, 49, -1, 65, - 75, 33, -1, -1, 87, -1, 51, 35, -1, 52, - 89, 46, -1, 52, 1, 46, -1, -1, 90, -1, - 91, -1, 90, 91, -1, 65, 92, 45, -1, 1, - 45, -1, -1, 93, -1, 94, -1, 93, 47, 94, - -1, 77, 96, -1, 38, 95, -1, 95, -1, 53, - 35, -1, -1, 96, 31, -1, 52, 98, 46, -1, - 52, 98, 47, 46, -1, 99, -1, 98, 47, 99, - -1, 38, -1, 38, 51, 35, -1, 30, 45, -1, - -1, 30, -1, 29, 48, 38, 49, 45, -1 + 75, -1, 76, -1, 38, -1, 42, -1, 76, 48, + 79, 49, -1, 76, 48, 1, 49, -1, 76, 34, + -1, 48, 75, 49, -1, 48, 1, 49, -1, 71, + 77, -1, 78, -1, 38, -1, 42, -1, 78, 48, + 79, 49, -1, 78, 48, 1, 49, -1, 78, 34, + -1, 48, 77, 49, -1, 48, 1, 49, -1, 80, + 37, -1, 80, -1, 81, 47, 37, -1, -1, 81, + -1, 82, -1, 81, 47, 82, -1, 66, 83, -1, + 71, 83, -1, 84, -1, -1, 38, -1, 42, -1, + 84, 48, 79, 49, -1, 84, 48, 1, 49, -1, + 84, 34, -1, 48, 83, 49, -1, 48, 1, 49, + -1, 65, 75, 33, -1, -1, 87, -1, 51, 35, + -1, 52, 89, 46, -1, 52, 1, 46, -1, -1, + 90, -1, 91, -1, 90, 91, -1, 65, 92, 45, + -1, 1, 45, -1, -1, 93, -1, 94, -1, 93, + 47, 94, -1, 77, 96, -1, 38, 95, -1, 95, + -1, 53, 35, -1, -1, 96, 31, -1, 52, 98, + 46, -1, 52, 98, 47, 46, -1, 99, -1, 98, + 47, 99, -1, 38, -1, 38, 51, 35, -1, 30, + 45, -1, -1, 30, -1, 29, 48, 38, 49, 45, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -552,17 +565,17 @@ static const yytype_uint16 yyrline[] = 237, 239, 241, 246, 249, 250, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 268, 273, 274, 278, 279, 283, 283, 283, 284, 292, 293, 297, 306, - 308, 310, 312, 314, 321, 322, 326, 327, 328, 330, - 332, 334, 336, 341, 342, 343, 347, 348, 352, 353, - 358, 363, 365, 369, 370, 378, 382, 384, 386, 388, - 390, 395, 404, 405, 410, 415, 416, 420, 421, 425, - 426, 430, 432, 437, 438, 442, 443, 447, 448, 449, - 453, 457, 458, 462, 463, 467, 468, 471, 476, 484, - 488, 489, 493 + 315, 317, 319, 321, 323, 330, 331, 335, 336, 337, + 339, 341, 343, 345, 350, 351, 352, 356, 357, 361, + 362, 367, 372, 374, 378, 379, 387, 391, 393, 395, + 397, 399, 404, 413, 414, 419, 424, 425, 429, 430, + 434, 435, 439, 441, 446, 447, 451, 452, 456, 457, + 458, 462, 466, 467, 471, 472, 476, 477, 480, 485, + 493, 497, 498, 502 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -621,13 +634,13 @@ static const yytype_uint8 yyr1[] = 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71, 72, 72, 73, 73, 74, 74, 74, 74, 75, 75, 76, 76, - 76, 76, 76, 76, 77, 77, 78, 78, 78, 78, - 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, - 82, 83, 83, 84, 84, 84, 84, 84, 84, 84, - 84, 85, 86, 86, 87, 88, 88, 89, 89, 90, - 90, 91, 91, 92, 92, 93, 93, 94, 94, 94, - 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, - 101, 101, 102 + 76, 76, 76, 76, 76, 77, 77, 78, 78, 78, + 78, 78, 78, 78, 79, 79, 79, 80, 80, 81, + 81, 82, 83, 83, 84, 84, 84, 84, 84, 84, + 84, 84, 85, 86, 86, 87, 88, 88, 89, 89, + 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, + 94, 95, 96, 96, 97, 97, 98, 98, 99, 99, + 100, 101, 101, 102 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -639,14 +652,14 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 4, 1, 2, 2, 2, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, - 1, 2, 1, 1, 1, 1, 2, 1, 1, 4, - 4, 2, 3, 3, 2, 1, 1, 1, 4, 4, - 2, 3, 3, 2, 1, 3, 0, 1, 1, 3, - 2, 2, 1, 0, 1, 1, 4, 4, 2, 3, - 3, 3, 0, 1, 2, 3, 3, 0, 1, 1, - 2, 3, 2, 0, 1, 1, 3, 2, 2, 1, - 2, 0, 2, 3, 4, 1, 3, 1, 3, 2, - 0, 1, 5 + 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, + 4, 4, 2, 3, 3, 2, 1, 1, 1, 4, + 4, 2, 3, 3, 2, 1, 3, 0, 1, 1, + 3, 2, 2, 1, 0, 1, 1, 4, 4, 2, + 3, 3, 3, 0, 1, 2, 3, 3, 0, 1, + 1, 2, 3, 2, 0, 1, 1, 3, 2, 2, + 1, 2, 0, 2, 3, 4, 1, 3, 1, 3, + 2, 0, 1, 5 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. @@ -660,187 +673,187 @@ static const yytype_uint8 yydefact[] = 0, 0, 0, 64, 36, 56, 5, 10, 17, 23, 24, 26, 27, 33, 34, 11, 12, 13, 14, 15, 39, 0, 43, 6, 37, 0, 44, 22, 38, 45, - 0, 0, 129, 68, 0, 58, 0, 18, 19, 0, - 130, 67, 25, 42, 127, 0, 125, 22, 40, 0, - 113, 0, 0, 109, 9, 17, 41, 93, 0, 0, - 0, 0, 57, 59, 60, 16, 0, 66, 131, 101, - 121, 71, 0, 0, 123, 0, 7, 112, 106, 76, - 77, 0, 0, 0, 121, 75, 0, 114, 115, 119, - 105, 0, 110, 130, 94, 56, 0, 93, 90, 92, - 35, 0, 73, 72, 61, 20, 102, 0, 0, 84, - 87, 88, 128, 124, 126, 118, 0, 76, 0, 120, - 74, 117, 80, 0, 111, 0, 0, 95, 0, 91, - 98, 0, 132, 122, 0, 21, 103, 70, 69, 83, - 0, 82, 81, 0, 0, 116, 100, 99, 0, 0, - 104, 85, 89, 79, 78, 97, 96 + 0, 0, 130, 68, 69, 0, 58, 0, 18, 19, + 0, 131, 67, 25, 42, 128, 0, 126, 22, 40, + 0, 114, 0, 0, 110, 9, 17, 41, 94, 0, + 0, 0, 0, 57, 59, 60, 16, 0, 66, 132, + 102, 122, 72, 0, 0, 124, 0, 7, 113, 107, + 77, 78, 0, 0, 0, 122, 76, 0, 115, 116, + 120, 106, 0, 111, 131, 95, 56, 0, 94, 91, + 93, 35, 0, 74, 73, 61, 20, 103, 0, 0, + 85, 88, 89, 129, 125, 127, 119, 0, 77, 0, + 121, 75, 118, 81, 0, 112, 0, 0, 96, 0, + 92, 99, 0, 133, 123, 0, 21, 104, 71, 70, + 84, 0, 83, 82, 0, 0, 117, 101, 100, 0, + 0, 105, 86, 90, 80, 79, 98, 97 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 3, 36, 77, 57, 37, 66, 67, - 68, 80, 39, 40, 41, 42, 43, 69, 92, 93, - 44, 123, 71, 114, 115, 138, 139, 140, 141, 128, - 129, 45, 165, 166, 56, 81, 82, 83, 116, 117, - 118, 119, 136, 52, 75, 76, 46, 100, 47 + -1, 1, 2, 3, 36, 78, 57, 37, 67, 68, + 69, 81, 39, 40, 41, 42, 43, 70, 93, 94, + 44, 124, 72, 115, 116, 139, 140, 141, 142, 129, + 130, 45, 166, 167, 56, 82, 83, 84, 117, 118, + 119, 120, 137, 52, 76, 77, 46, 101, 47 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -140 +#define YYPACT_NINF -92 static const yytype_int16 yypact[] = { - -140, 29, -140, 207, -140, -140, 40, -140, -140, -140, - -140, -140, -27, -140, 44, -140, -140, -140, -140, -140, - -140, -140, -140, -140, -22, -140, -18, -140, -140, -140, - -9, 22, 28, -140, -140, -140, -140, -140, 42, 472, - -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, - 46, 43, -140, -140, 47, 107, -140, 472, 47, -140, - 472, 62, -140, -140, 16, -3, 57, 56, -140, 42, - 35, -11, -140, -140, 53, 48, -140, 472, -140, 51, - 21, 59, 157, -140, -140, 42, -140, 388, 58, 60, - 70, 81, -140, -3, -140, -140, 42, -140, -140, -140, - -140, -140, 253, 71, -140, -20, -140, -140, -140, 83, - -140, 5, 102, 34, -140, 12, 95, 94, -140, -140, - -140, 97, -140, 113, -140, -140, 2, 41, -140, 27, - -140, 99, -140, -140, -140, -140, -24, 98, 101, 109, - 104, -140, -140, -140, -140, -140, 105, -140, 110, -140, - -140, 117, -140, 298, -140, 21, 112, -140, 120, -140, - -140, 343, -140, -140, 121, -140, -140, -140, -140, -140, - 434, -140, -140, 131, 137, -140, -140, -140, 138, 141, - -140, -140, -140, -140, -140, -140, -140 + -92, 19, -92, 208, -92, -92, 39, -92, -92, -92, + -92, -92, -27, -92, 23, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -22, -92, 9, -92, -92, -92, + -6, 16, 25, -92, -92, -92, -92, -92, 31, 473, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + 49, 37, -92, -92, 51, 108, -92, 473, 51, -92, + 473, 59, -92, -92, -92, 12, -3, 60, 57, -92, + 31, -7, 24, -92, -92, 55, 42, -92, 473, -92, + 46, -21, 61, 158, -92, -92, 31, -92, 389, 71, + 82, 88, 89, -92, -3, -92, -92, 31, -92, -92, + -92, -92, -92, 254, 73, -92, -24, -92, -92, -92, + 90, -92, 17, 75, 45, -92, 32, 96, 95, -92, + -92, -92, 99, -92, 115, -92, -92, 3, 48, -92, + 34, -92, 102, -92, -92, -92, -92, -11, 100, 103, + 111, 104, -92, -92, -92, -92, -92, 106, -92, 113, + -92, -92, 126, -92, 299, -92, -21, 121, -92, 132, + -92, -92, 344, -92, -92, 125, -92, -92, -92, -92, + -92, 435, -92, -92, 138, 139, -92, -92, -92, 142, + 143, -92, -92, -92, -92, -92, -92, -92 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -140, -140, 190, -140, -140, -140, -140, -45, -140, -140, - 96, 1, -60, -31, -140, -140, -140, -78, -140, -140, - -55, -7, -140, -92, -140, -139, -140, -140, -59, -39, - -140, -140, -140, -140, -13, -140, -140, 111, -140, -140, - 39, 87, 84, 147, -140, 106, -140, -140, -140 + -92, -92, 192, -92, -92, -92, -92, -47, -92, -92, + 97, 0, -60, -32, -92, -92, -92, -79, -92, -92, + -58, -26, -92, -38, -92, -91, -92, -92, -59, -28, + -92, -92, -92, -92, -20, -92, -92, 112, -92, -92, + 41, 91, 83, 149, -92, 101, -92, -92, -92 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -109 +#define YYTABLE_NINF -110 static const yytype_int16 yytable[] = { - 87, 88, 113, 156, 38, 10, 146, 163, 72, 127, - 94, 50, 84, 59, 174, 20, 54, 90, 74, 148, - 58, 150, 179, 101, 29, 51, 143, 164, 33, 4, - 55, 70, 106, 113, 55, 113, -93, 102, 134, 60, - 124, 78, 87, 147, 157, 86, 152, 110, 127, 127, - 126, -93, 65, 111, 63, 65, 72, 91, 85, 109, - 153, 160, 97, 110, 64, 98, 65, 53, 99, 111, - 61, 65, 147, 62, 112, 161, 110, 113, 85, 124, - 63, 74, 111, 157, 65, 48, 49, 158, 159, 126, - 64, 65, 65, 87, 104, 105, 107, 108, 51, 55, - 89, 87, 95, 96, 103, 120, 142, 130, 79, 131, - 87, 182, 7, 8, 9, 10, 11, 12, 13, 132, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 133, 26, 27, 28, 29, 30, 112, 149, 33, 34, - 154, 155, 107, 98, 162, -22, 169, 167, 163, 35, - 168, 170, -22, -107, 171, -22, 180, -22, 121, 172, - -22, 176, 7, 8, 9, 10, 11, 12, 13, 177, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 183, 26, 27, 28, 29, 30, 184, 185, 33, 34, - 186, 5, 135, 122, 175, -22, 145, 73, 151, 35, - 0, 0, -22, -108, 0, -22, 0, -22, 6, 0, - -22, 144, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 0, 0, 0, 0, 0, -22, 0, 0, 0, 35, - 0, 0, -22, 0, 137, -22, 0, -22, 7, 8, - 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, - 29, 30, 0, 0, 33, 34, 0, 0, 0, 0, - -86, 0, 0, 0, 0, 35, 0, 0, 0, 173, - 0, 0, -86, 7, 8, 9, 10, 11, 12, 13, - 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 0, 26, 27, 28, 29, 30, 0, 0, 33, - 34, 0, 0, 0, 0, -86, 0, 0, 0, 0, - 35, 0, 0, 0, 178, 0, 0, -86, 7, 8, - 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, - 29, 30, 0, 0, 33, 34, 0, 0, 0, 0, - -86, 0, 0, 0, 0, 35, 0, 0, 0, 0, - 0, 0, -86, 7, 8, 9, 10, 11, 12, 13, - 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 0, 26, 27, 28, 29, 30, 0, 0, 33, - 34, 0, 0, 0, 0, 0, 124, 0, 0, 0, - 125, 0, 0, 0, 0, 0, 126, 0, 65, 7, + 88, 89, 114, 38, 157, 10, 59, 73, 95, 128, + 85, 50, 71, 91, 75, 20, 54, 110, 147, 4, + 164, 111, 144, 99, 29, 51, 100, 112, 33, 66, + 55, 107, 113, 114, 79, 114, 135, -94, 87, 92, + 165, 125, 60, 88, 98, 158, 53, 58, 128, 128, + 63, 127, -94, 66, 64, 148, 73, 86, 102, 111, + 65, 55, 66, 175, 61, 112, 153, 66, 161, 63, + 62, 180, 103, 64, 149, 75, 151, 114, 86, 65, + 154, 66, 162, 148, 48, 49, 125, 111, 105, 106, + 158, 108, 109, 112, 88, 66, 127, 90, 66, 159, + 160, 51, 88, 55, 97, 96, 104, 121, 143, 80, + 150, 88, 183, 7, 8, 9, 10, 11, 12, 13, + 131, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 132, 26, 27, 28, 29, 30, 133, 134, 33, + 34, 155, 156, 113, 108, 99, -22, 163, 170, 168, + 35, 171, 169, -22, -108, 172, -22, 164, -22, 122, + 181, -22, 173, 7, 8, 9, 10, 11, 12, 13, + 177, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 178, 26, 27, 28, 29, 30, 184, 185, 33, + 34, 186, 187, 5, 136, 123, -22, 176, 152, 74, + 35, 146, 0, -22, -109, 0, -22, 145, -22, 6, + 0, -22, 0, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 0, 0, 0, 0, 0, -22, 0, 0, 0, + 35, 0, 0, -22, 0, 138, -22, 0, -22, 7, + 8, 9, 10, 11, 12, 13, 0, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 0, 26, 27, + 28, 29, 30, 0, 0, 33, 34, 0, 0, 0, + 0, -87, 0, 0, 0, 0, 35, 0, 0, 0, + 174, 0, 0, -87, 7, 8, 9, 10, 11, 12, + 13, 0, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 0, 26, 27, 28, 29, 30, 0, 0, + 33, 34, 0, 0, 0, 0, -87, 0, 0, 0, + 0, 35, 0, 0, 0, 179, 0, 0, -87, 7, 8, 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, 29, 30, 0, 0, 33, 34, 0, 0, 0, - 0, 181, 0, 0, 0, 0, 35, 7, 8, 9, - 10, 11, 12, 13, 0, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 0, 26, 27, 28, 29, - 30, 0, 0, 33, 34, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 35 + 0, -87, 0, 0, 0, 0, 35, 0, 0, 0, + 0, 0, 0, -87, 7, 8, 9, 10, 11, 12, + 13, 0, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 0, 26, 27, 28, 29, 30, 0, 0, + 33, 34, 0, 0, 0, 0, 0, 125, 0, 0, + 0, 126, 0, 0, 0, 0, 0, 127, 0, 66, + 7, 8, 9, 10, 11, 12, 13, 0, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 0, 26, + 27, 28, 29, 30, 0, 0, 33, 34, 0, 0, + 0, 0, 182, 0, 0, 0, 0, 35, 7, 8, + 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, + 29, 30, 0, 0, 33, 34, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 35 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-140)) +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-92))) -#define yytable_value_is_error(yytable_value) \ +#define yytable_value_is_error(Yytable_value) \ YYID (0) static const yytype_int16 yycheck[] = { - 60, 60, 80, 1, 3, 8, 1, 31, 39, 87, - 65, 38, 57, 26, 153, 18, 38, 1, 38, 111, - 38, 113, 161, 34, 27, 52, 46, 51, 31, 0, - 52, 38, 77, 111, 52, 113, 34, 48, 93, 48, - 38, 54, 102, 38, 42, 58, 34, 42, 126, 127, - 48, 49, 50, 48, 38, 50, 87, 64, 57, 38, - 48, 34, 69, 42, 48, 30, 50, 23, 33, 48, - 48, 50, 38, 45, 53, 48, 42, 155, 77, 38, - 38, 38, 48, 42, 50, 45, 46, 126, 127, 48, - 48, 50, 50, 153, 46, 47, 45, 46, 52, 52, - 38, 161, 45, 47, 51, 46, 35, 49, 1, 49, - 170, 170, 5, 6, 7, 8, 9, 10, 11, 49, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 49, 24, 25, 26, 27, 28, 53, 35, 31, 32, - 45, 47, 45, 30, 45, 38, 37, 49, 31, 42, - 49, 47, 45, 46, 49, 48, 35, 50, 1, 49, - 53, 49, 5, 6, 7, 8, 9, 10, 11, 49, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 49, 24, 25, 26, 27, 28, 49, 49, 31, 32, - 49, 1, 96, 82, 155, 38, 109, 50, 114, 42, - -1, -1, 45, 46, -1, 48, -1, 50, 1, -1, - 53, 105, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - -1, -1, -1, -1, -1, 38, -1, -1, -1, 42, - -1, -1, 45, -1, 1, 48, -1, 50, 5, 6, - 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, - 27, 28, -1, -1, 31, 32, -1, -1, -1, -1, - 37, -1, -1, -1, -1, 42, -1, -1, -1, 1, - -1, -1, 49, 5, 6, 7, 8, 9, 10, 11, - -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, -1, 24, 25, 26, 27, 28, -1, -1, 31, - 32, -1, -1, -1, -1, 37, -1, -1, -1, -1, - 42, -1, -1, -1, 1, -1, -1, 49, 5, 6, - 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, - 27, 28, -1, -1, 31, 32, -1, -1, -1, -1, - 37, -1, -1, -1, -1, 42, -1, -1, -1, -1, - -1, -1, 49, 5, 6, 7, 8, 9, 10, 11, - -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, -1, 24, 25, 26, 27, 28, -1, -1, 31, + 60, 60, 81, 3, 1, 8, 26, 39, 66, 88, + 57, 38, 38, 1, 38, 18, 38, 38, 1, 0, + 31, 42, 46, 30, 27, 52, 33, 48, 31, 50, + 52, 78, 53, 112, 54, 114, 94, 34, 58, 65, + 51, 38, 48, 103, 70, 42, 23, 38, 127, 128, + 38, 48, 49, 50, 42, 38, 88, 57, 34, 42, + 48, 52, 50, 154, 48, 48, 34, 50, 34, 38, + 45, 162, 48, 42, 112, 38, 114, 156, 78, 48, + 48, 50, 48, 38, 45, 46, 38, 42, 46, 47, + 42, 45, 46, 48, 154, 50, 48, 38, 50, 127, + 128, 52, 162, 52, 47, 45, 51, 46, 35, 1, + 35, 171, 171, 5, 6, 7, 8, 9, 10, 11, + 49, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 49, 24, 25, 26, 27, 28, 49, 49, 31, + 32, 45, 47, 53, 45, 30, 38, 45, 37, 49, + 42, 47, 49, 45, 46, 49, 48, 31, 50, 1, + 35, 53, 49, 5, 6, 7, 8, 9, 10, 11, + 49, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 49, 24, 25, 26, 27, 28, 49, 49, 31, + 32, 49, 49, 1, 97, 83, 38, 156, 115, 50, + 42, 110, -1, 45, 46, -1, 48, 106, 50, 1, + -1, 53, -1, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1, 38, -1, -1, -1, - 42, -1, -1, -1, -1, -1, 48, -1, 50, 5, + 42, -1, -1, 45, -1, 1, 48, -1, 50, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, 27, 28, -1, -1, 31, 32, -1, -1, -1, - -1, 37, -1, -1, -1, -1, 42, 5, 6, 7, - 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, 25, 26, 27, - 28, -1, -1, 31, 32, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 42 + -1, 37, -1, -1, -1, -1, 42, -1, -1, -1, + 1, -1, -1, 49, 5, 6, 7, 8, 9, 10, + 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, 25, 26, 27, 28, -1, -1, + 31, 32, -1, -1, -1, -1, 37, -1, -1, -1, + -1, 42, -1, -1, -1, 1, -1, -1, 49, 5, + 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -1, 24, 25, + 26, 27, 28, -1, -1, 31, 32, -1, -1, -1, + -1, 37, -1, -1, -1, -1, 42, -1, -1, -1, + -1, -1, -1, 49, 5, 6, 7, 8, 9, 10, + 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, 25, 26, 27, 28, -1, -1, + 31, 32, -1, -1, -1, -1, -1, 38, -1, -1, + -1, 42, -1, -1, -1, -1, -1, 48, -1, 50, + 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, + 25, 26, 27, 28, -1, -1, 31, 32, -1, -1, + -1, -1, 37, -1, -1, -1, -1, 42, 5, 6, + 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, + 27, 28, -1, -1, 31, 32, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 42 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -853,19 +866,19 @@ static const yytype_uint8 yystos[] = 28, 29, 30, 31, 32, 42, 58, 61, 65, 66, 67, 68, 69, 70, 74, 85, 100, 102, 45, 46, 38, 52, 97, 23, 38, 52, 88, 60, 38, 88, - 48, 48, 45, 38, 48, 50, 62, 63, 64, 71, - 75, 76, 67, 97, 38, 98, 99, 59, 88, 1, - 65, 89, 90, 91, 61, 65, 88, 66, 82, 38, - 1, 75, 72, 73, 74, 45, 47, 75, 30, 33, - 101, 34, 48, 51, 46, 47, 61, 45, 46, 38, - 42, 48, 53, 71, 77, 78, 92, 93, 94, 95, - 46, 1, 91, 75, 38, 42, 48, 71, 83, 84, - 49, 49, 49, 49, 74, 64, 96, 1, 79, 80, - 81, 82, 35, 46, 99, 95, 1, 38, 77, 35, - 77, 96, 34, 48, 45, 47, 1, 42, 83, 83, - 34, 48, 45, 31, 51, 86, 87, 49, 49, 37, - 47, 49, 49, 1, 79, 94, 49, 49, 1, 79, - 35, 37, 82, 49, 49, 49, 49 + 48, 48, 45, 38, 42, 48, 50, 62, 63, 64, + 71, 75, 76, 67, 97, 38, 98, 99, 59, 88, + 1, 65, 89, 90, 91, 61, 65, 88, 66, 82, + 38, 1, 75, 72, 73, 74, 45, 47, 75, 30, + 33, 101, 34, 48, 51, 46, 47, 61, 45, 46, + 38, 42, 48, 53, 71, 77, 78, 92, 93, 94, + 95, 46, 1, 91, 75, 38, 42, 48, 71, 83, + 84, 49, 49, 49, 49, 74, 64, 96, 1, 79, + 80, 81, 82, 35, 46, 99, 95, 1, 38, 77, + 35, 77, 96, 34, 48, 45, 47, 1, 42, 83, + 83, 34, 48, 45, 31, 51, 86, 87, 49, 49, + 37, 47, 49, 49, 1, 79, 94, 49, 49, 1, + 79, 35, 37, 82, 49, 49, 49, 49 }; #define yyerrok (yyerrstatus = 0) @@ -912,46 +925,18 @@ do \ } \ while (YYID (0)) - +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#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 (YYLEX_PARAM) #else @@ -1014,7 +999,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) switch (yytype) { default: - break; + break; } } @@ -1256,7 +1241,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULL; @@ -1319,11 +1303,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1343,10 +1329,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1406,32 +1394,27 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; + +#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; +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1489,7 +1472,7 @@ yyparse () int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1507,9 +1490,8 @@ yyparse () Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1518,14 +1500,6 @@ yyparse () yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1666,7 +1640,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1916,7 +1892,14 @@ yyreduce: case 69: - { (yyval) = (yyvsp[(4) - (4)]); } + { if (current_name != NULL) { + error_with_pos("unexpected second declaration name"); + YYERROR; + } else { + current_name = (*(yyvsp[(1) - (1)]))->string; + (yyval) = (yyvsp[(1) - (1)]); + } + } break; case 70: @@ -1926,12 +1909,12 @@ yyreduce: case 71: - { (yyval) = (yyvsp[(2) - (2)]); } + { (yyval) = (yyvsp[(4) - (4)]); } break; case 72: - { (yyval) = (yyvsp[(3) - (3)]); } + { (yyval) = (yyvsp[(2) - (2)]); } break; case 73: @@ -1941,12 +1924,12 @@ yyreduce: case 74: - { (yyval) = (yyvsp[(2) - (2)]); } + { (yyval) = (yyvsp[(3) - (3)]); } break; - case 78: + case 75: - { (yyval) = (yyvsp[(4) - (4)]); } + { (yyval) = (yyvsp[(2) - (2)]); } break; case 79: @@ -1956,12 +1939,12 @@ yyreduce: case 80: - { (yyval) = (yyvsp[(2) - (2)]); } + { (yyval) = (yyvsp[(4) - (4)]); } break; case 81: - { (yyval) = (yyvsp[(3) - (3)]); } + { (yyval) = (yyvsp[(2) - (2)]); } break; case 82: @@ -1971,40 +1954,45 @@ yyreduce: case 83: + { (yyval) = (yyvsp[(3) - (3)]); } + break; + + case 84: + { (yyval) = (yyvsp[(2) - (2)]); } break; - case 85: + case 86: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 86: + case 87: { (yyval) = NULL; } break; - case 89: + case 90: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 90: + case 91: { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); } break; - case 91: + case 92: { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); } break; - case 93: + case 94: { (yyval) = NULL; } break; - case 94: + case 95: { /* For version 2 checksums, we don't want to remember private parameter names. */ @@ -2013,39 +2001,39 @@ yyreduce: } break; - case 95: + case 96: { remove_node((yyvsp[(1) - (1)])); (yyval) = (yyvsp[(1) - (1)]); } break; - case 96: + case 97: { (yyval) = (yyvsp[(4) - (4)]); } break; - case 97: + case 98: { (yyval) = (yyvsp[(4) - (4)]); } break; - case 98: + case 99: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 99: + case 100: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 100: + case 101: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 101: + case 102: { struct string_list *decl = *(yyvsp[(2) - (3)]); *(yyvsp[(2) - (3)]) = NULL; @@ -2054,87 +2042,87 @@ yyreduce: } break; - case 102: + case 103: { (yyval) = NULL; } break; - case 104: + case 105: { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); } break; - case 105: + case 106: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 106: + case 107: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 107: + case 108: { (yyval) = NULL; } break; - case 110: + case 111: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 111: + case 112: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 112: + case 113: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 113: + case 114: { (yyval) = NULL; } break; - case 116: + case 117: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 117: + case 118: { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); } break; - case 118: + case 119: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 120: + case 121: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 121: + case 122: { (yyval) = NULL; } break; - case 123: + case 124: { (yyval) = (yyvsp[(3) - (3)]); } break; - case 124: + case 125: { (yyval) = (yyvsp[(4) - (4)]); } break; - case 127: + case 128: { const char *name = strdup((*(yyvsp[(1) - (1)]))->string); @@ -2142,7 +2130,7 @@ yyreduce: } break; - case 128: + case 129: { const char *name = strdup((*(yyvsp[(1) - (3)]))->string); @@ -2151,17 +2139,17 @@ yyreduce: } break; - case 129: + case 130: { (yyval) = (yyvsp[(2) - (2)]); } break; - case 130: + case 131: { (yyval) = NULL; } break; - case 132: + case 133: { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); } break; @@ -2330,7 +2318,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2404,4 +2394,3 @@ yyerror(const char *e) { error_with_pos("%s", e); } - diff --git a/scripts/genksyms/parse.tab.h_shipped b/scripts/genksyms/parse.tab.h_shipped index a4737dec4532..4c00cef6d71d 100644 --- a/scripts/genksyms/parse.tab.h_shipped +++ b/scripts/genksyms/parse.tab.h_shipped @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 2.5.1. */ +/* A Bison parser, made by GNU Bison 2.7. */ /* Bison interface for Yacc-like parsers in C @@ -30,6 +30,15 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED +# define YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int yydebug; +#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -83,7 +92,6 @@ #endif - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 @@ -93,4 +101,18 @@ typedef int YYSTYPE; extern YYSTYPE yylval; +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ +#endif /* !YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED */ -- cgit v1.2.3-59-g8ed1b From d721109611fb94aff53c2397859046e5f92f55ae Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 24 Jul 2015 14:18:45 +0900 Subject: kbuild: fixdep: optimize code slightly If the target string matches "CONFIG_", move the pointer p forward. This saves several 7-chars adjustments. Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/basic/fixdep.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index b30406860b73..46cc1b3e5de2 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -251,7 +251,8 @@ static void parse_config_file(const char *map, size_t len) continue; if (memcmp(p, "CONFIG_", 7)) continue; - for (q = p + 7; q < map + len; q++) { + p += 7; + for (q = p; q < map + len; q++) { if (!(isalnum(*q) || *q == '_')) goto found; } @@ -260,9 +261,9 @@ static void parse_config_file(const char *map, size_t len) found: if (!memcmp(q - 7, "_MODULE", 7)) q -= 7; - if( (q-p-7) < 0 ) + if (q - p < 0) continue; - use_config(p+7, q-p-7); + use_config(p, q - p); } } -- cgit v1.2.3-59-g8ed1b From d179e22762fd38414c4108acedd5feca4cf7e0d8 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 24 Jul 2015 14:18:46 +0900 Subject: kbuild: fixdep: drop meaningless hash table initialization The clear_config() is called just once at the beginning of this program, but the global variable hashtab[] is already zero-filled at the start-up. Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/basic/fixdep.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'scripts') diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 46cc1b3e5de2..c68fd61fdc42 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -191,23 +191,6 @@ static void define_config(const char *name, int len, unsigned int hash) hashtab[hash % HASHSZ] = aux; } -/* - * Clear the set of configuration strings. - */ -static void clear_config(void) -{ - struct item *aux, *next; - unsigned int i; - - for (i = 0; i < HASHSZ; i++) { - for (aux = hashtab[i]; aux; aux = next) { - next = aux->next; - free(aux); - } - hashtab[i] = NULL; - } -} - /* * Record the use of a CONFIG_* word. */ @@ -325,8 +308,6 @@ static void parse_dep_file(void *map, size_t len) int saw_any_target = 0; int is_first_dep = 0; - clear_config(); - while (m < end) { /* Skip any "white space" */ while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) -- cgit v1.2.3-59-g8ed1b From 5631d9c429857194bd55d7bcd8fa5bdd1a9899a3 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Wed, 19 Aug 2015 17:36:41 +0200 Subject: kbuild: Fix clang detection We cannot detect clang before including the arch Makefile, because that can set the default cross compiler. We also cannot detect clang after including the arch Makefile, because powerpc wants to know about clang. Solve this by using an deferred variable. This costs us a few shell invocations, but this is only a constant number. Reported-by: Behan Webster Reported-by: Anton Blanchard Signed-off-by: Michal Marek --- Makefile | 9 +-------- arch/powerpc/Makefile | 8 ++++---- scripts/Kbuild.include | 4 ++++ scripts/Makefile.extrawarn | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/Makefile b/Makefile index 13270c0a9336..5ccbb58553ab 100644 --- a/Makefile +++ b/Makefile @@ -661,14 +661,7 @@ endif endif KBUILD_CFLAGS += $(stackp-flag) -ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) -COMPILER := clang -else -COMPILER := gcc -endif -export COMPILER - -ifeq ($(COMPILER),clang) +ifeq ($(cc-name),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,) KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 05f464eb6952..dfe88896b06c 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -67,7 +67,7 @@ UTS_MACHINE := $(OLDARCH) ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) override CC += -mlittle-endian -ifneq ($(COMPILER),clang) +ifneq ($(cc-name),clang) override CC += -mno-strict-align endif override AS += -mlittle-endian @@ -333,7 +333,7 @@ TOUT := .tmp_gas_check # - Require gcc 4.0 or above on 64-bit # - gcc-4.2.0 has issues compiling modules on 64-bit checkbin: - @if test "${COMPILER}" != "clang" \ + @if test "$(cc-name)" != "clang" \ && test "$(cc-version)" = "0304" ; then \ if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ @@ -342,14 +342,14 @@ checkbin: false; \ fi ; \ fi - @if test "${COMPILER}" != "clang" \ + @if test "$(cc-name)" != "clang" \ && test "$(cc-version)" -lt "0400" \ && test "x${CONFIG_PPC64}" = "xy" ; then \ echo -n "Sorry, GCC v4.0 or above is required to build " ; \ echo "the 64-bit powerpc kernel." ; \ false ; \ fi - @if test "${COMPILER}" != "clang" \ + @if test "$(cc-name)" != "clang" \ && test "$(cc-fullversion)" = "040200" \ && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \ echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d3437b82ac25..3523df613391 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -128,6 +128,10 @@ cc-option-align = $(subst -functions=0,,\ cc-disable-warning = $(call try-run,\ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) +# cc-name +# Expands to either gcc or clang +cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) + # cc-version cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index f734033af219..4efedcbe4165 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -56,7 +56,7 @@ endif KBUILD_CFLAGS += $(warning) else -ifeq ($(COMPILER),clang) +ifeq ($(cc-name),clang) KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) KBUILD_CFLAGS += $(call cc-disable-warning, format) -- cgit v1.2.3-59-g8ed1b