aboutsummaryrefslogtreecommitdiff
path: root/lib/zig.h
AgeCommit message (Collapse)Author
2025-10-29remove all IBM AIX and z/OS supportAlex Rønne Petersen
As with Solaris (dba1bf935390ddb0184a4dc72245454de6c06fd2), we have no way to actually audit contributions for these OSs. IBM also makes it even harder than Oracle to actually obtain these OSs. closes #23695 closes #23694 closes #3655 closes #23693
2025-10-27feat: init 16-bit x86 support in `zig.h`GasInfinity
2025-10-18zig.h: add or1k supportAlex Rønne Petersen
2025-09-30cbe: workaround GCC miscompilationmlugg
This was causing a zig2 miscomp, which emitted slightly broken debug information, which caused extremely slow stack unwinding. We're working on fixing or reporting this upstream, but we can use this workaround for now, because GCC guarantees arithmetic signed shift.
2025-09-18std.zig.system: implement native CPU detection for LoongArchAlex Rønne Petersen
ref #4591
2025-08-11cbe: emit `nonstring` attributeJacob Young
Closes #24545
2025-06-06x86_64: add support for pie executablesJacob Young
2025-05-17x86_64: rewrite scalar `<<|`Jacob Young
Closes #23035
2025-04-26compiler: add @memmove builtindweiller
2025-02-23cbe: Implement support for -fno-builtin and @disableIntrinsics().Alex Rønne Petersen
2025-02-16zig.h: Add new zig_gcc macro to indicate GCC.Alex Rønne Petersen
As opposed to "GNU C" (zig_gnuc) which includes Clang. This addresses #22890 but does not fix it until a zig1.wasm update.
2025-02-10cbe: fix ub triggered by mulw overflowing the promoted typeJacob Young
Closes #21914
2025-01-29Fix issues in zig.h when building with clang-cl on Windows (#20331)Vahur Sinijärv
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-01-28zig.h: Add some casts to __atomic macros to shut Clang warnings up.Alex Rønne Petersen
This is a stupid Clang-ism: ❯ cat test.c int main() { int value = 42; int const *value_ptr = &value; int location; __atomic_store(&location, value_ptr, __ATOMIC_SEQ_CST); } ❯ gcc test.c -fsyntax-only ❯ clang test.c -fsyntax-only test.c:5:31: warning: passing 'const int *' to parameter of type 'int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 5 | __atomic_store(&location, value_ptr, __ATOMIC_SEQ_CST); | ^~~~~~~~~ 1 warning generated. I have no idea why Clang doesn't define these builtins as taking const pointers for the parameters that are only read from. Anyway, after the next zig1.wasm update, this change should shut up these warnings that we've been seeing in CI during bootstrap for ages.
2024-12-03zig.h: Add zig_gnuc_asm macro to indicate availability of GNU-style inline asm.Alex Rønne Petersen
2024-12-03zig.h: Introduce operating system macros.Alex Rønne Petersen
2024-12-03zig.h: Introduce object format macros.Alex Rønne Petersen
2024-12-03zig.h: Move some macros and includes closer to where they're used.Alex Rønne Petersen
2024-12-03zig.h: Use C99/C11 headers if available regardless of language standard.Alex Rønne Petersen
If present, these headers are usable even when compiling for older C language versions. Most notably, this enables zig.h atomics to work with slimcc and TinyCC in C99 mode (and earlier).
2024-12-03zig.h: Remove duplicate and unguarded stdint.h include.Alex Rønne Petersen
We already do this for C99 only later in the file.
2024-12-03zig.h: Implement zig_unreachable() with __assume(0) for MSVC.Alex Rønne Petersen
2024-12-03zig.h: Implement zig_frame_address() with _AddressOfReturnAddress() for MSVC.Alex Rønne Petersen
2024-12-03zig.h: Use zig_*_windows_teb() inline assembly with TinyCC and slimcc.Alex Rønne Petersen
2024-12-03zig.h: Avoid depending on cpuid.h for zig_x86_cpuid().Alex Rønne Petersen
Just use inline assembly instead, which is what that header does. Also make sure we have a dummy implementation when inline assembly is unavailable.
2024-12-03zig.h: Introduce architecture macros to simplify checks throughout.Alex Rønne Petersen
2024-12-03zig.h: Don't use __debugbreak() for MinGW.Alex Rønne Petersen
It seems like only Clang supports this in MinGW mode, and Clang will already take the __builtin_debugtrap() path anyway.
2024-12-03zig.h: Define zig_gnuc for both GCC and Clang and stop using __GNUC__.Alex Rønne Petersen
There's only one spot in the header where we want to handle GCC but not Clang, so just add an extra check there.
2024-12-03zig.h: Add a zig_msvc macro to be used instead of _MSC_VER.Alex Rønne Petersen
2024-12-03zig.h: Use __thread for slimcc in pre-C11 mode.Alex Rønne Petersen
2024-12-03zig.h: Add support for C23 keywords.Alex Rønne Petersen
The old spellings from C11 are deprecated in C23.
2024-12-03zig.h: Add TinyCC support where appropriate.Alex Rønne Petersen
tcc doesn't have __has_attribute and __has_builtin, so we need to manually check for tcc in these preprocessor paths.
2024-12-03zig.h: Use __BYTE_ORDER__ instead of __LITTLE_ENDIAN__ for endianness check.Alex Rønne Petersen
The former is supported by most compilers while the latter is Clang-only.
2024-11-24zig.h: Add zig_trap() and zig_breakpoint() implementations for Hexagon.Alex Rønne Petersen
2024-11-04zig.h: Improve portability of zig_*_windows_teb() helpers.Alex Rønne Petersen
* Make it work for thumb and aarch64. * Clean up std.os.windows.teb() a bit. I also updated stage1/zig.h since the changes are backwards-compatible and are necessary due to the std.os.windows changes that call the newly-added functions.
2024-10-04remove `@fence` (#21585)David Rubin
closes #11650
2024-09-23zig.h: Improve portability of zig_trap() and zig_breakpoint().Alex Rønne Petersen
2024-07-26zig.h: fixup pointer atomic load definitionskcbanner
2024-07-13zig.h: expand zig_msvc_atomic_load_ into version for relaxed, acquire, and ↵kcbanner
seq_cst
2024-07-13zig.h: replace `_InterlockedExchangeAdd` with a plain volatile loadkcbanner
This was causing zig2.exe to crash during bootstrap, because there was an atomic load of read-only memory, and the attempt to write to it as part of the (idempotent) atomic exchange was invalid. Aligned reads (of u32 / u64) are atomic on x86 / x64, so this is replaced with an optimization-proof load (`__iso_volatile_load8*`) and a reordering barrier.
2024-07-04cbe: fix for export changesJacob Young
2024-06-21- Fix `ypedef` -> `typedef`kcbanner
2024-05-22Revert "implement `@expect` builtin (#19658)"Andrew Kelley
This reverts commit a7de02e05216db9a04e438703ddf1b6b12f3fbef. This did not implement the accepted proposal, and I did not sign off on the changes. I would like a chance to review this, please.
2024-05-22implement `@expect` builtin (#19658)David Rubin
* implement `@expect` * add docs * add a second arg for expected bool * fix typo * move `expect` to use BinOp * update to newer langref format
2024-04-30cbe: fix ub with integer `@abs`Jacob Young
2024-03-30cbe: fix uncovered bugsJacob Young
2024-03-30cbe: fix bugs revealed by an upcoming commitJacob Young
Closes #18023
2024-01-03cbe: fix non-msvc externs and exportsJacob Young
Closes #17817
2024-01-03Reapply "Merge pull request #17824 from kcbanner/fixup_msvc_fmax"Jacob Young
This reverts commit 2b589783602c5428ecde9dbb3f41a81f85eb0f25.
2024-01-01Revert "Merge pull request #17824 from kcbanner/fixup_msvc_fmax"Andrew Kelley
This reverts commit 7161ed79c4abcaccdd56fe0b4fbd3d93472d41b8, reversing changes made to 3f2a65594e1d3c0a4f4943a4ea522e8405db81e0. Unfortunately, this sat in the PR queue too long and the merge broke the zig1.wasm bootstrap process.
2024-01-01Merge pull request #17824 from kcbanner/fixup_msvc_fmaxAndrew Kelley
cbe: add a system for avoiding collisions with C compiler intrinsics