authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-28 21:24:31+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-28 21:31:28+01:00
logaea4f705dc3d50c3cc3a4011d0b82b181b3ece8c
tree0301faa325085c75d96a6d0b409a7be41b706a01
parent8594f179f9d70fbc3bf39111c4e1f147d4a6dc3c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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


1 files changed, 38 insertions(+), 16 deletions(-)

lib/std/Target.zig+38-16
......@@ -2884,19 +2884,29 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
28842884 },
28852885 },
28862886
2887 .elfiamcu,
2888 .fuchsia,
2889 .hermit,
2890
2891 .aix,
2892 .haiku,
2893 .hurd,
28872894 .linux,
2895 .plan9,
2896 .rtems,
2897 .serenity,
2898 .zos,
2899
28882900 .freebsd,
2889 .netbsd,
28902901 .dragonfly,
2902 .netbsd,
28912903 .openbsd,
2904
2905 .illumos,
2906 .solaris,
2907
28922908 .wasi,
28932909 .emscripten,
2894 .plan9,
2895 .solaris,
2896 .illumos,
2897 .haiku,
2898 .fuchsia,
2899 .serenity,
29002910 => switch (target.cpu.arch) {
29012911 .msp430 => switch (c_type) {
29022912 .char => return 8,
......@@ -2941,7 +2951,10 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
29412951 .longdouble => switch (target.cpu.arch) {
29422952 .x86 => switch (target.abi) {
29432953 .android => return 64,
2944 else => return 80,
2954 else => switch (target.os.tag) {
2955 .elfiamcu => return 64,
2956 else => return 80,
2957 },
29452958 },
29462959
29472960 .powerpc,
......@@ -2955,7 +2968,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
29552968 .muslx32,
29562969 => return 64,
29572970 else => switch (target.os.tag) {
2958 .freebsd, .netbsd, .openbsd => return 64,
2971 .aix, .freebsd, .netbsd, .openbsd => return 64,
29592972 else => return 128,
29602973 },
29612974 },
......@@ -2971,7 +2984,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
29712984 .muslx32,
29722985 => return 64,
29732986 else => switch (target.os.tag) {
2974 .freebsd, .openbsd => return 64,
2987 .aix, .freebsd, .openbsd => return 64,
29752988 else => return 128,
29762989 },
29772990 },
......@@ -3104,13 +3117,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
31043117 },
31053118
31063119 .ps3,
3107 .zos,
3108 .rtems,
3109 .aix,
3110 .elfiamcu,
31113120 .contiki,
3112 .hermit,
3113 .hurd,
31143121 .opengl,
31153122 => @panic("TODO specify the C integer and float type sizes for this OS"),
31163123 }
......@@ -3121,6 +3128,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
31213128 switch (target.cpu.arch) {
31223129 .avr => return 1,
31233130 .x86 => switch (target.os.tag) {
3131 .elfiamcu => switch (c_type) {
3132 .longlong, .ulonglong, .double => return 4,
3133 else => {},
3134 },
31243135 .windows, .uefi => switch (c_type) {
31253136 .longlong, .ulonglong, .double => return 8,
31263137 .longdouble => switch (target.abi) {
......@@ -3131,6 +3142,13 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
31313142 },
31323143 else => {},
31333144 },
3145 .powerpc, .powerpcle, .powerpc64, .powerpc64le => switch (target.os.tag) {
3146 .aix => switch (c_type) {
3147 .double, .longdouble => return 4,
3148 else => {},
3149 },
3150 else => {},
3151 },
31343152 else => {},
31353153 }
31363154
......@@ -3244,6 +3262,10 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
32443262 },
32453263 .avr => return 1,
32463264 .x86 => switch (target.os.tag) {
3265 .elfiamcu => switch (c_type) {
3266 .longlong, .ulonglong, .double, .longdouble => return 4,
3267 else => {},
3268 },
32473269 .windows, .uefi => switch (c_type) {
32483270 .longdouble => switch (target.abi) {
32493271 .gnu, .gnuilp32, .ilp32, .cygnus => return 4,