Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78252 - in trunk/tools/build/v2: engine test
From: steven_at_[hidden]
Date: 2012-04-29 00:28:04


Author: steven_watanabe
Date: 2012-04-29 00:27:55 EDT (Sun, 29 Apr 2012)
New Revision: 78252
URL: http://svn.boost.org/trac/boost/changeset/78252

Log:
Pass the correct argument to make1breakcycle and make sure that we don't add a spurious self-dependency.
Text files modified:
   trunk/tools/build/v2/engine/make1.c | 14 ++++--
   trunk/tools/build/v2/test/rescan_header.py | 78 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 87 insertions(+), 5 deletions(-)

Modified: trunk/tools/build/v2/engine/make1.c
==============================================================================
--- trunk/tools/build/v2/engine/make1.c (original)
+++ trunk/tools/build/v2/engine/make1.c 2012-04-29 00:27:55 EDT (Sun, 29 Apr 2012)
@@ -281,20 +281,24 @@
     if ( pState->parent )
     {
         TARGET * dependency = make1scc( t );
+ TARGET * cycle_root;
         switch ( dependency->progress )
         {
             case T_MAKE_ONSTACK:
                 make1breakcycle( pState->parent, dependency ); break;
             case T_MAKE_ACTIVE:
- if ( handling_rescan && make1findcycle( dependency ) )
+ if ( handling_rescan && ( cycle_root = make1findcycle( dependency ) ) )
                 {
- make1breakcycle( pState->parent, dependency ); break;
+ make1breakcycle( pState->parent, cycle_root ); break;
                 }
             case T_MAKE_INIT:
             case T_MAKE_RUNNING:
- dependency->parents = targetentry( dependency->parents,
- pState->parent );
- ++pState->parent->asynccnt;
+ if( dependency != pState->parent )
+ {
+ dependency->parents = targetentry( dependency->parents,
+ pState->parent );
+ ++pState->parent->asynccnt;
+ }
         }
     }
 

Modified: trunk/tools/build/v2/test/rescan_header.py
==============================================================================
--- trunk/tools/build/v2/test/rescan_header.py (original)
+++ trunk/tools/build/v2/test/rescan_header.py 2012-04-29 00:27:55 EDT (Sun, 29 Apr 2012)
@@ -220,5 +220,83 @@
 t.expect_addition("bin/$toolset/debug/test.exe")
 t.expect_nothing_more()
 
+t.rm(".")
+
+# Test a loop that includes a generated header
+t.write("test1.cpp", """
+#include "header1.h"
+""")
+
+t.write("test2.cpp", """
+#include "header2.h"
+
+int main() {}
+""")
+
+t.write("header1.h", """
+#ifndef HEADER1_H
+#define HEADER1_H
+#include "header2.h"
+#endif
+""")
+
+t.write("header2.in", """
+#ifndef HEADER2_H
+#define HEADER2_H
+#include "header3.h"
+#endif
+""")
+
+t.write("header3.h", """
+#ifndef HEADER3_H
+#define HEADER3_H
+#include "header1.h"
+#endif
+""")
+
+t.write("sleep.bat","""@setlocal
+@echo off
+@REM timeout /T %1 /NOBREAK >nul
+ping 127.0.0.1 -n 2 -w 1000 >nul
+ping 127.0.0.1 -n %1 -w 1000 >nul
+@endlocal
+@exit /B 0
+""")
+
+t.write("Jamroot.jam", """
+import common ;
+import os ;
+
+if [ os.name ] = NT
+{
+ SLEEP = call sleep.bat ;
+}
+else
+{
+ SLEEP = sleep ;
+}
+
+rule copy {
+ common.copy $(<) : $(>) ;
+}
+
+actions copy {
+ $(SLEEP) 1
+}
+
+make header2.h : header2.in : @copy ;
+exe test : test2.cpp test1.cpp :
+ <implicit-dependency>header2.h
+ <include>.
+ ;
+""")
+
+t.run_build_system("-j2 test")
+t.expect_addition("bin/$toolset/debug/header2.h")
+t.expect_addition("bin/$toolset/debug/test1.obj")
+t.expect_addition("bin/$toolset/debug/test2.obj")
+t.expect_addition("bin/$toolset/debug/test.exe")
+t.expect_nothing_more()
+
 
 t.cleanup()


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