std.Target: Add missing C type info for aix, elfiamcu, hermit, hurd, rtems, and zos.

This commit is contained in:
Alex Rønne Petersen 2024-11-28 21:24:31 +01:00
parent 8594f179f9
commit aea4f705dc
No known key found for this signature in database

View File

@ -2884,19 +2884,29 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
}, },
}, },
.elfiamcu,
.fuchsia,
.hermit,
.aix,
.haiku,
.hurd,
.linux, .linux,
.plan9,
.rtems,
.serenity,
.zos,
.freebsd, .freebsd,
.netbsd,
.dragonfly, .dragonfly,
.netbsd,
.openbsd, .openbsd,
.illumos,
.solaris,
.wasi, .wasi,
.emscripten, .emscripten,
.plan9,
.solaris,
.illumos,
.haiku,
.fuchsia,
.serenity,
=> switch (target.cpu.arch) { => switch (target.cpu.arch) {
.msp430 => switch (c_type) { .msp430 => switch (c_type) {
.char => return 8, .char => return 8,
@ -2941,7 +2951,10 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
.longdouble => switch (target.cpu.arch) { .longdouble => switch (target.cpu.arch) {
.x86 => switch (target.abi) { .x86 => switch (target.abi) {
.android => return 64, .android => return 64,
else => return 80, else => switch (target.os.tag) {
.elfiamcu => return 64,
else => return 80,
},
}, },
.powerpc, .powerpc,
@ -2955,7 +2968,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
.muslx32, .muslx32,
=> return 64, => return 64,
else => switch (target.os.tag) { else => switch (target.os.tag) {
.freebsd, .netbsd, .openbsd => return 64, .aix, .freebsd, .netbsd, .openbsd => return 64,
else => return 128, else => return 128,
}, },
}, },
@ -2971,7 +2984,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
.muslx32, .muslx32,
=> return 64, => return 64,
else => switch (target.os.tag) { else => switch (target.os.tag) {
.freebsd, .openbsd => return 64, .aix, .freebsd, .openbsd => return 64,
else => return 128, else => return 128,
}, },
}, },
@ -3104,13 +3117,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
}, },
.ps3, .ps3,
.zos,
.rtems,
.aix,
.elfiamcu,
.contiki, .contiki,
.hermit,
.hurd,
.opengl, .opengl,
=> @panic("TODO specify the C integer and float type sizes for this OS"), => @panic("TODO specify the C integer and float type sizes for this OS"),
} }
@ -3121,6 +3128,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
switch (target.cpu.arch) { switch (target.cpu.arch) {
.avr => return 1, .avr => return 1,
.x86 => switch (target.os.tag) { .x86 => switch (target.os.tag) {
.elfiamcu => switch (c_type) {
.longlong, .ulonglong, .double => return 4,
else => {},
},
.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) {
@ -3131,6 +3142,13 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
}, },
else => {}, else => {},
}, },
.powerpc, .powerpcle, .powerpc64, .powerpc64le => switch (target.os.tag) {
.aix => switch (c_type) {
.double, .longdouble => return 4,
else => {},
},
else => {},
},
else => {}, else => {},
} }
@ -3244,6 +3262,10 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
}, },
.avr => return 1, .avr => return 1,
.x86 => switch (target.os.tag) { .x86 => switch (target.os.tag) {
.elfiamcu => switch (c_type) {
.longlong, .ulonglong, .double, .longdouble => return 4,
else => {},
},
.windows, .uefi => switch (c_type) { .windows, .uefi => switch (c_type) {
.longdouble => switch (target.abi) { .longdouble => switch (target.abi) {
.gnu, .gnuilp32, .ilp32, .cygnus => return 4, .gnu, .gnuilp32, .ilp32, .cygnus => return 4,