generate: the option parser's else-if chain in two statements (MSVC C1061: more than 128 nested blocks after the new options); the same order and effects
This commit is contained in:
1 parent
7a2948f9bb
commit
6fb466b7cb
1 file changed
+7
-1
@@ -938,6 +938,7 @@ int main(int argc, char** argv) {
|
|||||||
if (i + 1 >= argc) { std::fprintf(stderr, "%s needs a value\n", what); std::exit(2); }
|
if (i + 1 >= argc) { std::fprintf(stderr, "%s needs a value\n", what); std::exit(2); }
|
||||||
return argv[++i];
|
return argv[++i];
|
||||||
};
|
};
|
||||||
|
bool parsed = true;
|
||||||
if (a == "--help" || a == "-h") { usage(); return 0; }
|
if (a == "--help" || a == "-h") { usage(); return 0; }
|
||||||
else if (a == "--pack") o.pack = next("--pack");
|
else if (a == "--pack") o.pack = next("--pack");
|
||||||
else if (a == "--tokens") {
|
else if (a == "--tokens") {
|
||||||
@@ -1024,7 +1025,11 @@ int main(int argc, char** argv) {
|
|||||||
else if (a == "--pool-workers") o.pool_workers = std::atoi(next("--pool-workers"));
|
else if (a == "--pool-workers") o.pool_workers = std::atoi(next("--pool-workers"));
|
||||||
else if (a == "--no-host-worker") o.no_host_worker = true;
|
else if (a == "--no-host-worker") o.no_host_worker = true;
|
||||||
else if (a == "--no-ple-prefetch") o.no_ple_prefetch = true;
|
else if (a == "--no-ple-prefetch") o.no_ple_prefetch = true;
|
||||||
else if (a == "--expert-cache") {
|
else parsed = false;
|
||||||
|
// The chain continues here in a second statement: one chain of 120+ `else if` passed MSVC's limit of 128
|
||||||
|
// nested blocks (C1061). The order of the tests and what each does are unchanged.
|
||||||
|
if (!parsed) {
|
||||||
|
if (a == "--expert-cache") {
|
||||||
const std::string v = next("--expert-cache");
|
const std::string v = next("--expert-cache");
|
||||||
o.expert_cache = (v == "auto") ? -1 : std::atoi(v.c_str());
|
o.expert_cache = (v == "auto") ? -1 : std::atoi(v.c_str());
|
||||||
}
|
}
|
||||||
@@ -1128,6 +1133,7 @@ int main(int argc, char** argv) {
|
|||||||
usage();
|
usage();
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Layer split (multi-GPU): the later stages run layers [K_i, K_i+1) on their own GPUs (--split-device, default
|
// Layer split (multi-GPU): the later stages run layers [K_i, K_i+1) on their own GPUs (--split-device, default
|
||||||
// the next visible ones); "auto" places the K from each GPU's free VRAM once the weights are in (below). Across
|
// the next visible ones); "auto" places the K from each GPU's free VRAM once the weights are in (below). Across
|
||||||
|
|||||||
Reference in new issue
Block a user