zig cc: add -Wno-overriding-t-option to clang on darwin

This avoids a warning that sometimes occurs when providing both a
-target argument that contains a version as well as the
-mmacosx-version-min argument. Zig provides the correct value in both
places, so it doesn't matter which one gets overridden.
This commit is contained in:
Andrew Kelley 2023-01-22 12:27:18 -07:00
parent 3df4707ea7
commit 8484df5bd2

View File

@ -4319,11 +4319,18 @@ pub fn addCCArgs(
}
},
.macos => {
try argv.ensureUnusedCapacity(2);
// Pass the proper -m<os>-version-min argument for darwin.
const ver = target.os.version_range.semver.min;
try argv.append(try std.fmt.allocPrint(arena, "-mmacos-version-min={d}.{d}.{d}", .{
argv.appendAssumeCapacity(try std.fmt.allocPrint(arena, "-mmacos-version-min={d}.{d}.{d}", .{
ver.major, ver.minor, ver.patch,
}));
// This avoids a warning that sometimes occurs when
// providing both a -target argument that contains a
// version as well as the -mmacosx-version-min argument.
// Zig provides the correct value in both places, so it
// doesn't matter which one gets overridden.
argv.appendAssumeCapacity("-Wno-overriding-t-option");
},
.ios, .tvos, .watchos => switch (target.cpu.arch) {
// Pass the proper -m<os>-version-min argument for darwin.