autoconf-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Autoconf source repository branch, master, updated. v2.62-96-g


From: Eric Blake
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.62-96-gd0098d5
Date: Thu, 28 Aug 2008 02:39:40 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=d0098d52bcde4a46ed187145e21dccd362f638fc

The branch, master has been updated
       via  d0098d52bcde4a46ed187145e21dccd362f638fc (commit)
      from  02fa53b19528cbb849b08b68074dcbc31c5a9715 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d0098d52bcde4a46ed187145e21dccd362f638fc
Author: Eric Blake <address@hidden>
Date:   Wed Aug 27 20:30:25 2008 -0600

    Fix off-by-one bug in _m4_shiftn.
    
    * lib/m4sugar/foreach.m4 (_m4_shiftn): Handle case when shifting
    all arguments.
    * tests/m4sugar.at (M4 loops): Test it.
    Reported by Akim Demaille.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog              |    8 ++++++++
 lib/m4sugar/foreach.m4 |    4 ++--
 tests/m4sugar.at       |   21 ++++++++++++++++++---
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0aa373c..d627af0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-27  Eric Blake  <address@hidden>
+
+       Fix off-by-one bug in _m4_shiftn.
+       * lib/m4sugar/foreach.m4 (_m4_shiftn): Handle case when shifting
+       all arguments.
+       * tests/m4sugar.at (M4 loops): Test it.
+       Reported by Akim Demaille.
+
 2008-08-26  Eric Blake  <address@hidden>
 
        Improve INSTALL formatting.
diff --git a/lib/m4sugar/foreach.m4 b/lib/m4sugar/foreach.m4
index 80f333d..bfad301 100644
--- a/lib/m4sugar/foreach.m4
+++ b/lib/m4sugar/foreach.m4
@@ -215,9 +215,9 @@ m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]])
 #   ,[$5],[$6],...,[$m]_m4_popdef([_m4_s])
 # before calling m4_shift(_m4_s($@)).
 m4_define([_m4_shiftn],
-[m4_define([_m4_s],
+[m4_if(m4_incr([$1]), [$#], [], [m4_define([_m4_s],
           m4_pushdef([_m4_s])_m4_for([_m4_s], m4_eval([$1 + 2]), [$#], [1],
-  [[,]m4_dquote([$]_m4_s)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])
+  [[,]m4_dquote([$]_m4_s)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])])
 
 # m4_do(STRING, ...)
 # ------------------
diff --git a/tests/m4sugar.at b/tests/m4sugar.at
index 75c5057..89109c6 100644
--- a/tests/m4sugar.at
+++ b/tests/m4sugar.at
@@ -698,6 +698,9 @@ g], [ myvar|])
 myvar
 dnl only one side effect expansion, prior to visiting list elements
 m4_foreach([i], [[1], [2], [3]m4_errprintn([hi])], [m4_errprintn(i)])dnl
+dnl shifting forms an important part of loops
+m4_shift3:m4_shift3(1,2,3):m4_shift3(1,2,3,4)
+m4_shiftn(3,1,2,3):m4_shiftn(3,1,2,3,4)
 ]],
 [[ 1 2 3
  1 2 3
@@ -731,18 +734,20 @@ m4_foreach([i], [[1], [2], [3]m4_errprintn([hi])], 
[m4_errprintn(i)])dnl
 | f|
  a| b| c,| d,e| f| g|
 outer value
+::4
+:4
 ]], [[hi
 1
 2
 3
 ]])
 
+dnl bounds checking in m4_for
 AT_DATA_M4SUGAR([script.4s],
 [[m4_init
 m4_divert([0])dnl
 m4_for([myvar], 1, 3,-1, [ myvar])
 ]])
-
 AT_CHECK_M4SUGAR([], 1, [],
 [[script.4s:3: error: assert failed: -1 > 0
 script.4s:3: the top level
@@ -754,7 +759,6 @@ AT_DATA_M4SUGAR([script.4s],
 m4_divert([0])dnl
 m4_for([myvar], 1, 2, 0, [ myvar])
 ]])
-
 AT_CHECK_M4SUGAR([], 1, [],
 [[script.4s:3: error: assert failed: 0 > 0
 script.4s:3: the top level
@@ -766,13 +770,24 @@ AT_DATA_M4SUGAR([script.4s],
 m4_divert([0])dnl
 m4_for([myvar], 2, 1, 0, [ myvar])
 ]])
-
 AT_CHECK_M4SUGAR([], 1, [],
 [[script.4s:3: error: assert failed: 0 < 0
 script.4s:3: the top level
 autom4te: m4 failed with exit status: 1
 ]])
 
+dnl m4_shiftn also does bounds checking
+AT_DATA_M4SUGAR([script.4s],
+[[m4_init
+m4_divert([0])dnl
+m4_shiftn(3,1,2)
+]])
+AT_CHECK_M4SUGAR([], 1, [],
+[[script.4s:3: error: assert failed: 0 < 3 && 3 < 3
+script.4s:3: the top level
+autom4te: m4 failed with exit status: 1
+]])
+
 AT_CLEANUP
 
 


hooks/post-receive
--
GNU Autoconf source repository




reply via email to

[Prev in Thread] Current Thread [Next in Thread]