]> git.saurik.com Git - bison.git/commitdiff
Merge branch 'maint'
authorAkim Demaille <akim@lrde.epita.fr>
Fri, 3 Aug 2012 08:52:55 +0000 (10:52 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Fri, 3 Aug 2012 09:04:29 +0000 (11:04 +0200)
* origin/maint:
  maint: post-release administrivia
  version 2.6.2
  NEWS: update.
  yacc: remove trailing end of line at end of file
  thanks: fix a contributor name
  gnulib: update
  tests: synch line -> syncline, for consistency
  tests: synclines: style changes
  tests: synclines: fix perl invocation
  regen
  c++: trailing end-of-lines in %parse-param
  tests: simplify

Conflicts:
cfg.mk
data/glr.cc
data/yacc.c
src/parse-gram.c
src/parse-gram.h
src/parse-gram.y

12 files changed:
.prev-version
NEWS
THANKS
cfg.mk
data/glr.c
data/glr.cc
data/yacc.c
gnulib
src/parse-gram.y
tests/calc.at
tests/regression.at
tests/synclines.at

index 6a6a3d8e35c7a98eaeb47d4212cc13d1d8938003..097a15a2af39df14efb57a9212fc648b52746783 100644 (file)
@@ -1 +1 @@
-2.6.1
+2.6.2
diff --git a/NEWS b/NEWS
index 9fb03bb31c5d36b75f6662d46ac7b2e36b4823be..fd749368d50ebcfa12ffcb784fd99b2ee572b346 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -143,6 +143,22 @@ GNU Bison NEWS
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
 
+* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
+
+** Bug fixes
+
+  Buffer overruns, complaints from Flex, and portability issues in the test
+  suite have been fixed.
+
+** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
+
+  Trailing end-of-lines in %parse-param or %lex-param would result in
+  invalid C++.  This is fixed.
+
+** Spurious spaces and end-of-lines
+
+  The generated files no longer end (nor start) with empty lines.
+
 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
 
  Bison no longer executes user-specified M4 code when processing a grammar.
diff --git a/THANKS b/THANKS
index 5e76b1d16d497975817955bb92ce24fcb2129a26..4ed4256da8766c62c4690602783730a37f611e79 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -103,7 +103,7 @@ Sergei Steshenko          sergstesh@yahoo.com
 Shura                     debil_urod@ngs.ru
 Stefano Lattarini         stefano.lattarini@gmail.com
 Steve Murphy              murf@parsetree.com
-Summum Bonum              sum@geekhouse.org
+Sum Wu                    sum@geekhouse.org
 Thiru Ramakrishnan        thiru.ramakrishnan@gmail.com
 Tim Josling               tej@melbpc.org.au
 Tim Landscheidt           tim@tim-landscheidt.de
diff --git a/cfg.mk b/cfg.mk
index af1e09e8d94cedef4c9ff5a76fd2766ba6d2e20b..e50c6293ee60bc618b92b16eca4bbbe5f20dba0d 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -64,7 +64,6 @@ $(call exclude,                                                               \
   prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$     \
   prohibit_always-defined_macros+=?|^tests/regression.at$$             \
   prohibit_defined_have_decl_tests=?|^lib/timevar.c$$                  \
-  prohibit_empty_lines_at_EOF=^src/parse-gram.h$$                      \
   prohibit_magic_number_exit=^doc/bison.texi$$                         \
   prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$     \
   prohibit_strcmp=^doc/bison\.texi$$                                   \
index 8b3c34c91656c13595b79782dd66c15c4f0e40aa..7675ac337d5ede76228c7bd1bb0483c297f14c27 100644 (file)
@@ -2593,5 +2593,5 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
 ]b4_cpp_guard_open([b4_spec_defines_file])[
 ]b4_shared_declarations[
 ]b4_cpp_guard_close([b4_spec_defines_file])[
-]])])
+]])])dnl
 m4_divert_pop(0)
