2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00

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.

[SVN r78281]
This commit is contained in:
Steven Watanabe
2012-04-30 16:49:42 +00:00
parent d3b0ec3508
commit 656fffe626
2 changed files with 26 additions and 16 deletions

View File

@@ -270,13 +270,13 @@ int make1( TARGET * t )
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 @@ static void make1a( state * pState )
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 @@ static void make1a( state * pState )
/* Guard against circular dependencies. */
t->progress = T_MAKE_ONSTACK;
t->depth = handling_rescan;
{
stack temp_stack = { NULL };
@@ -1238,11 +1242,15 @@ static TARGET * make1findcycle_impl( TARGET * t, TARGET * scc_root )
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 @@ static void make1findcycle_cleanup( TARGET * t )
{
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 );
}

View File

@@ -212,8 +212,8 @@ struct _target
#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 */