2006-06-16 Stepan Kasal * lib/m4sugar/m4sugar.m4 (m4_init): Merge the two m4_wrap calls, so that we do not care whether they are LIFO or FIFO; in the m4_wrap, do not check which diversion is the topmost one, just check that the stack is balanced at the end. * lib/m4sugar/m4sh.m4 (AS_INIT): We are going to change the base diversion forever--pop the previous diversion before opening the new one; consequently, remove the m4_wrap call. * lib/autotest/general.m4 (AT_INIT): Likewise. * tests/m4sugar.at: Do not use m4_wrap([m4_diversion_pop([..])]), for educational purposes. Index: lib/autotest/general.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v retrieving revision 1.213 diff -u -r1.213 general.m4 --- lib/autotest/general.m4 23 May 2006 04:44:27 -0000 1.213 +++ lib/autotest/general.m4 16 Jun 2006 13:31:49 -0000 @@ -1012,8 +1012,8 @@ dnl End of AT_INIT: divert to KILL, only test groups are to be dnl output, the rest is ignored. Current diversion is BODY, inherited dnl from M4sh. +m4_divert_pop([BODY]) m4_divert_push([KILL]) -m4_wrap([m4_divert_pop([KILL])[]]) ])# AT_INIT Index: lib/m4sugar/m4sh.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v retrieving revision 1.191 diff -u -r1.191 m4sh.m4 --- lib/m4sugar/m4sh.m4 7 Jun 2006 23:46:47 -0000 1.191 +++ lib/m4sugar/m4sh.m4 16 Jun 2006 13:31:50 -0000 @@ -1493,6 +1493,6 @@ AS_REQUIRE([_AS_SHELL_FN_SPY]) # Let's go! -m4_wrap([m4_divert_pop([BODY])[]]) +m4_divert_pop([KILL])[]dnl m4_divert_push([BODY])[]dnl ]) Index: lib/m4sugar/m4sugar.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sugar.m4,v retrieving revision 2.98 diff -u -r2.98 m4sugar.m4 --- lib/m4sugar/m4sugar.m4 5 Jun 2006 08:18:33 -0000 2.98 +++ lib/m4sugar/m4sugar.m4 16 Jun 2006 13:31:52 -0000 @@ -1770,10 +1770,11 @@ m4_pattern_forbid([^_?m4_]) m4_pattern_forbid([^dnl$]) +# _m4_divert_diversion should be defined: +m4_divert_push([KILL]) + # Check the divert push/pop perfect balance. -m4_wrap([m4_ifdef([_m4_divert_diversion], +m4_wrap([m4_divert_pop([]) + m4_ifdef([_m4_divert_diversion], [m4_fatal([$0: unbalanced m4_divert_push:]_m4_divert_n_stack)])[]]) - -m4_divert_push([KILL]) -m4_wrap([m4_divert_pop([KILL])[]]) ]) Index: tests/m4sugar.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/m4sugar.at,v retrieving revision 1.30 diff -u -r1.30 m4sugar.at --- tests/m4sugar.at 5 Jun 2006 08:18:33 -0000 1.30 +++ tests/m4sugar.at 16 Jun 2006 13:31:52 -0000 @@ -62,7 +62,7 @@ m4_defun([cross_warning], [m4_warn([cross], [cross])]) -m4_divert_push([0])m4_wrap([m4_divert_pop([0])[]])dnl +m4_divert([0])dnl m4_warn([obsolete], [obsolete])dnl cross_warning[]dnl m4_warn([syntax], [syntax])dnl @@ -135,7 +135,7 @@ [m4_require([foo])]) m4_init -m4_divert_push([0])m4_wrap([m4_divert_pop([0])[]])dnl +m4_divert([0])dnl baz ]]) @@ -161,7 +161,7 @@ # m4-listification. AT_DATA_M4SUGAR([script.4s], -[[m4_divert_push([0])m4_wrap([m4_divert_pop([0])])dnl +[[m4_divert([0])dnl m4_text_wrap([Short string */], [ ], [/* ], 20) m4_text_wrap([Much longer string */], [ ], [/* ], 20) @@ -303,7 +303,7 @@ AT_DATA_M4SUGAR([script.4s], [[m4_init -m4_divert_push([0])m4_wrap([m4_divert_pop([0])[]])dnl +m4_divert([0])dnl m4_for([myvar], 1, 3,-1, [ myvar]) ]]) @@ -315,7 +315,7 @@ AT_DATA_M4SUGAR([script.4s], [[m4_init -m4_divert_push([0])m4_wrap([m4_divert_pop([0])[]])dnl +m4_divert([0])dnl m4_for([myvar], 1, 2, 0, [ myvar]) ]]) @@ -327,7 +327,7 @@ AT_DATA_M4SUGAR([script.4s], [[m4_init -m4_divert_push([0])m4_wrap([m4_divert_pop([0])[]])dnl +m4_divert([0])dnl m4_for([myvar], 2, 1, 0, [ myvar]) ]])