index dae2f62f4716dc0d1d7d833764a76f926508c436..69b328b66db4b575733ce6eb641c2061f937c789 100644 (file)
@@ -208,8 +208,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
 
 #endif
 ]m4_popdef([b4_parse_param])dnl
-b4_namespace_close[
-]])
+b4_namespace_close])
 
 
 # Let glr.c believe that the user arguments include the parser itself.
index 5b5b1bc4d008ee41cff74bb54976be6db8443183..da4e9e390fff1d6311eb430551d483bc9acde02a 100644 (file)
@@ -1933,7 +1933,6 @@ yypushreturn:]])[
 #endif
   return yyresult;
 }
-
 ]b4_epilogue[]dnl
 b4_defines_if(
 [@output(b4_spec_defines_file@)@
diff --git a/gnulib b/gnulib
index 678815ea7c4d95e04a0fa6d3b491b3c872c677a7..bd54a45e6e4bcb3ee7359c9b4f1d831a6291148f 160000 (submodule)
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 678815ea7c4d95e04a0fa6d3b491b3c872c677a7
+Subproject commit bd54a45e6e4bcb3ee7359c9b4f1d831a6291148f
index 518969948f0586a22d438f41606175240e32e19d..fbb9b54645addc40f365c052e552bd665023459e 100644 (file)
@@ -775,11 +775,13 @@ add_param (param_type type, char *decl, location loc)
 
     /* Strip the surrounding '{' and '}', and any blanks just inside
        the braces.  */
-    while (*--p == ' ' || *p == '\t')
-      continue;
+    --p;
+    while (isspace ((unsigned char) *p))
+      --p;
     p[1] = '\0';
-    while (*++decl == ' ' || *decl == '\t')
-      continue;
+    ++decl;
+    while (isspace ((unsigned char) *decl))
+      ++decl;
   }
 
   if (! name_start)
index 8d0fcb396c489530cabdd2d63999aa0d5fb5d0eb..89cc59eaf2ff9a38da745ea3ee191ebafe0ab3be 100644 (file)
@@ -386,11 +386,9 @@ AT_YYERROR_SEES_LOC_IF([
   fprintf (stderr, ": ");])
   fprintf (stderr, "%s\n", s);
 }])[
-
 ]AT_DEFINES_IF([],
 [AT_CALC_LEX
-AT_CALC_MAIN])[
-]])
+AT_CALC_MAIN])])
 
 AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])],
 [[#include "calc.h]AT_SKEL_CC_IF([[h]])["
@@ -500,6 +498,20 @@ AT_CHECK([cat stderr], 0, [expout])
 ])
 
 
+# AT_CHECK_SPACES([FILE])
+# -----------------------
+# Make sure we did not introduce bad spaces.  Checked here because all
+# the skeletons are (or should be) exercized here.
+m4_define([AT_CHECK_SPACES],
+[# No initial empty lines.
+AT_CHECK([sed -ne '/./q;=;p;' $1])
+# No trailing spaces.
+# FIXME: For 2.7: AT_CHECK([sed -ne '/[ ]$/{=;p;}' $1])
+# No final empty lines.
+AT_CHECK([sed -ne '${/^$/{=;p;};}' $1])
+])
+
+
 # AT_CHECK_CALC([BISON-OPTIONS])
 # ------------------------------
 # Start a testing chunk which compiles `calc' grammar with
@@ -514,6 +526,8 @@ AT_BISON_OPTION_PUSHDEFS([$1])
 
 AT_DATA_CALC_Y([$1])
 AT_FULL_COMPILE([calc], AT_DEFINES_IF([[lex], [main]]))
+AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([cc], [c])])
+AT_DEFINES_IF([AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([hh], [h])])])
 
 # Test the priorities.
 _AT_CHECK_CALC([$1],
index 58988c81f5876ca8de902ca4444d3a37c2e04d7f..cdc157246ed87e7a36c9254830d75f1778c21866 100644 (file)
@@ -908,7 +908,6 @@ m4_define([AT_CHECK_DANCER],
 [AT_SETUP([Dancer $1])
 AT_BISON_OPTION_PUSHDEFS([$1])
 _AT_DATA_DANCER_Y([$1])
-AT_BISON_CHECK([-o dancer.c dancer.y])
 AT_FULL_COMPILE([dancer])
 AT_PARSER_CHECK([./dancer], 1, [],
 [syntax error, unexpected ':'
@@ -993,7 +992,6 @@ m4_define([AT_CHECK_EXPECT2],
 [AT_SETUP([Expecting two tokens $1])
 AT_BISON_OPTION_PUSHDEFS([$1])
 _AT_DATA_EXPECT2_Y([$1])
-AT_BISON_CHECK([-o expect2.c expect2.y])
 AT_FULL_COMPILE([expect2])
 AT_PARSER_CHECK([./expect2], 1, [],
 [syntax error, unexpected '+', expecting A or B
@@ -1578,3 +1576,87 @@ Stack now 0
 m4_popdef([AT_LAC_CHECK])
 
 AT_CLEANUP
+
+
+## ---------------------- ##
+## Lex and parse params.  ##
+## ---------------------- ##
+
+# AT_TEST(SKELETON)
+# -----------------
+# Check that the identifier of the params is properly fetched
+# even when there are trailing blanks.
+
+m4_pushdef([AT_TEST],
+[AT_SETUP([[Lex and parse params: $1]])
+
+AT_BISON_OPTION_PUSHDEFS([%locations %skeleton $1])
+
+## FIXME: Improve parsing of parse-param and use the generated
+## yyerror.
+AT_DATA_GRAMMAR([input.y],
+[[%defines
+%locations
+%skeleton $1
+%union { int ival; }
+%parse-param { int x }
+// Spaces, tabs, and new lines.
+%parse-param { @&t@
+        int y   @&t@
+         @&t@
+ @&t@
+}
+
+%{
+#include <stdio.h>
+#include <stdlib.h>
+
+]AT_SKEL_CC_IF([], [[
+static
+void
+yyerror (int x, int y, const char *msg)
+{
+  fprintf (stderr, "x: %d, y: %d, %s\n", x, y, msg);
+}]])[
+
+  ]AT_YYLEX_DECLARE[
+%}
+
+%%
+exp: 'a' { fprintf (stdout, "x: %d, y: %d\n", x, y); };
+%%
+]AT_YYLEX_DEFINE(["a"])[
+
+]AT_SKEL_CC_IF(
+[AT_YYERROR_DEFINE
+
+int
+yyparse (int x, int y)
+{
+  yy::parser parser(x, y);
+  return parser.parse ();
+}
+])[
+
+int
+main (void)
+{
+  return !!yyparse(1, 2);
+}
+]])
+
+AT_FULL_COMPILE([input])
+AT_CHECK([./input], 0, [[x: 1, y: 2
+]])
+AT_BISON_OPTION_POPDEFS
+
+AT_CLEANUP
+])
+
+## FIXME: test Java, and iterate over skeletons.
+AT_TEST("yacc.c")
+AT_TEST("glr.c")
+AT_TEST("lalr1.cc")
+AT_TEST("glr.cc")
+
+m4_popdef([AT_TEST])
index 7e7122f902197abb8225a77f3b0c0ba6610ddf09..e2b7005d95fae1a41225aad41eae626d175854cb 100644 (file)
@@ -64,22 +64,22 @@ m4_define([AT_SYNCLINES_COMPILE],
 #   distcc[35882] (dcc_connect_by_name) ERROR: failed to look up host "chrisimac": Unknown host
 #   distcc[35882] Warning: failed to distribute input.c to chrisimac/4, running locally instead
 
-AT_CHECK([[perl -p -0777 -f - stderr <<\EOF
- s/^distcc\[\d+\] .*\n//gm;
s/^([^:]*:\d+)[.:][^:]*:(.*)$/$][1:$][2/gm;
s/^([^:]*:\d+:)[^#]*( #error)/$][1$][2/gm;
s/^[^:]*: In function '[^']*':\n//gm;
- s/^\ +#error.*\n\ *\^\n//gm;
+AT_CHECK([[perl -p -0777 - stderr <<\EOF
 s/^distcc\[\d+\] .*\n//gm;
 s/^([^:]+:\d+)[.:][^:]+:(.+)$/$][1:$][2/gm;
 s/^([^:]+:\d+):[^#]*( #error)/$][1:$][2/gm;
 s/^[^:]*: In function '[^']+':\n//gm;
 s/^\ +#error.*\n\ *\^\n//gm;
 EOF
 ]],
- 0, [stdout])
 0, [stdout])
 ])
 
-# AT_TEST_SYNCLINE(TITLE, INPUT, ERROR-MSG)
-# -----------------------------------------
+# AT_TEST(TITLE, INPUT, ERROR-MSG)
+# --------------------------------
 # Check that compiling the parser produced from INPUT cause GCC
 # to issue ERROR-MSG.
-m4_define([AT_TEST_SYNCLINE],
+m4_pushdef([AT_TEST],
 [AT_SETUP([$1])
 AT_BISON_OPTION_PUSHDEFS
 # It seems impossible to find a generic scheme to check the location
@@ -116,12 +116,12 @@ AT_CLEANUP
 ])
 
 
-## --------------------- ##
-## Prologue syncline.  ##
-## --------------------- ##
+## ------------------- ##
+## Prologue syncline.  ##
+## ------------------- ##
 
 
-AT_TEST_SYNCLINE([Prologue synch line],
+AT_TEST([Prologue syncline],
 [[%{
 #error "2"
 ]AT_YYERROR_DECLARE_EXTERN[
@@ -135,11 +135,11 @@ exp: '0';
 ])
 
 
-## ------------------- ##
-## %union syncline.  ##
-## ------------------- ##
+## ----------------- ##
+## %union syncline.  ##
+## ----------------- ##
 
-AT_TEST_SYNCLINE([%union synch line],
+AT_TEST([%union syncline],
 [[%union {
 #error "2"
   char dummy;
@@ -156,11 +156,11 @@ exp: '0';
 ])
 
 
-## ------------------------- ##
-## Postprologue syncline.  ##
-## ------------------------- ##
+## ----------------------- ##
+## Postprologue syncline.  ##
+## ----------------------- ##
 
-AT_TEST_SYNCLINE([Postprologue synch line],
+AT_TEST([Postprologue syncline],
 [[%{
 ]AT_YYERROR_DECLARE_EXTERN[
 ]AT_YYLEX_DECLARE_EXTERN[
@@ -180,11 +180,11 @@ exp: '0';
 ])
 
 
-## ------------------- ##
-## Action syncline.  ##
-## ------------------- ##
+## ----------------- ##
+## Action syncline.  ##
+## ----------------- ##
 
-AT_TEST_SYNCLINE([Action synch line],
+AT_TEST([Action syncline],
 [[%{
 ]AT_YYERROR_DECLARE_EXTERN[
 ]AT_YYLEX_DECLARE_EXTERN[
@@ -199,11 +199,11 @@ exp:
 ])
 
 
-## --------------------- ##
-## Epilogue syncline.  ##
-## --------------------- ##
+## ------------------- ##
+## Epilogue syncline.  ##
+## ------------------- ##
 
-AT_TEST_SYNCLINE([Epilogue synch line],
+AT_TEST([Epilogue syncline],
 [[%{
 ]AT_YYERROR_DECLARE_EXTERN[
 ]AT_YYLEX_DECLARE_EXTERN[
@@ -215,3 +215,5 @@ exp: '0';
 ]],
 [input.y:8: #error "8"
 ])
+
+m4_popdef([AT_TEST])