From 750be19ae865da3ee03c132a287148f2402ad72b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 4 Aug 2010 12:23:59 +0000 Subject: * Remove "auto" and "guess" as synonyms for 0 in the handling of build-cores and --cores. They're superfluous and just complicate the parsing. --- nix.conf.example | 11 +++++------ src/libmain/shared.cc | 17 +++-------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/nix.conf.example b/nix.conf.example index 6175d861491b..7063bed54c4d 100644 --- a/nix.conf.example +++ b/nix.conf.example @@ -62,12 +62,11 @@ ### Option `build-cores' # # This option defines the number of CPU cores to utilize in parallel -# within a build job, i.e. by passing an appropriate `-jN' flag to -# GNU make. The default is 1, meaning that parallel building within -# jobs is disabled. Passing the special values `0', `auto', or -# `guess' causes Nix to try and auto-detect the number of available -# cores on the local host. This setting can be overridden using the -# `--cores' command line switch. +# within a build job, i.e. by passing an appropriate `-jN' flag to GNU +# make. The default is 1, meaning that parallel building within jobs +# is disabled. Passing the special value `0' causes Nix to try and +# auto-detect the number of available cores on the local host. This +# setting can be overridden using the `--cores' command line switch. #build-cores = 1 diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 19aa1e71cca9..eddc4e64b3d7 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -135,12 +135,7 @@ static void initAndRun(int argc, char * * argv) /* Get some settings from the configuration file. */ thisSystem = querySetting("system", SYSTEM); maxBuildJobs = queryIntSetting("build-max-jobs", 1); - string tmp = querySetting("build-cores", "/UNDEFINED"); - std::transform(tmp.begin(), tmp.end(), tmp.begin(), tolower); - if (tmp == "auto" || tmp == "guess") - buildCores = 0; - else - buildCores = queryIntSetting("build-cores", 1); + buildCores = queryIntSetting("build-cores", 1); maxSilentTime = queryIntSetting("build-max-silent-time", 0); /* Catch SIGINT. */ @@ -232,14 +227,8 @@ static void initAndRun(int argc, char * * argv) tryFallback = true; else if (arg == "--max-jobs" || arg == "-j") maxBuildJobs = getIntArg(arg, i, args.end()); - else if (arg == "--cores") { - string tmp = *(++i); - std::transform(tmp.begin(), tmp.end(), tmp.begin(), tolower); - if (tmp == "auto" || tmp == "guess") - buildCores = 0u; - else - buildCores = getIntArg(arg, --i, args.end()); - } + else if (arg == "--cores") + buildCores = getIntArg(arg, i, args.end()); else if (arg == "--readonly-mode") readOnlyMode = true; else if (arg == "--max-silent-time") -- cgit 1.4.1