From: Paul Eggert Date: Fri, 20 Jan 2006 00:08:30 +0000 (+0000) Subject: Minor fixups to get 'make maintainer-check' to work. X-Git-Tag: v2.3b~488 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/c66dfaddf449920bea03c0aa3b55467e2f21c98e?hp=ed94ef2ae40371bc1d1886915183daa6e36a177a Minor fixups to get 'make maintainer-check' to work. * configure.ac: Don't use -Wnested-externs, as it's incompatible with the new verify.h implementation. * data/c.m4 (b4_yy_symbol_print_generate): YYUSE (yyoutput). * data/glr.c (YYUSE): Depend on __GNUC__ as well. * data/yacc.c (YYUSE): Likewise. * data/lalr1.cc (yysyntax_error_): YYUSE (yystate). * lib/subpipe.c (end_of_output_subpipe): The args are unused. * src/parse-gram.y (declaration): Don't pass a string constant to a function that expects char *, since GCC might complain about the constant value. * src/reader.c (symbol_typed_p): Add parens to pacify GCC. * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): #undef yylloc and yylval before #defining them. * tests/glr-regression.at (Incorrectly initialized location for empty right-hand side in GLR): In yyerror, use the msg arg. (Corrupted semantic options if user action cuts parse): (Incorrect lookahead during deterministic GLR): (Incorrect lookahead during nondeterministic GLR): Don't name a local var 'index'; it shadows string.h's 'index'. --- diff --git a/ChangeLog b/ChangeLog index b618ee0a..d0160ed6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2006-01-19 Paul Eggert + + Minor fixups to get 'make maintainer-check' to work. + * configure.ac: Don't use -Wnested-externs, as it's incompatible + with the new verify.h implementation. + * data/c.m4 (b4_yy_symbol_print_generate): YYUSE (yyoutput). + * data/glr.c (YYUSE): Depend on __GNUC__ as well. + * data/yacc.c (YYUSE): Likewise. + * data/lalr1.cc (yysyntax_error_): YYUSE (yystate). + * lib/subpipe.c (end_of_output_subpipe): The args are unused. + * src/parse-gram.y (declaration): Don't pass a string constant + to a function that expects char *, since GCC might complain + about the constant value. + * src/reader.c (symbol_typed_p): Add parens to pacify GCC. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): #undef yylloc and yylval + before #defining them. + * tests/glr-regression.at + (Incorrectly initialized location for empty right-hand side in GLR): + In yyerror, use the msg arg. + (Corrupted semantic options if user action cuts parse): + (Incorrect lookahead during deterministic GLR): + (Incorrect lookahead during nondeterministic GLR): + Don't name a local var 'index'; it shadows string.h's 'index'. + 2006-01-19 Akim Demaille * tests/calc.at (_AT_DATA_CALC_Y): Initialize the whole initial diff --git a/configure.ac b/configure.ac index 36f55948..c051ccbc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ # Configure template for GNU Bison. -*-Autoconf-*- # -# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 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 @@ -58,7 +59,6 @@ if test "${enableval}" = yes; then BISON_WARNING(-Wbad-function-cast) BISON_WARNING(-Wmissing-declarations) BISON_WARNING(-Wmissing-prototypes) - BISON_WARNING(-Wnested-externs) BISON_WARNING(-Wshadow) BISON_WARNING(-Wstrict-prototypes) AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.]) diff --git a/data/c.m4 b/data/c.m4 index 630fdebd..6406b9b0 100644 --- a/data/c.m4 +++ b/data/c.m4 @@ -472,6 +472,8 @@ b4_parse_param_use[]dnl [# ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); # endif switch (yytype) { diff --git a/data/glr.c b/data/glr.c index 44822a96..daa46279 100644 --- a/data/glr.c +++ b/data/glr.c @@ -253,7 +253,7 @@ b4_syncline([@oline@], [@ofile@]) #endif /* Suppress unused-variable warnings by "using" E. */ -#ifndef lint +#if !defined (lint) || defined (__GNUC__) # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ @@ -1103,7 +1103,7 @@ yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState) /** Add a new semantic action that will execute the action for rule * RULENUM on the semantic values in RHS to the list of - * alternative actions for STATE. Assumes that RHS comes from + * alternative actions for STATE. Assumes that RHS comes from * stack #K of *STACKP. */ static void yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, @@ -1536,7 +1536,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk) yybool* yynewLookaheadNeeds; yynewStates = NULL; - + if (yystackp->yytops.yycapacity > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) yyMemoryExhausted (yystackp); diff --git a/data/lalr1.cc b/data/lalr1.cc index e27cce48..491a4617 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -829,6 +829,7 @@ b4_error_verbose_if([, yytoken])[)); b4_error_verbose_if([, int tok])[) { std::string res; + YYUSE (yystate); #if YYERROR_VERBOSE int yyn = yypact_[yystate]; if (yypact_ninf_ < yyn && yyn < yylast_) diff --git a/data/yacc.c b/data/yacc.c index cde630e3..ecdcda99 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -248,7 +248,7 @@ b4_syncline([@oline@], [@ofile@])[ #endif /* Suppress unused-variable warnings by "using" E. */ -#ifndef lint +#if !defined (lint) || defined (__GNUC__) # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ diff --git a/lib/subpipe.c b/lib/subpipe.c index 4eee4a0f..36e66600 100644 --- a/lib/subpipe.c +++ b/lib/subpipe.c @@ -1,6 +1,6 @@ /* Subprocesses with pipes. - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006 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 @@ -71,6 +71,18 @@ #include "gettext.h" #define _(Msgid) gettext (Msgid) +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if !defined (__GNUC__) || __GNUC__ < 2 || \ +(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# define __attribute__(Spec) /* empty */ +# endif +#endif + +#ifndef ATTRIBUTE_UNUSED +# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#endif + /* Initialize this module. */ @@ -168,6 +180,7 @@ reap_subpipe (pid_t pid, char const *program) } void -end_of_output_subpipe (pid_t pid, int fd[2]) +end_of_output_subpipe (pid_t pid ATTRIBUTE_UNUSED, + int fd[2] ATTRIBUTE_UNUSED) { } diff --git a/src/parse-gram.y b/src/parse-gram.y index 4a31f014..f4587351 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -206,7 +206,11 @@ declaration: grammar_declaration | PROLOGUE { prologue_augment ($1, @1); } | "%debug" { debug_flag = true; } -| "%define" string_content { muscle_insert ($2, "1"); } +| "%define" string_content + { + static char one[] = "1"; + muscle_insert ($2, one); + } | "%define" string_content string_content { muscle_insert ($2, $3); } | "%defines" { defines_flag = true; } | "%error-verbose" { error_verbose = true; } @@ -214,14 +218,14 @@ declaration: | "%expect-rr" INT { expected_rr_conflicts = $2; } | "%file-prefix" "=" string_content { spec_file_prefix = $3; } | "%glr-parser" - { - nondeterministic_parser = true; - glr_parser = true; - } + { + nondeterministic_parser = true; + glr_parser = true; + } | "%initial-action {...}" - { - muscle_code_grow ("initial_action", $1, @1); - } + { + muscle_code_grow ("initial_action", $1, @1); + } | "%lex-param {...}" { add_param ("lex_param", $1, @1); } | "%locations" { locations_flag = true; } | "%name-prefix" "=" string_content { spec_name_prefix = $3; } diff --git a/src/reader.c b/src/reader.c index 101cd944..0744b3f2 100644 --- a/src/reader.c +++ b/src/reader.c @@ -221,7 +221,7 @@ static bool symbol_typed_p (const symbol_list *s) { return (s->sym->type_name - || s->midrule && s->midrule->used); + || (s->midrule && s->midrule->used)); } /*----------------------------------------------------------------. diff --git a/tests/cxx-type.at b/tests/cxx-type.at index 71c71066..c22c44a8 100644 --- a/tests/cxx-type.at +++ b/tests/cxx-type.at @@ -155,7 +155,9 @@ yylex (LEX_PARAMETERS) static int colNum = 0; #if YYPURE +# undef yylloc # define yylloc (*llocp) +# undef yylval # define yylval (*lvalp) #endif diff --git a/tests/glr-regression.at b/tests/glr-regression.at index 3e6d0351..536f5eb8 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -240,7 +240,7 @@ AT_DATA_GRAMMAR([glr-regr3.y], #include static int MergeRule (int x0, int x1); -static void yyerror(char const * s); +static void yyerror (char const * s); int yylex (void); #define RULE(x) (1 << (x)) @@ -650,7 +650,7 @@ AT_DATA_GRAMMAR([glr-regr8.y], #include static void yyerror (char const *); static int yylex (void); - static void yyerror(const char *msg); + static void yyerror (char const *msg); %} %token T_CONSTANT @@ -684,9 +684,10 @@ OptSignalWord : /* empty */ %% -void yyerror(const char *msg) +void +yyerror (char const *msg) { - fprintf (stderr, "error\n"); + fprintf (stderr, "%s\n", msg); } static int lexIndex; @@ -856,9 +857,9 @@ yylex (void) int main (void) { - int index; - for (index = 0; index < GARBAGE_SIZE; index+=1) - garbage[index] = 108; + int i; + for (i = 0; i < GARBAGE_SIZE; i+=1) + garbage[i] = 108; return yyparse (); } ]]) @@ -1087,11 +1088,11 @@ static int yylex (void) { static char const *input = "ab"; - static int index = 0; + static int i = 0; yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = index+1; - yylval.value = input[index] + 'A' - 'a'; - return input[index++]; + yylloc.first_column = yylloc.last_column = i + 1; + yylval.value = input[i] + 'A' - 'a'; + return input[i++]; } static void @@ -1293,11 +1294,11 @@ static int yylex (void) { static char const *input = "abcdddd"; - static int index = 0; + static int i = 0; yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = index+1; - yylval.value = input[index] + 'A' - 'a'; - return input[index++]; + yylloc.first_column = yylloc.last_column = i + 1; + yylval.value = input[i] + 'A' - 'a'; + return input[i++]; } static void