From 911537c30f91d1104775dd61d409039252a0ce75 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 11 Dec 2012 11:39:51 +0100 Subject: [PATCH 1/8] gnulib: update --- gnulib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnulib b/gnulib index c457e702..4a8c422f 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit c457e702babb79026dd57036e0652e141f58f72d +Subproject commit 4a8c422f3139a9b4fb2c7ffae5aef3bea28bdc65 From fc28638e1c4ef0c41ad52b832b547305ea8c1784 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 12 Dec 2012 11:28:24 +0100 Subject: [PATCH 2/8] glr.c: scope reduction * data/glr.c (yyreportSyntaxError): Reduce the scope of yysize1 (now yysz). --- data/glr.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/data/glr.c b/data/glr.c index cdefd507..e55a2df3 100644 --- a/data/glr.c +++ b/data/glr.c @@ -2016,7 +2016,6 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken)); size_t yysize = yysize0; - size_t yysize1; yybool yysize_overflow = yyfalse; char* yymsg = YY_NULL; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; @@ -2076,9 +2075,11 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) break; } yyarg[yycount++] = yytokenName (yyx); - yysize1 = yysize + yytnamerr (YY_NULL, yytokenName (yyx)); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; + { + size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx)); + yysize_overflow |= yysz < yysize; + yysize = yysz; + } } } } @@ -2098,9 +2099,11 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) #undef YYCASE_ } - yysize1 = yysize + strlen (yyformat); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; + { + size_t yysz = yysize + strlen (yyformat); + yysize_overflow |= yysz < yysize; + yysize = yysz; + } if (!yysize_overflow) yymsg = (char *) YYMALLOC (yysize); From 1127a75a72dd15611a11c372222a629e89cfb832 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 12 Dec 2012 11:37:02 +0100 Subject: [PATCH 3/8] fix C90 compliance * data/glr.c, src/graphviz.h, src/ielr.c, src/scan-gram.l, * src/system.h, tests/actions.at, tests/glr-regression.at: Do not use // comments. Do not introduce variables after statements. Provide "main" with a return value. --- NEWS | 2 ++ data/glr.c | 4 +++- src/graphviz.h | 52 ++++++++++++++++++++++++----------------- src/ielr.c | 8 +++---- src/scan-gram.l | 2 +- src/system.h | 2 +- tests/actions.at | 5 ++-- tests/glr-regression.at | 6 +++-- 8 files changed, 49 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index d16ac50b..1c33b045 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ GNU Bison NEWS Warnings about uninitialized yylloc in yyparse have been fixed. + Restored C90 compliance (yet no report was ever made). + ** Diagnostics are improved *** Changes in the format of error messages diff --git a/data/glr.c b/data/glr.c index e55a2df3..02a76c21 100644 --- a/data/glr.c +++ b/data/glr.c @@ -287,7 +287,7 @@ b4_percent_code_get[]dnl # include # define YYJMP_BUF jmp_buf # define YYSETJMP(Env) setjmp (Env) -// Pacify clang. +/* Pacify clang. */ # define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0)) #endif @@ -2013,6 +2013,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) #if ! YYERROR_VERBOSE yyerror (]b4_lyyerror_args[YY_("syntax error")); #else + { yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken)); size_t yysize = yysize0; @@ -2133,6 +2134,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yyerror (]b4_lyyerror_args[YY_("syntax error")); yyMemoryExhausted (yystackp); } + } #endif /* YYERROR_VERBOSE */ yynerrs += 1; } diff --git a/src/graphviz.h b/src/graphviz.h index 371b15c5..239cdd21 100644 --- a/src/graphviz.h +++ b/src/graphviz.h @@ -24,38 +24,48 @@ #include "state.h" -/// Begin a Dot graph. -/// \param fout output stream. +/** Begin a Dot graph. + * + * \param fout output stream. + */ void start_graph (FILE *fout); -/// Output a Dot node. -/// \param id identifier of the node -/// \param label human readable label of the node (no Dot escaping needed). -/// \param fout output stream. +/** Output a Dot node. + * + * \param id identifier of the node + * \param label human readable label of the node (no Dot escaping needed). + * \param fout output stream. + */ void output_node (int id, char const *label, FILE *fout); -/// Output a Dot edge. -/// \param source id of the source node -/// \param destination id of the target node -/// \param label human readable label of the edge -/// (no Dot escaping needed). Can be 0. -/// \param style Dot style of the edge (e.g., "dotted" or "solid"). -/// \param fout output stream. +/** Output a Dot edge. + * \param source id of the source node + * \param destination id of the target node + * \param label human readable label of the edge + * (no Dot escaping needed). Can be 0. + * \param style Dot style of the edge (e.g., "dotted" or "solid"). + * \param fout output stream. + */ void output_edge (int source, int destination, char const *label, char const *style, FILE *fout); -/// Output a reduction. -/// \param s current state -/// \param reds the set of reductions -/// \param fout output stream. +/** Output a reduction. + * \param s current state + * \param reds the set of reductions + * \param fout output stream. + */ void output_red (state const *s, reductions const *reds, FILE *fout); -/// End a Dot graph. -/// \param fout output stream. +/** End a Dot graph. + * + * \param fout output stream. + */ void finish_graph (FILE *fout); -/// Escape a lookahead token. -/// \param name the token. +/** Escape a lookahead token. + * + * \param name the token. + */ char const *escape (char const *name); #endif /* ! GRAPHVIZ_H_ */ diff --git a/src/ielr.c b/src/ielr.c index cde2baaf..e6aa6f5c 100644 --- a/src/ielr.c +++ b/src/ielr.c @@ -758,8 +758,8 @@ ielr_compute_state (bitsetv follow_kernel_items, bitsetv always_follows, if (!bitset_empty_p (lookaheads[i])) break; } - // bitset_equal_p uses the size of the first argument, so - // lookaheads[i] must be the second argument. + /* bitset_equal_p uses the size of the first argument, + so lookaheads[i] must be the second argument. */ else if (!bitset_equal_p ((*this_isocorep)->lookaheads[i], lookaheads[i])) break; @@ -1187,8 +1187,8 @@ ielr (void) free (to_state); if (lr_type == LR_TYPE__CANONICAL_LR) { - // Reduction lookaheads are computed in ielr_split_states above but are - // timed as part of phase 4. + /* Reduction lookaheads are computed in ielr_split_states above + but are timed as part of phase 4. */ set_goto_map (); } else diff --git a/src/scan-gram.l b/src/scan-gram.l index 5e78cb9b..9083dce3 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -883,7 +883,7 @@ unexpected_end (boundary start, char const *msgid, char const *token_end) loc.start = start; loc.end = scanner_cursor; token_end = quote (token_end); - // Instead of '\'', display "'". + /* Instead of '\'', display "'". */ if (!strcmp (token_end, "'\\''")) token_end = "\"'\""; complain_at (loc, _(msgid), token_end); diff --git a/src/system.h b/src/system.h index 3a82e7f3..35ff8764 100644 --- a/src/system.h +++ b/src/system.h @@ -51,7 +51,7 @@ typedef size_t uintptr_t; # endif -// Version mismatch. +/* Version mismatch. */ # define EX_MISMATCH 63 /*---------. diff --git a/tests/actions.at b/tests/actions.at index 17d9193f..97c08c29 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -90,7 +90,7 @@ AT_DATA_GRAMMAR([[input.y]], %code { # include -# include // getenv +# include /* getenv */ ]AT_YYERROR_DECLARE[ ]AT_YYLEX_DECLARE[ } @@ -195,7 +195,7 @@ AT_DATA_GRAMMAR([[input.y]], %code { # include -# include // getenv +# include /* getenv */ ]AT_YYERROR_DECLARE[ ]AT_YYLEX_DECLARE[ } @@ -223,6 +223,7 @@ main (void) TEST(7, 2, 0, 2); TEST(8, 0, 8, 0); + return 0; } ]]) diff --git a/tests/glr-regression.at b/tests/glr-regression.at index 088ad86a..e08904b6 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -195,10 +195,11 @@ yylex (void) int main (int argc, char **argv) { + int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; - int res = yyparse (); + res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; @@ -327,10 +328,11 @@ int yylex (void) int main(int argc, char* argv[]) { + int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; - int res = yyparse (); + res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; From bb990d38090ac6ccb74c4b6a82fb9d9d7aa157db Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 12 Dec 2012 12:38:28 +0100 Subject: [PATCH 4/8] tests: C90 compliance * tests/synclines.at: here. --- tests/synclines.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/synclines.at b/tests/synclines.at index 2fc74fe0..6b847195 100644 --- a/tests/synclines.at +++ b/tests/synclines.at @@ -127,7 +127,7 @@ AT_BISON_OPTION_PUSHDEFS AT_DATA([syncline.c], [[#error "1" -int i; // avoids -pedantic warning about an empty translation unit +int i; /* avoids -pedantic warning about an empty translation unit. */ ]]) AT_SYNCLINES_COMPILE([syncline.c]) From 4b6d641913866dd5e77d24bb9a3c1b79140981b4 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 12 Dec 2012 12:38:43 +0100 Subject: [PATCH 5/8] yacc.c: scope reduction * data/yacc.c (yysyntax_error): here. --- data/yacc.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/data/yacc.c b/data/yacc.c index 810e2b21..b34549f1 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -1247,7 +1247,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; @@ -1328,11 +1327,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; + } } }]b4_lac_if([[ # if ]b4_api_PREFIX[DEBUG @@ -1356,10 +1357,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) { From c13bb3484c452b97e3cdab04c3aeb501494a0e21 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 12 Dec 2012 16:07:46 +0100 Subject: [PATCH 6/8] version 2.7 * NEWS: Record release date. --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1c33b045..f3744022 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ GNU Bison NEWS -* Noteworthy changes in release ?.? (????-??-??) [?] +* Noteworthy changes in release 2.7 (2012-12-12) [stable] ** Bug fixes From 0a7b855930312a1e2d86227609d743352d860bd3 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 12 Dec 2012 16:23:44 +0100 Subject: [PATCH 7/8] maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. --- .prev-version | 2 +- NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.prev-version b/.prev-version index 7d99c602..1effb003 100644 --- a/.prev-version +++ b/.prev-version @@ -1 +1 @@ -2.6.90 +2.7 diff --git a/NEWS b/NEWS index f3744022..12242e18 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ GNU Bison NEWS +* Noteworthy changes in release ?.? (????-??-??) [?] + + * Noteworthy changes in release 2.7 (2012-12-12) [stable] ** Bug fixes From 2bd435c36c0dfdefb07cef05dec851ec75bab20b Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 13 Dec 2012 09:25:34 +0100 Subject: [PATCH 8/8] maint: credit Wojciech Polak * NEWS, THANKS: He is the author of XML support (including XSLTs). --- NEWS | 3 +++ THANKS | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 12242e18..8da9cf9f 100644 --- a/NEWS +++ b/NEWS @@ -508,6 +508,7 @@ GNU Bison NEWS These features are experimental in this version. More user feedback will help to stabilize them. + Contributed by Alex Rozenman. ** IELR(1) and canonical LR(1): @@ -1024,6 +1025,7 @@ GNU Bison NEWS The current Java interface is experimental and may evolve. More user feedback will help to stabilize it. + Contributed by Paolo Bonzini. ** %language @@ -1037,6 +1039,7 @@ GNU Bison NEWS Bison can now generate an XML report of the LALR(1) automaton using the new "--xml" option. The current XML schema is experimental and may evolve. More user feedback will help to stabilize it. + Contributed by Wojciech Polak. ** The grammar file may now specify the name of the parser header file using %defines. For example: diff --git a/THANKS b/THANKS index 9a64012c..ed978d37 100644 --- a/THANKS +++ b/THANKS @@ -125,6 +125,7 @@ Vin Shelton acs@alumni.princeton.edu W.C.A. Wijngaards wouter@NLnetLabs.nl Wayne Green wayne@infosavvy.com Wei Song wsong83@gmail.com +Wojciech Polak polak@gnu.org Wolfgang S. Kechel wolfgang.kechel@prs.de Wolfram Wagner ww@mpi-sb.mpg.de Wwp subscript@free.fr