|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75945 - in trunk/tools/build/v2: engine test/core-language
From: steven_at_[hidden]
Date: 2011-12-14 16:49:35
Author: steven_watanabe
Date: 2011-12-14 16:49:34 EST (Wed, 14 Dec 2011)
New Revision: 75945
URL: http://svn.boost.org/trac/boost/changeset/75945
Log:
Fix the result of while.
Text files modified:
trunk/tools/build/v2/engine/function.c | 2 ++
trunk/tools/build/v2/test/core-language/test.jam | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
Modified: trunk/tools/build/v2/engine/function.c
==============================================================================
--- trunk/tools/build/v2/engine/function.c (original)
+++ trunk/tools/build/v2/engine/function.c 2011-12-14 16:49:34 EST (Wed, 14 Dec 2011)
@@ -2192,6 +2192,8 @@
int nested_result = result_location == RESULT_NONE? RESULT_NONE : RESULT_RETURN;
int test = compile_new_label( c );
int top = compile_new_label( c );
+ /* Make sure that we return an empty list if the loop runs zero times. */
+ adjust_result( c, RESULT_NONE, nested_result );
/* Jump to the loop test */
compile_emit_branch( c, INSTR_JUMP, test );
compile_set_label( c, top );
Modified: trunk/tools/build/v2/test/core-language/test.jam
==============================================================================
--- trunk/tools/build/v2/test/core-language/test.jam (original)
+++ trunk/tools/build/v2/test/core-language/test.jam 2011-12-14 16:49:34 EST (Wed, 14 Dec 2011)
@@ -1166,6 +1166,23 @@
check-equal while-result : [ test-rule ] : x ;
+rule test-rule
+{
+ local value = 1 2 ;
+ while $(value)
+ {
+ value = $(value[2-]) ;
+ local inner = $(value) ;
+ while $(inner)
+ {
+ inner = $(inner[2-]) ;
+ return x ;
+ }
+ }
+}
+
+check-equal while-result-2 : [ test-rule ] : ;
+
}
#
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk