0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test
Justus Klausecker 047df44d71 cbe: fix switch statements on large types
`switch` statements on types >128bits are now lowered to conditionals.
This is necessary because Zig lowers integers with more than 128 bits to
bigints, which are not 'native' integers and thus cannot be used as case
values.
128-bit integers get special treatment because Zig will emit actual 128bit
ints if they are supported by the target. They still *may* be lowered to
bigints though, e.g. for 32-bit targets or MSVC. To solve this, this commit
adds a bunch of switch macros to `zig.h` which will either resolve to an
actual `switch` statement or to conditionals. The `if` statements this
approach can generate are not as optimal as they could be but I think this
is a good trade-off since the generated `switch` statements are still the
same as the ones generated for smaller integers. Also the macros result
in pretty readable code.
History 2026-03-18 15:47:18 +01:00
..
behavior cbe: fix switch statements on large types 2026-03-18 15:47:18 +01:00
c_abi tests: get cases passing (and a few other bits) 2026-03-10 10:26:14 +00:00
cases detect when switch on error shadows it's own switch case capture 2026-03-17 02:05:31 +01:00
cli/options test: move standalone/options/ to cli/options/ 2025-10-04 21:55:39 +02:00
incremental incremental: handle loss of main struct instruction 2026-03-12 21:27:16 +01:00
link MachO: fix dynamic lookup of undefined symbols at runtime 2026-01-21 00:31:21 +01:00
src test harness: refmt for readability 2026-02-12 13:14:51 -08:00
standalone test: use expectEqualStrings to check cmakedefine behavior 2026-03-15 21:41:37 +01:00
behavior.zig tests: update for accepted language change 2026-03-10 10:26:10 +00:00
cases.zig test: remove ad-hoc nvptx tests 2025-10-04 20:51:07 +02:00
compile_errors.zig compiler: refactor Zcu.File and path representation 2025-05-18 17:37:02 +01:00
error_traces.zig test: disable an error trace test on optimized aarch64-netbsd 2026-03-02 15:08:37 +01:00
gen_h.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
libc.zig test-libc: disable pthread_cond_wait-cancel_ignored.c 2026-03-10 23:36:22 +01:00
llvm_ir.zig test: Add some basic LLVM IR tests for atomics, volatile, and allowzero. 2025-05-12 17:07:50 +02:00
llvm_targets.zig test/llvm_targets.zig: fix a typo 2026-03-08 02:01:26 +01:00
stack_traces.zig std: back out the StackTrace byval changes 2025-10-29 06:20:50 -07:00
tests.zig tests: pass on -Dsanitize-thread to unit tests 2026-03-06 10:09:06 +01:00