authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-06 13:59:11-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-06 13:59:11-04:00
log10dbc735fe4e4575821837f00eb173286a1f88ee
tree1ca87def8ca8d85d8b73e61e3fb007ca0815e844
parent6fbe1632d0c958b9abbc9f38a7e497ef69543bf1

zig build: use -D for options instead of -O

because -O is usually optimization level

2 files changed, 9 insertions(+), 9 deletions(-)

std/build.zig+6-6
......@@ -268,13 +268,13 @@ pub const Builder = struct {
268268 } else if (mem.eql(u8, s, "false")) {
269269 return false;
270270 } else {
271 %%io.stderr.printf("Expected -O{} to be a boolean, but received '{}'\n", name, s);
271 %%io.stderr.printf("Expected -D{} to be a boolean, but received '{}'\n", name, s);
272272 self.markInvalidUserInput();
273273 return null;
274274 }
275275 },
276276 UserValue.List => {
277 %%io.stderr.printf("Expected -O{} to be a boolean, but received a list.\n", name);
277 %%io.stderr.printf("Expected -D{} to be a boolean, but received a list.\n", name);
278278 self.markInvalidUserInput();
279279 return null;
280280 },
......@@ -312,7 +312,7 @@ pub const Builder = struct {
312312 });
313313 },
314314 UserValue.Flag => {
315 %%io.stderr.printf("Option '-O{}={}' conflicts with flag '-O{}'.\n", name, value, name);
315 %%io.stderr.printf("Option '-D{}={}' conflicts with flag '-D{}'.\n", name, value, name);
316316 return true;
317317 },
318318 }
......@@ -328,11 +328,11 @@ pub const Builder = struct {
328328 })) {
329329 switch (prev_value.value) {
330330 UserValue.Scalar => |s| {
331 %%io.stderr.printf("Flag '-O{}' conflicts with option '-O{}={}'.\n", name, name, s);
331 %%io.stderr.printf("Flag '-D{}' conflicts with option '-D{}={}'.\n", name, name, s);
332332 return true;
333333 },
334334 UserValue.List => {
335 %%io.stderr.printf("Flag '-O{}' conflicts with multiple options of the same name.\n", name);
335 %%io.stderr.printf("Flag '-D{}' conflicts with multiple options of the same name.\n", name);
336336 return true;
337337 },
338338 UserValue.Flag => {},
......@@ -374,7 +374,7 @@ pub const Builder = struct {
374374 while (true) {
375375 const entry = it.next() ?? break;
376376 if (!entry.value.used) {
377 %%io.stderr.printf("Invalid option: -O{}\n\n", entry.key);
377 %%io.stderr.printf("Invalid option: -D{}\n\n", entry.key);
378378 self.markInvalidUserInput();
379379 }
380380 }
std/special/build_runner.zig+3-3
......@@ -25,10 +25,10 @@ pub fn main() -> %void {
2525 var arg_i: usize = 1;
2626 while (arg_i < os.args.count(); arg_i += 1) {
2727 const arg = os.args.at(arg_i);
28 if (mem.startsWith(u8, arg, "-O")) {
28 if (mem.startsWith(u8, arg, "-D")) {
2929 const option_contents = arg[2...];
3030 if (option_contents.len == 0) {
31 %%io.stderr.printf("Expected option name after '-O'\n\n");
31 %%io.stderr.printf("Expected option name after '-D'\n\n");
3232 return usage(&builder, maybe_zig_exe, false, &io.stderr);
3333 }
3434 if (const name_end ?= mem.indexOfScalar(u8, option_contents, '=')) {
......@@ -95,7 +95,7 @@ fn usage(builder: &Builder, maybe_zig_exe: ?[]const u8, already_ran_build: bool,
9595 const allocator = builder.allocator;
9696 for (builder.available_options_list.toSliceConst()) |option| {
9797 const name = %%fmt.allocPrint(allocator,
98 " -O{}=({})", option.name, Builder.typeIdName(option.type_id));
98 " -D{}=({})", option.name, Builder.typeIdName(option.type_id));
9999 defer allocator.free(name);
100100 %%out_stream.printf("{s24} {}\n", name, option.description);
101101 }