Skip to content

Commit 0eb4e12

Browse files
authored
vulkan: Fix a vulkan-shaders-gen arugment parsing error (ggml-org#10484)
The vulkan-shaders-gen was not parsing the --no-clean argument correctly. Because the previous code was parsing the arguments which have a value only and the --no-clean argument does not have a value, it was not being parsed correctly. This commit can now correctly parse arguments that don't have values.
1 parent 0cc6375 commit 0eb4e12

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,15 @@ void write_output_files() {
474474

475475
int main(int argc, char** argv) {
476476
std::map<std::string, std::string> args;
477-
for (int i = 1; i < argc; i += 2) {
478-
if (i + 1 < argc) {
479-
args[argv[i]] = argv[i + 1];
477+
for (int i = 1; i < argc; ++i) {
478+
std::string arg = argv[i];
479+
if (arg.rfind("--", 0) == 0) {
480+
if (i + 1 < argc && argv[i + 1][0] != '-') {
481+
args[arg] = argv[i + 1];
482+
++i;
483+
} else {
484+
args[arg] = "";
485+
}
480486
}
481487
}
482488

0 commit comments

Comments
 (0)