On 11/15/15 00:19, Nigel Taylor wrote:
> On 11/14/15 22:46, Stuart Henderson wrote:
>> On 2015/11/14 21:39, Jérémie Courrèges-Anglas wrote:
I have a better solution for this problem encountered with m4,
$ diff -u bison-3.0.4{.gm4,}/bison-3.0.4/examples/calc++/calc++-parser.cc
--- bison-3.0.4.gm4/bison-3.0.4/examples/calc++/calc++-parser.cc Thu Nov
12 01:25:32 2015
+++ bison-3.0.4/bison-3.0.4/examples/calc++/calc++-parser.cc Sat Nov 14
13:09:05 2015
@@ -1010,7 +1010,7 @@
// The symbols being reduced.
for (int yyi = 0; yyi < yynrhs; yyi++)
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
- yystack_[(yynrhs) - (yyi + 1)]);
+ yystack_[......................]);
}
#endif // YYDEBUG
also solves all the similar problems. foreach.m4 redefined m4_bmatch to
use a faster method, removing it makes things work. diff is attached to
switch back to m4, includes the patch for foreach.m4. The Makefile
change to it will add the --gnu argument when bison uses m4. m4 I have
now accepts --gnu as an argument, which allows the
ac_cv_prog_gnu_m4_gnu=yes to be used.
Now all the bison tests pass for m4, same results as gnu m4.
## ------------- ##
## Test results. ##
## ------------- ##
470 tests were successful.
23 tests were skipped.
I needed to increase m4 macro arguments to 4digits for torture tests to
pass. Skipped tests are for things like java not installed.
diff of changes for m4 updated in ~nigel.
There maybe other changes, if problems are hit building a release / ports.
Index: Makefile
===================================================================
RCS file: /home/cvs/ports/devel/bison/Makefile,v
retrieving revision 1.53
diff -u -p -r1.53 Makefile
--- Makefile 15 Nov 2015 11:57:35 -0000 1.53
+++ Makefile 15 Nov 2015 20:33:20 -0000
@@ -3,6 +3,7 @@
COMMENT= GNU parser generator
DISTNAME= bison-3.0.4
+REVISION= 0
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
@@ -13,10 +14,10 @@ PERMIT_PACKAGE_CDROM= Yes
WANTLIB= c
MODULES= devel/gettext
-BUILD_DEPENDS= devel/help2man \
- devel/m4
-RUN_DEPENDS= devel/m4
+BUILD_DEPENDS= devel/help2man
+# Only use with m4 that accepts --gnu argument...
+CONFIGURE_ENV += ac_cv_prog_gnu_m4_gnu=yes M4="/usr/bin/m4"
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= --disable-yacc
MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/build-aux
Index: patches/patch-data_c++_m4
===================================================================
RCS file: patches/patch-data_c++_m4
diff -N patches/patch-data_c++_m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-data_c++_m4 15 Nov 2015 20:16:31 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- data/c++.m4.orig Fri Jan 16 14:47:42 2015
++++ data/c++.m4 Thu Nov 12 01:20:00 2015
+@@ -100,9 +100,9 @@ m4_define([b4_namespace_open],
+ m4_define([b4_namespace_close],
+ [b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
+ m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
+- [^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
++ [^\(.\)[ ]*\(::\)?\([ -9;-Z^-~]\|:[^:]\)*],
+ [\1])),
+- [::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
++ [::\([ -9;-Z\^-~]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
+
+
+ # b4_token_enums
Index: patches/patch-data_m4sugar_foreach_m4
===================================================================
RCS file: patches/patch-data_m4sugar_foreach_m4
diff -N patches/patch-data_m4sugar_foreach_m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-data_m4sugar_foreach_m4 15 Nov 2015 20:17:33 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+--- data/m4sugar/foreach.m4.orig Sun Nov 15 16:48:24 2015
++++ data/m4sugar/foreach.m4 Sun Nov 15 16:49:48 2015
+@@ -120,14 +120,14 @@ m4_define([_m4_case__],
+ # m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])...
+ # _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b]))
+ # then invoke m4_unquote(_m4_b($@)), for concatenation with later text.
+-m4_define([m4_bmatch],
+-[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
+- [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
+- [$#], 2, [$2],
+- [m4_pushdef([_m4_b], [m4_define([_m4_b],
+- _m4_defn([_$0]))]_m4_for([3], m4_eval([($# + 1) / 2 * 2 - 1]),
+- [2], [_$0_(], [)])[_m4_b([], [],]m4_dquote([$]m4_eval(
+- [($# + 1) / 2 * 2]))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
++#m4_define([m4_bmatch],
++#[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
++# [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
++# [$#], 2, [$2],
++# [m4_pushdef([_m4_b], [m4_define([_m4_b],
++# _m4_defn([_$0]))]_m4_for([3], m4_eval([($# + 1) / 2 * 2 - 1]),
++# [2], [_$0_(], [)])[_m4_b([], [],]m4_dquote([$]m4_eval(
++# [($# + 1) / 2 * 2]))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
+
+ m4_define([_m4_bmatch],
+ [m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])])