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 {...@@ -2884,19 +2884,29 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
2884 },2884 },
2885 },2885 },
28862886
2887 .elfiamcu,
2888 .fuchsia,
2889 .hermit,
2890
2891 .aix,
2892 .haiku,
2893 .hurd,
2887 .linux,2894 .linux,
2895 .plan9,
2896 .rtems,
2897 .serenity,
2898 .zos,
2899
2888 .freebsd,2900 .freebsd,
2889 .netbsd,
2890 .dragonfly,2901 .dragonfly,
2902 .netbsd,
2891 .openbsd,2903 .openbsd,
2904
2905 .illumos,
2906 .solaris,
2907
2892 .wasi,2908 .wasi,
2893 .emscripten,2909 .emscripten,
2894 .plan9,
2895 .solaris,
2896 .illumos,
2897 .haiku,
2898 .fuchsia,
2899 .serenity,
2900 => switch (target.cpu.arch) {2910 => switch (target.cpu.arch) {
2901 .msp430 => switch (c_type) {2911 .msp430 => switch (c_type) {
2902 .char => return 8,2912 .char => return 8,
...@@ -2941,7 +2951,10 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -2941,7 +2951,10 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
2941 .longdouble => switch (target.cpu.arch) {2951 .longdouble => switch (target.cpu.arch) {
2942 .x86 => switch (target.abi) {2952 .x86 => switch (target.abi) {
2943 .android => return 64,2953 .android => return 64,
2944 else => return 80,2954 else => switch (target.os.tag) {
2955 .elfiamcu => return 64,
2956 else => return 80,
2957 },
2945 },2958 },
29462959
2947 .powerpc,2960 .powerpc,
...@@ -2955,7 +2968,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -2955,7 +2968,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
2955 .muslx32,2968 .muslx32,
2956 => return 64,2969 => return 64,
2957 else => switch (target.os.tag) {2970 else => switch (target.os.tag) {
2958 .freebsd, .netbsd, .openbsd => return 64,2971 .aix, .freebsd, .netbsd, .openbsd => return 64,
2959 else => return 128,2972 else => return 128,
2960 },2973 },
2961 },2974 },
...@@ -2971,7 +2984,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -2971,7 +2984,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
2971 .muslx32,2984 .muslx32,
2972 => return 64,2985 => return 64,
2973 else => switch (target.os.tag) {2986 else => switch (target.os.tag) {
2974 .freebsd, .openbsd => return 64,2987 .aix, .freebsd, .openbsd => return 64,
2975 else => return 128,2988 else => return 128,
2976 },2989 },
2977 },2990 },
...@@ -3104,13 +3117,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {...@@ -3104,13 +3117,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
3104 },3117 },
31053118
3106 .ps3,3119 .ps3,
3107 .zos,
3108 .rtems,
3109 .aix,
3110 .elfiamcu,
3111 .contiki,3120 .contiki,
3112 .hermit,
3113 .hurd,
3114 .opengl,3121 .opengl,
3115 => @panic("TODO specify the C integer and float type sizes for this OS"),3122 => @panic("TODO specify the C integer and float type sizes for this OS"),
3116 }3123 }
...@@ -3121,6 +3128,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {...@@ -3121,6 +3128,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
3121 switch (target.cpu.arch) {3128 switch (target.cpu.arch) {
3122 .avr => return 1,3129 .avr => return 1,
3123 .x86 => switch (target.os.tag) {3130 .x86 => switch (target.os.tag) {
3131 .elfiamcu => switch (c_type) {
3132 .longlong, .ulonglong, .double => return 4,
3133 else => {},
3134 },
3124 .windows, .uefi => switch (c_type) {3135 .windows, .uefi => switch (c_type) {
3125 .longlong, .ulonglong, .double => return 8,3136 .longlong, .ulonglong, .double => return 8,
3126 .longdouble => switch (target.abi) {3137 .longdouble => switch (target.abi) {
...@@ -3131,6 +3142,13 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {...@@ -3131,6 +3142,13 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
3131 },3142 },
3132 else => {},3143 else => {},
3133 },3144 },
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 },
3134 else => {},3152 else => {},
3135 }3153 }
31363154
...@@ -3244,6 +3262,10 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {...@@ -3244,6 +3262,10 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
3244 },3262 },
3245 .avr => return 1,3263 .avr => return 1,
3246 .x86 => switch (target.os.tag) {3264 .x86 => switch (target.os.tag) {
3265 .elfiamcu => switch (c_type) {
3266 .longlong, .ulonglong, .double, .longdouble => return 4,
3267 else => {},
3268 },
3247 .windows, .uefi => switch (c_type) {3269 .windows, .uefi => switch (c_type) {
3248 .longdouble => switch (target.abi) {3270 .longdouble => switch (target.abi) {
3249 .gnu, .gnuilp32, .ilp32, .cygnus => return 4,3271 .gnu, .gnuilp32, .ilp32, .cygnus => return 4,