|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78281 - trunk/tools/build/v2/engine
From: steven_at_[hidden]
Date: 2012-04-30 12:49:44
Author: steven_watanabe
Date: 2012-04-30 12:49:42 EDT (Mon, 30 Apr 2012)
New Revision: 78281
URL: http://svn.boost.org/trac/boost/changeset/78281
Log:
Don't assume that make1a processes targets in the same order as make0. It doesn't. Start a new stack when rescanning to avoid spurious cycles which cause a seg-fault.
Text files modified:
trunk/tools/build/v2/engine/make1.c | 38 ++++++++++++++++++++++++--------------
trunk/tools/build/v2/engine/rules.h | 4 ++--
2 files changed, 26 insertions(+), 16 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-30 12:49:42 EDT (Mon, 30 Apr 2012)
@@ -270,13 +270,13 @@
static void make1a( state * pState )
{
- TARGET * t = target_scc( pState->t );
+
+ TARGET * t = pState->t;
+ TARGET * scc_root = target_scc( t );
TARGETS * c;
- if ( pState->parent == NULL || target_scc( pState->parent ) != t )
- pState->t = t;
- else
- t = pState->t;
+ if ( pState->parent == NULL || target_scc( pState->parent ) != scc_root )
+ pState->t = t = scc_root;
/* If the parent is the first to try to build this target or this target is
* in the make1c() quagmire, arrange for the parent to be notified when this
@@ -288,9 +288,12 @@
switch ( t->progress )
{
case T_MAKE_ONSTACK:
- if ( target_scc( pState->parent ) != t )
- make1breakcycle( pState->parent, t );
- break;
+ if ( t->depth == handling_rescan )
+ {
+ if ( target_scc( pState->parent ) != scc_root )
+ make1breakcycle( pState->parent, t );
+ break;
+ }
case T_MAKE_ACTIVE:
if ( handling_rescan && ( cycle_root = make1findcycle( t ) ) )
{
@@ -346,6 +349,7 @@
/* Guard against circular dependencies. */
t->progress = T_MAKE_ONSTACK;
+ t->depth = handling_rescan;
{
stack temp_stack = { NULL };
@@ -1238,11 +1242,15 @@
TARGET * result;
if ( t->progress == T_MAKE_ONSTACK )
- return t;
- else if ( t->progress != T_MAKE_ACTIVE )
+ if ( t->depth == handling_rescan )
+ return t;
+ else
+ t->progress = T_MAKE_FINDCYCLE_ONSTACK;
+ else if ( t->progress == T_MAKE_ACTIVE )
+ t->progress = T_MAKE_FINDCYCLE_ACTIVE;
+ else
return 0;
- t->progress = T_MAKE_FINDCYCLE;
for ( c = t->depends; c; c = c->next )
if ( ( result = make1findcycle_impl( c->target, scc_root ) ) )
@@ -1258,11 +1266,13 @@
{
TARGETS * c;
- if ( t->progress != T_MAKE_FINDCYCLE )
+ if ( t->progress == T_MAKE_FINDCYCLE_ACTIVE )
+ t->progress = T_MAKE_ACTIVE;
+ else if ( t->progress == T_MAKE_FINDCYCLE_ONSTACK )
+ t->progress = T_MAKE_ONSTACK;
+ else
return;
- t->progress = T_MAKE_ACTIVE;
-
for ( c = t->depends; c; c = c->next )
make1findcycle_cleanup( c->target );
}
Modified: trunk/tools/build/v2/engine/rules.h
==============================================================================
--- trunk/tools/build/v2/engine/rules.h (original)
+++ trunk/tools/build/v2/engine/rules.h 2012-04-30 12:49:42 EDT (Mon, 30 Apr 2012)
@@ -212,8 +212,8 @@
#define T_MAKE_RUNNING 3 /* make1(target) running commands */
#define T_MAKE_DONE 4 /* make1(target) done */
#define T_MAKE_NOEXEC_DONE 5 /* make1(target) done with -n in effect */
-#define T_MAKE_FINDCYCLE 6 /* make1(target) searching for cyclic includes after
- rescanning a generated file. */
+#define T_MAKE_FINDCYCLE_ONSTACK 6 /* make1(target) searching for cyclic includes after */
+#define T_MAKE_FINDCYCLE_ACTIVE 7 /* rescanning a generated file. */
#ifdef OPT_SEMAPHORE
#define T_MAKE_SEMAPHORE 5 /* Special target type for semaphores */
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