Commit 8484df5bd2

Andrew Kelley <andrew@ziglang.org>
2023-01-22 20:27:18
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.
1 parent 3df4707
Changed files (1)
src/Compilation.zig
@@ -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.