std.Target: remove Abi.cygnus

There is approximately zero chance of the Zig team ever spending any effort on
supporting Cygwin; the MSVC and MinGW-w64 ABIs are superior in every way that
matters, and not least because they lead to binaries that just run natively on
Windows without needing a POSIX emulation environment installed.
This commit is contained in:
Alex Rønne Petersen 2025-11-12 16:04:17 +01:00
parent 92bc619c49
commit dfd7b7f233
7 changed files with 9 additions and 27 deletions

View file

@ -292,16 +292,9 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
} }
try define(w, "__MSVCRT__"); try define(w, "__MSVCRT__");
try define(w, "__MINGW32__"); try define(w, "__MINGW32__");
} else if (comp.target.abi == .cygnus) {
try define(w, "__CYGWIN__");
if (ptr_width == 64) {
try define(w, "__CYGWIN64__");
} else {
try define(w, "__CYGWIN32__");
}
} }
if (comp.target.abi.isGnu() or comp.target.abi == .cygnus) { if (comp.target.abi.isGnu()) {
// MinGW and Cygwin define __declspec(a) to __attribute((a)). // MinGW and Cygwin define __declspec(a) to __attribute((a)).
// Like Clang we make the define no op if -fdeclspec is enabled. // Like Clang we make the define no op if -fdeclspec is enabled.
if (comp.langopts.declspec_attrs) { if (comp.langopts.declspec_attrs) {
@ -370,7 +363,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
.ps4, .ps4,
.ps5, .ps5,
=> try defineStd(w, "unix", is_gnu), => try defineStd(w, "unix", is_gnu),
.windows => if (comp.target.abi.isGnu() or comp.target.abi == .cygnus) { .windows => if (comp.target.abi.isGnu()) {
try defineStd(w, "unix", is_gnu); try defineStd(w, "unix", is_gnu);
}, },
else => {}, else => {},

View file

@ -375,7 +375,7 @@ pub fn isWindowsMSVCEnvironment(target: std.Target) bool {
} }
pub fn isCygwinMinGW(target: std.Target) bool { pub fn isCygwinMinGW(target: std.Target) bool {
return target.os.tag == .windows and (target.abi == .gnu or target.abi == .cygnus); return target.os.tag == .windows and (target.abi == .gnu);
} }
pub fn isPS(target: std.Target) bool { pub fn isPS(target: std.Target) bool {
@ -727,7 +727,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
.muslx32 => "muslx32", .muslx32 => "muslx32",
.msvc => "msvc", .msvc => "msvc",
.itanium => "itanium", .itanium => "itanium",
.cygnus => "cygnus",
.simulator => "simulator", .simulator => "simulator",
.macabi => "macabi", .macabi => "macabi",
.ohos => "ohos", .ohos => "ohos",

View file

@ -758,7 +758,6 @@ pub const Abi = enum {
muslx32, muslx32,
msvc, msvc,
itanium, itanium,
cygnus,
simulator, simulator,
macabi, macabi,
ohos, ohos,
@ -3208,7 +3207,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
.long, .ulong => return 32, .long, .ulong => return 32,
.longlong, .ulonglong, .double => return 64, .longlong, .ulonglong, .double => return 64,
.longdouble => switch (target.abi) { .longdouble => switch (target.abi) {
.gnu, .ilp32, .cygnus => return 80, .gnu, .ilp32 => return 80,
else => return 64, else => return 64,
}, },
}, },
@ -3216,13 +3215,10 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
.char => return 8, .char => return 8,
.short, .ushort => return 16, .short, .ushort => return 16,
.int, .uint, .float => return 32, .int, .uint, .float => return 32,
.long, .ulong => switch (target.abi) { .long, .ulong => return 32,
.cygnus => return 64,
else => return 32,
},
.longlong, .ulonglong, .double => return 64, .longlong, .ulonglong, .double => return 64,
.longdouble => switch (target.abi) { .longdouble => switch (target.abi) {
.gnu, .ilp32, .cygnus => return 80, .gnu, .ilp32 => return 80,
else => return 64, else => return 64,
}, },
}, },
@ -3331,7 +3327,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
.windows, .uefi => switch (c_type) { .windows, .uefi => switch (c_type) {
.longlong, .ulonglong, .double => return 8, .longlong, .ulonglong, .double => return 8,
.longdouble => switch (target.abi) { .longdouble => switch (target.abi) {
.gnu, .ilp32, .cygnus => return 4, .gnu, .ilp32 => return 4,
else => return 8, else => return 8,
}, },
else => {}, else => {},
@ -3438,7 +3434,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
.x86 => switch (target.os.tag) { .x86 => switch (target.os.tag) {
.windows, .uefi => switch (c_type) { .windows, .uefi => switch (c_type) {
.longdouble => switch (target.abi) { .longdouble => switch (target.abi) {
.gnu, .ilp32, .cygnus => return 4, .gnu, .ilp32 => return 4,
else => return 8, else => return 8,
}, },
else => {}, else => {},

View file

@ -262,7 +262,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
.androideabi, .androideabi,
.msvc, .msvc,
.itanium, .itanium,
.cygnus,
.simulator, .simulator,
.macabi, .macabi,
=> unreachable, => unreachable,

View file

@ -295,7 +295,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
.muslx32 => "muslx32", .muslx32 => "muslx32",
.msvc => "msvc", .msvc => "msvc",
.itanium => "itanium", .itanium => "itanium",
.cygnus => "cygnus",
.simulator => "simulator", .simulator => "simulator",
.macabi => "macabi", .macabi => "macabi",
.ohos, .ohoseabi => "ohos", .ohos, .ohoseabi => "ohos",
@ -420,7 +419,6 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
.sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128", .sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128",
.s390x => "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64", .s390x => "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
.x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) { .x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) {
.cygnus => "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32",
.gnu => if (target.ofmt == .coff) .gnu => if (target.ofmt == .coff)
"e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32" "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"
else else

View file

@ -63,7 +63,7 @@ pub fn supports_fpic(target: *const std.Target) bool {
return switch (target.os.tag) { return switch (target.os.tag) {
.windows, .windows,
.uefi, .uefi,
=> target.abi == .gnu or target.abi == .cygnus, => target.abi == .gnu,
else => true, else => true,
}; };
} }
@ -93,7 +93,6 @@ pub fn useEmulatedTls(target: *const std.Target) bool {
if (target.abi.isOpenHarmony()) return true; if (target.abi.isOpenHarmony()) return true;
return switch (target.os.tag) { return switch (target.os.tag) {
.openbsd => true, .openbsd => true,
.windows => target.abi == .cygnus,
else => false, else => false,
}; };
} }

View file

@ -299,7 +299,6 @@ const targets = [_]std.Target.Query{
.{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none }, .{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none },
.{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none }, .{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none },
.{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none }, .{ .cpu_arch = .x86, .os_tag = .uefi, .abi = .none },
.{ .cpu_arch = .x86, .os_tag = .windows, .abi = .cygnus },
.{ .cpu_arch = .x86, .os_tag = .windows, .abi = .gnu }, .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .gnu },
.{ .cpu_arch = .x86, .os_tag = .windows, .abi = .itanium }, .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .itanium },
.{ .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc }, .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc },
@ -333,7 +332,6 @@ const targets = [_]std.Target.Query{
.{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .rtems, .abi = .none },
.{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .serenity, .abi = .none },
.{ .cpu_arch = .x86_64, .os_tag = .uefi, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .uefi, .abi = .none },
.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .cygnus },
.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }, .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu },
.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .itanium }, .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .itanium },
.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .msvc }, .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .msvc },