From 041f665f192cddafb2e2b58e13689eb74d4871c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Sun, 24 Jun 2012 11:44:13 +0000 Subject: [PATCH] Boost Jam code cleanup - better checking and error reporting related to the -j command-line option and the PARALLELISM built-in variable. [SVN r79054] --- src/engine/jam.c | 12 +++++++----- src/engine/jam.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/engine/jam.c b/src/engine/jam.c index 96731c5d4..120ba2a45 100644 --- a/src/engine/jam.c +++ b/src/engine/jam.c @@ -302,9 +302,10 @@ int main( int argc, char * * argv, char * * arg_environ ) if ( ( s = getoptval( optv, 'j', 0 ) ) ) { globs.jobs = atoi( s ); - if ( !globs.jobs ) + if ( globs.jobs < 1 || globs.jobs > MAXJOBS ) { - printf( "Invalid value for the '-j' option.\n" ); + printf( "Invalid value for the '-j' option, valid values are 1 " + "through %d.\n", MAXJOBS ); exit( EXITBAD ); } } @@ -518,9 +519,10 @@ int main( int argc, char * * argv, char * * arg_environ ) if ( !list_empty( p ) ) { int const j = atoi( object_str( list_front( p ) ) ); - if ( j == -1 ) - printf( "Invalid value of PARALLELISM: %s\n", object_str( - list_front( p ) ) ); + if ( j < 1 || j > MAXJOBS ) + printf( "Invalid value of PARALLELISM: %s. Valid values " + "are 1 through %d.\n", object_str( list_front( p ) ), + MAXJOBS ); else globs.jobs = j; } diff --git a/src/engine/jam.h b/src/engine/jam.h index 507329c58..1781877ad 100644 --- a/src/engine/jam.h +++ b/src/engine/jam.h @@ -414,7 +414,7 @@ #define MAXSYM 1024 /* longest symbol in the environment */ #define MAXJPATH 1024 /* longest filename */ -#define MAXJOBS 64 /* silently enforced -j limit */ +#define MAXJOBS 64 /* internally enforced -j limit */ #define MAXARGC 32 /* words in $(JAMSHELL) */ /* Jam private definitions below. */