From 276332ef0f610d1f9c87204c69a62077efb3ef87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Tue, 26 Jun 2012 10:42:58 +0000 Subject: [PATCH] Corrected how Boost Jam handles no-op actions, i.e. those that the used exec*.c platform specific implementation module flagged as a no-op. They still do not cause an external process to be triggered but internally Boost Jam now processes their results the same as if they had been triggered and had done nothing except return EXIT_OK (i.e. they get reported correctly with -d1 & -d2 options, their timing and action rules get triggered and such). This fixes the core_d12.py Boost Build test which was failing due to no-op actions no causing their names to be reported to stdout when run with -d1. [SVN r79104] --- src/engine/command.c | 1 + src/engine/command.h | 1 + src/engine/execcmd.h | 2 +- src/engine/execnt.c | 4 ++-- src/engine/execunix.c | 2 +- src/engine/make1.c | 34 +++++++++++++++++++++++----------- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/engine/command.c b/src/engine/command.c index 2c5a9d4c2..806b9db9f 100644 --- a/src/engine/command.c +++ b/src/engine/command.c @@ -35,6 +35,7 @@ CMD * cmd_new( RULE * rule, LIST * targets, LIST * sources, LIST * shell ) cmd->rule = rule; cmd->shell = shell; cmd->next = 0; + cmd->noop = 0; lol_init( &cmd->args ); lol_add( &cmd->args, targets ); diff --git a/src/engine/command.h b/src/engine/command.h index 64e8519fb..52bfd26b3 100644 --- a/src/engine/command.h +++ b/src/engine/command.h @@ -53,6 +53,7 @@ struct _cmd LIST * shell; /* $(JAMSHELL) value */ LOL args; /* LISTs for $(<), $(>) */ string buf[ 1 ]; /* actual commands */ + int noop; /* no-op commands should be faked instead of executed */ }; CMD * cmd_new diff --git a/src/engine/execcmd.h b/src/engine/execcmd.h index e8a1abb49..7b20b3266 100644 --- a/src/engine/execcmd.h +++ b/src/engine/execcmd.h @@ -52,7 +52,7 @@ int exec_check /* exec_check() return codes. */ #define EXEC_CHECK_OK 101 -#define EXEC_CHECK_SKIP 102 +#define EXEC_CHECK_NOOP 102 #define EXEC_CHECK_LINE_TOO_LONG 103 #define EXEC_CHECK_TOO_LONG 104 diff --git a/src/engine/execnt.c b/src/engine/execnt.c index 5f5a9bea5..54881d44d 100644 --- a/src/engine/execnt.c +++ b/src/engine/execnt.c @@ -226,7 +226,7 @@ int exec_check char const * s = command->value; while ( isspace( *s ) ) ++s; if ( !*s ) - return EXEC_CHECK_SKIP; + return EXEC_CHECK_NOOP; } /* Check prerequisites for executing raw commands. */ @@ -246,7 +246,7 @@ int exec_check return EXEC_CHECK_TOO_LONG; } else - return raw_cmd_length ? EXEC_CHECK_OK : EXEC_CHECK_SKIP; + return raw_cmd_length ? EXEC_CHECK_OK : EXEC_CHECK_NOOP; } /* Now we know we are using an external shell. Note that there is no need to diff --git a/src/engine/execunix.c b/src/engine/execunix.c index 83a85f1f2..ae1cdd7cf 100644 --- a/src/engine/execunix.c +++ b/src/engine/execunix.c @@ -116,7 +116,7 @@ int exec_check * know what they are going to do with such commands. */ if ( !command->size && ( is_raw_cmd || list_empty( *pShell ) ) ) - return EXEC_CHECK_SKIP; + return EXEC_CHECK_NOOP; return is_raw_cmd ? EXEC_CHECK_OK diff --git a/src/engine/make1.c b/src/engine/make1.c index ca93d213f..a4ee2b9c3 100644 --- a/src/engine/make1.c +++ b/src/engine/make1.c @@ -557,15 +557,26 @@ static void make1c( state * pState ) /* Increment the jobs running counter. */ ++cmdsrunning; - /* Execute the actual build command. */ - exec_cmd( cmd->buf, make_closure, t, cmd->shell, rule_name, - target_name ); - - /* Wait until under the concurrent command count limit. */ - assert( 0 < globs.jobs ); - assert( globs.jobs <= MAXJOBS ); - while ( cmdsrunning >= globs.jobs ) - exec_wait(); + /* Execute the actual build command or fake it if no-op. */ + if ( cmd->noop ) + { + timing_info time_info = { 0 } ; + time_info.start = time_info.end = time( 0 ); + out_action( rule_name, target_name, cmd->buf->value, "", "", + EXIT_OK ); + make_closure( t, EXEC_CMD_OK, &time_info, cmd->buf->value, "" ); + } + else + { + exec_cmd( cmd->buf, make_closure, t, cmd->shell, rule_name, + target_name ); + + /* Wait until under the concurrent command count limit. */ + assert( 0 < globs.jobs ); + assert( globs.jobs <= MAXJOBS ); + while ( cmdsrunning >= globs.jobs ) + exec_wait(); + } } } else @@ -1076,9 +1087,10 @@ static CMD * make1cmds( TARGET * t ) { accept_command = 1; } - else if ( cmd_check_result == EXEC_CHECK_SKIP ) + else if ( cmd_check_result == EXEC_CHECK_NOOP ) { - /* Simply release the prepared command. */ + accept_command = 1; + cmd->noop = 1; } else if ( ( actions->flags & RULE_PIECEMEAL ) && ( chunk > 1 ) ) {