0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib
mlugg 89a9cabafd
std.builtin.Type: improve ergonomics of *const anyopaque fields
For representing struct field default values and array/pointer type
sentinel values, we use `*const anyopaque`, since there is no way for
`std.builtin.Type.StructField` etc to refer back to its `type` field.
However, when introspecting a type, this is quite awkward due to the
pointer casts necessary.

As such, this commit renames the `sentinel` fields to `sentinel_ptr`,
and the `default_value` field to `default_value_ptr`, and introduces
helper methods `sentinel()` and `defaultValue()` to load the values.
These methods are marked as `inline` because their return value, which
is always comptime-known, is very often required at comptime by use
sites, so this avoids having to annotate such calls with `comptime`.

This is a breaking change, although note that 0.14.0 is already a
breaking release for all users of `std.builtin.Type` due to the union
fields being renamed.
History 2025-01-16 12:49:58 +00:00
..
compiler Sema: rewrite semantic analysis of function calls 2025-01-09 06:46:47 +00:00
compiler_rt compiler_rt: fix incorrect __clzsi2_thumb1 lookup table usage 2025-01-02 01:01:06 +01:00
docs Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
fuzzer/web Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
include zig cc: Remove headers related to GPU offload. 2024-12-16 04:36:57 +01:00
init doc: mention zig can't use URLs if their content changes 2024-12-21 18:23:01 -05:00
libc mingw: Add upstream RtlSecureZeroMemory implementation. 2025-01-14 05:31:14 +01:00
libcxx libcxx: Update to LLVM 19.1.0. 2024-09-19 18:20:22 -07:00
libcxxabi libcxxabi: Update to LLVM 19. 2024-09-19 18:20:21 -07:00
libunwind libunwind: Fix compilation for the x32 ABI. 2024-11-18 17:43:54 +01:00
std std.builtin.Type: improve ergonomics of *const anyopaque fields 2025-01-16 12:49:58 +00:00
tsan tsan: Update to LLVM 19.1.0. 2024-09-24 23:58:21 -07:00
c.zig c: Include Os.Tag.other in the list of freestanding OSs. 2024-11-08 14:56:55 +01:00
compiler_rt.zig compiler_rt: Add hexagon builtins (#22029) 2024-11-24 01:17:21 +00:00
fuzzer.zig fix type of std_options 2024-11-05 23:46:10 +01:00
zig.h zig.h: Add zig_gnuc_asm macro to indicate availability of GNU-style inline asm. 2024-12-03 12:11:05 +01:00