| ... | @@ -38,7 +38,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { | ... | @@ -38,7 +38,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { |
| 38 | " init-exe initialize a `zig build` application in the cwd\n" | 38 | " init-exe initialize a `zig build` application in the cwd\n" |
| 39 | " init-lib initialize a `zig build` library in the cwd\n" | 39 | " init-lib initialize a `zig build` library in the cwd\n" |
| 40 | " libc [paths_file] Display native libc paths file or validate one\n" | 40 | " libc [paths_file] Display native libc paths file or validate one\n" |
| 41 | " run [source] create executable and run immediately\n" | 41 | " run [source] [-- [args]] create executable and run immediately\n" |
| 42 | " translate-c [source] convert c code to zig code\n" | 42 | " translate-c [source] convert c code to zig code\n" |
| 43 | " targets list available compilation targets\n" | 43 | " targets list available compilation targets\n" |
| 44 | " test [source] create and run a test build\n" | 44 | " test [source] create and run a test build\n" |
| ... | @@ -617,7 +617,14 @@ int main(int argc, char **argv) { | ... | @@ -617,7 +617,14 @@ int main(int argc, char **argv) { |
| 617 | char *arg = argv[i]; | 617 | char *arg = argv[i]; |
| 618 | | 618 | |
| 619 | if (arg[0] == '-') { | 619 | if (arg[0] == '-') { |
| 620 | if (strcmp(arg, "--release-fast") == 0) { | 620 | if (strcmp(arg, "--") == 0) { |
| | 621 | if (cmd == CmdRun) { |
| | 622 | runtime_args_start = i + 1; |
| | 623 | break; // rest of the args are for the program |
| | 624 | } else { |
| | 625 | fprintf(stderr, "Unexpected end-of-parameter mark: %s\n", arg); |
| | 626 | } |
| | 627 | } else if (strcmp(arg, "--release-fast") == 0) { |
| 621 | build_mode = BuildModeFastRelease; | 628 | build_mode = BuildModeFastRelease; |
| 622 | } else if (strcmp(arg, "--release-safe") == 0) { | 629 | } else if (strcmp(arg, "--release-safe") == 0) { |
| 623 | build_mode = BuildModeSafeRelease; | 630 | build_mode = BuildModeSafeRelease; |
| ... | @@ -880,10 +887,6 @@ int main(int argc, char **argv) { | ... | @@ -880,10 +887,6 @@ int main(int argc, char **argv) { |
| 880 | case CmdLibC: | 887 | case CmdLibC: |
| 881 | if (!in_file) { | 888 | if (!in_file) { |
| 882 | in_file = arg; | 889 | in_file = arg; |
| 883 | if (cmd == CmdRun) { | | |
| 884 | runtime_args_start = i + 1; | | |
| 885 | break; // rest of the args are for the program | | |
| 886 | } | | |
| 887 | } else { | 890 | } else { |
| 888 | fprintf(stderr, "Unexpected extra parameter: %s\n", arg); | 891 | fprintf(stderr, "Unexpected extra parameter: %s\n", arg); |
| 889 | return print_error_usage(arg0); | 892 | return print_error_usage(arg0); |
| ... | @@ -1147,8 +1150,10 @@ int main(int argc, char **argv) { | ... | @@ -1147,8 +1150,10 @@ int main(int argc, char **argv) { |
| 1147 | | 1150 | |
| 1148 | if (cmd == CmdRun) { | 1151 | if (cmd == CmdRun) { |
| 1149 | ZigList<const char*> args = {0}; | 1152 | ZigList<const char*> args = {0}; |
| 1150 | for (int i = runtime_args_start; i < argc; ++i) { | 1153 | if (runtime_args_start != -1) { |
| 1151 | args.append(argv[i]); | 1154 | for (int i = runtime_args_start; i < argc; ++i) { |
| | 1155 | args.append(argv[i]); |
| | 1156 | } |
| 1152 | } | 1157 | } |
| 1153 | | 1158 | |
| 1154 | const char *exec_path = buf_ptr(&g->output_file_path); | 1159 | const char *exec_path = buf_ptr(&g->output_file_path); |