Intrinsics

Intrinsics

Compiler builtins (__builtin_*) and target information.

Contents

NameSummary
MemoryOrderThe memory ordering of an atomic operation or fence, with the C11 / C++11 meaning.
__builtin_copyCopies size bytes from src to dst; the regions must not overlap.
__builtin_move_memCopies size bytes from src to dst; the regions may overlap.
__builtin_set_memSets size bytes at ptr to value.
__builtin_compare_memCompares size bytes of a and b as unsigned bytes.
__builtin_construct_atPlacement construction: builds a T from args in the storage at ptr and returns a pointer to it.
__builtin_destruct_atRuns T's destructor on *ptr and leaves the storage as it is.
__builtin_bitcastReinterprets the object representation of v as a T.
__builtin_launderReturns a pointer to the T that now lives at ptr's address, after the storage was reused for a new object.
__builtin_assume_alignedTells the optimizer that ptr is aligned to align and returns it.
__builtin_size_ofReturns sizeof T. Evaluated at compile time.
__builtin_align_ofReturns alignof T.
__builtin_dynamic_sizeReturns the size of the object p points at, which may be a class derived from T: read through T's hidden virtual when T has a virtual destructor, sizeof T otherwise.
__builtin_dynamic_alignReturns the alignment of the object p points at; see __builtin_dynamic_size.
__builtin_is_sameReturns true when T and U are the same type.
__builtin_is_voidReturns true when T is void.
__builtin_is_pointerReturns true when T is a pointer, safe or unsafe alike; __builtin_is_safe_pointer tells them apart.
__builtin_is_arrayReturns true when T is an array type.
__builtin_is_functionReturns true when T is a function type.
__builtin_is_enumReturns true when T is a plain enum.
__builtin_is_unionReturns true when T is a union.
__builtin_is_integralReturns true when T is an integer type.
__builtin_is_floating_pointReturns true when T is a floating-point type.
__builtin_is_signedReturns true when T is a signed arithmetic type.
__builtin_is_unsignedReturns true when T is an unsigned arithmetic type.
__builtin_is_trivially_copyableReturns true when T can be copied with __builtin_copy.
__builtin_is_trivially_destructibleReturns true when destroying a T runs no code.
__builtin_is_trivially_constructibleReturns true when a T can be trivially constructed from one A.
__builtin_is_trivially_default_constructibleReturns true when T() runs no code.
__builtin_is_trivially_assignableReturns true when assigning a U to a T runs no non-trivial code.
__builtin_is_trivially_relocatableReturns true when a T can be moved by copying its bytes and skipping the old object's destructor.
__builtin_is_standard_layoutReturns true when T has standard layout.
__builtin_is_aggregateReturns true when T is an aggregate.
__builtin_is_emptyReturns true when T is a class with no non-static data members.
__builtin_is_polymorphicReturns true when T has a virtual member.
__builtin_is_abstractReturns true when T has a pure virtual member.
__builtin_is_finalReturns true when T is a final class.
__builtin_has_virtual_destructorReturns true when T has a virtual destructor.
__builtin_is_base_ofReturns true when B is a base class of D.
__builtin_is_convertibleReturns true when F converts implicitly to T.
__builtin_is_constructibleReturns true when a T can be constructed from one A.
__builtin_is_default_constructibleReturns true when T() is well formed.
__builtin_is_assignableReturns true when a U can be assigned to a T.
__builtin_is_destructibleReturns true when a T can be destroyed.
__builtin_ctzCounts trailing zero bits of v, viewed as the unsigned type of T's width.
__builtin_clzCounts leading zero bits of v, viewed as the unsigned type of T's width.
__builtin_popcountCounts the set bits of v, viewed as the unsigned type of T's width.
__builtin_bswapReverses the byte order of v.
__builtin_rotlRotates v left by n bits; n is taken modulo the bit width of T.
__builtin_rotrRotates v right by n bits; n is taken modulo the bit width of T.
__builtin_add_overflowComputes a + b, stores the wrapped result in *result and returns true when the exact value did not fit in T.
__builtin_sub_overflowComputes a - b, stores the wrapped result in *result and returns true when the exact value did not fit in T.
__builtin_mul_overflowComputes a * b, stores the wrapped result in *result and returns true when the exact value did not fit in T.
__builtin_expectReturns cond, hinting that it is usually expected.
__builtin_expect_probReturns cond, hinting its likely value from the probability p that it equals expected.
__builtin_unreachableTells the optimizer that control never reaches this call.
__builtin_trapAborts execution immediately with a trap instruction (ud2, brk, ...).
__builtin_debugtrapStops in an attached debugger and otherwise continues.
__builtin_assumeTells the optimizer that cond is true at this point.
__builtin_prefetchHints that the cache line holding ptr will be accessed soon.
__builtin_is_constant_evaluatedReturns true when evaluated during constant evaluation and false at run time.
__builtin_constant_pReturns true when the optimizer can fold v to a compile-time constant at this call.
__builtin_crashWrites msg[0..len) and a newline to stderr, then terminates the process with exit_code via _Exit (no atexit handlers, no destructors).
__builtin_signalWrites msg[0..len) and a newline to stderr, then raises signal at its default action.
__builtin_abortTerminates the process abnormally.
__builtin_atomic_loadAtomically reads *ptr.
__builtin_atomic_storeAtomically writes v to *ptr.
__builtin_atomic_exchangeAtomically replaces *ptr with v and returns the previous value.
__builtin_atomic_casCompare-and-swap: if *ptr == *expected, stores desired and returns true; otherwise copies *ptr into *expected and returns false.
__builtin_atomic_fetch_addAtomically applies + to *ptr with v and returns the value *ptr had before.
__builtin_atomic_fetch_subAtomically applies - to *ptr with v and returns the value *ptr had before.
__builtin_atomic_fetch_andAtomically applies & to *ptr with v and returns the value *ptr had before.
__builtin_atomic_fetch_orAtomically applies | to *ptr with v and returns the value *ptr had before.
__builtin_atomic_fetch_xorAtomically applies ^ to *ptr with v and returns the value *ptr had before.
__builtin_atomic_fetch_maxAtomically applies max to *ptr with v and returns the value *ptr had before.
__builtin_atomic_fetch_minAtomically applies min to *ptr with v and returns the value *ptr had before.
__builtin_atomic_fenceA full memory fence with the given ordering.
__builtin_atomic_signal_fenceA compiler-only fence with the given ordering, against a signal handler on the same thread; it emits no instruction.
__builtin_atomic_is_lock_freeReturns true when atomic operations on a T are always lock-free.
TargetArchThe CPU architecture family of the compilation target.
TargetOSThe operating system of the compilation target; Freestanding when none is detected.
TargetEnvThe ABI environment of the compilation target (libc / toolchain flavour).
TargetInfoA description of the compilation target, from __builtin_target_info().
extend TargetInfo
__builtin_target_infoReturns a TargetInfo for the compilation target.

MemoryOrder

enum MemoryOrder derives i32 {
    Relaxed, Consume, Acquire, Release, AcqRel, SeqCst,
}

The memory ordering of an atomic operation or fence, with the C11 / C++11 meaning.

The discriminants are __ATOMIC_RELAXED .. __ATOMIC_SEQ_CST, so a value converts straight to clang's int order argument.

__builtin_copy

inline fn __builtin_copy(dst: unsafe *u8, src: unsafe *const u8, size: usize)

Copies size bytes from src to dst; the regions must not overlap. Maps to __builtin_memcpy.

Safety

Both pointers must be valid for size bytes (even when size is 0, clang assumes they are non-null), and the regions must not overlap; use __builtin_move_mem if they might.

__builtin_move_mem

inline fn __builtin_move_mem(dst: unsafe *u8, src: unsafe *const u8, size: usize)

Copies size bytes from src to dst; the regions may overlap. Maps to __builtin_memmove.

Safety

Both pointers must be valid for size bytes.

__builtin_set_mem

inline fn __builtin_set_mem(ptr: unsafe *u8, value: byte, size: usize)

Sets size bytes at ptr to value. Maps to __builtin_memset.

Safety

ptr must be valid for writes of size bytes.

__builtin_compare_mem

inline fn __builtin_compare_mem(a: unsafe *const u8, b: unsafe *const u8, size: usize) -> i32

Compares size bytes of a and b as unsigned bytes. Returns a negative, zero or positive value. Maps to __builtin_memcmp.

Safety

Both pointers must be valid for size bytes.

__builtin_construct_at

fn <T, ...A> __builtin_construct_at(ptr: unsafe *u8, ...args: A) -> *T

Placement construction: builds a T from args in the storage at ptr and returns a pointer to it. Maps to placement new (kairo_rt_construct_at).

Safety

ptr must be valid for sizeof T bytes and aligned to alignof T, and must not already hold a live object that needs destroying.

__builtin_destruct_at

fn <T> __builtin_destruct_at(ptr: *T)

Runs T's destructor on *ptr and leaves the storage as it is. Maps to an explicit p->~T().

Safety

ptr must point at a live T; it must not be used or destroyed again afterwards.

__builtin_bitcast

fn <T, From> __builtin_bitcast(v: From) -> T

Reinterprets the object representation of v as a T. Maps to __builtin_bit_cast.

__builtin_bit_cast is a clang keyword, so no C++ declaration can carry the name directly.

Notes

T and From must be the same size and trivially copyable; clang rejects the call otherwise.

__builtin_launder

fn <T> __builtin_launder(ptr: *T) -> *T

Returns a pointer to the T that now lives at ptr's address, after the storage was reused for a new object. Maps to __builtin_launder.

Safety

A T must live at ptr's address.

__builtin_assume_aligned

inline fn __builtin_assume_aligned(ptr: unsafe *u8, align: usize) -> unsafe *u8

Tells the optimizer that ptr is aligned to align and returns it. Implemented as an __builtin_assume on the address bits, so unlike clang's own form align need not be a constant.

Parameters

  • align: A power of two.

Safety

ptr must really be align-aligned; otherwise the behaviour is undefined.

__builtin_size_of

eval fn <T> __builtin_size_of() -> usize

Returns sizeof T. Evaluated at compile time.

__builtin_align_of

eval fn <T> __builtin_align_of() -> usize

Returns alignof T. Evaluated at compile time.

__builtin_dynamic_size

inline fn <T> __builtin_dynamic_size(p: *T) -> usize

Returns the size of the object p points at, which may be a class derived from T: read through T's hidden virtual when T has a virtual destructor, sizeof T otherwise. The compiler writes the body.

Safety

Read it before the destructor runs, and only for a live object.

__builtin_dynamic_align

inline fn <T> __builtin_dynamic_align(p: *T) -> usize

Returns the alignment of the object p points at; see __builtin_dynamic_size.

Safety

Read it before the destructor runs, and only for a live object.

__builtin_is_same

eval fn <T, U> __builtin_is_same() -> bool

Returns true when T and U are the same type.

__builtin_is_void

eval fn <T> __builtin_is_void() -> bool

Returns true when T is void.

__builtin_is_pointer

eval fn <T> __builtin_is_pointer() -> bool

Returns true when T is a pointer, safe or unsafe alike; __builtin_is_safe_pointer tells them apart.

__builtin_is_array

eval fn <T> __builtin_is_array() -> bool

Returns true when T is an array type.

__builtin_is_function

eval fn <T> __builtin_is_function() -> bool

Returns true when T is a function type.

__builtin_is_enum

eval fn <T> __builtin_is_enum() -> bool

Returns true when T is a plain enum. An ADT enum is a C++ struct, so it answers false (__builtin_is_adt_enum).

__builtin_is_union

eval fn <T> __builtin_is_union() -> bool

Returns true when T is a union.

__builtin_is_integral

eval fn <T> __builtin_is_integral() -> bool

Returns true when T is an integer type.

__builtin_is_floating_point

eval fn <T> __builtin_is_floating_point() -> bool

Returns true when T is a floating-point type.

__builtin_is_signed

eval fn <T> __builtin_is_signed() -> bool

Returns true when T is a signed arithmetic type.

__builtin_is_unsigned

eval fn <T> __builtin_is_unsigned() -> bool

Returns true when T is an unsigned arithmetic type.

__builtin_is_trivially_copyable

eval fn <T> __builtin_is_trivially_copyable() -> bool

Returns true when T can be copied with __builtin_copy. Maps to __is_trivially_copyable.

__builtin_is_trivially_destructible

eval fn <T> __builtin_is_trivially_destructible() -> bool

Returns true when destroying a T runs no code. Maps to __is_trivially_destructible.

__builtin_is_trivially_constructible

eval fn <T, A> __builtin_is_trivially_constructible() -> bool

Returns true when a T can be trivially constructed from one A. Maps to __is_trivially_constructible(T, A).

Exactly one argument type: an imported template does not yet take a forwarded pack, so the no-argument form is __builtin_is_trivially_default_constructible.

__builtin_is_trivially_default_constructible

eval fn <T> __builtin_is_trivially_default_constructible() -> bool

Returns true when T() runs no code. Maps to __is_trivially_constructible(T).

__builtin_is_trivially_assignable

eval fn <T, U> __builtin_is_trivially_assignable() -> bool

Returns true when assigning a U to a T runs no non-trivial code. Maps to __is_trivially_assignable.

__builtin_is_trivially_relocatable

eval fn <T> __builtin_is_trivially_relocatable() -> bool

Returns true when a T can be moved by copying its bytes and skipping the old object's destructor. Maps to __builtin_is_cpp_trivially_relocatable.

__builtin_is_standard_layout

eval fn <T> __builtin_is_standard_layout() -> bool

Returns true when T has standard layout. Maps to __is_standard_layout.

__builtin_is_aggregate

eval fn <T> __builtin_is_aggregate() -> bool

Returns true when T is an aggregate. Maps to __is_aggregate.

__builtin_is_empty

eval fn <T> __builtin_is_empty() -> bool

Returns true when T is a class with no non-static data members. Maps to __is_empty.

__builtin_is_polymorphic

eval fn <T> __builtin_is_polymorphic() -> bool

Returns true when T has a virtual member. Maps to __is_polymorphic.

__builtin_is_abstract

eval fn <T> __builtin_is_abstract() -> bool

Returns true when T has a pure virtual member. Maps to __is_abstract.

__builtin_is_final

eval fn <T> __builtin_is_final() -> bool

Returns true when T is a final class. Maps to __is_final.

__builtin_has_virtual_destructor

eval fn <T> __builtin_has_virtual_destructor() -> bool

Returns true when T has a virtual destructor. Maps to __has_virtual_destructor.

__builtin_is_base_of

eval fn <B, D> __builtin_is_base_of() -> bool

Returns true when B is a base class of D. Maps to __is_base_of.

__builtin_is_convertible

eval fn <F, T> __builtin_is_convertible() -> bool

Returns true when F converts implicitly to T. Maps to __is_convertible.

__builtin_is_constructible

eval fn <T, A> __builtin_is_constructible() -> bool

Returns true when a T can be constructed from one A. Maps to __is_constructible(T, A).

Exactly one argument type; see __builtin_is_trivially_constructible.

__builtin_is_default_constructible

eval fn <T> __builtin_is_default_constructible() -> bool

Returns true when T() is well formed. Maps to __is_constructible(T).

__builtin_is_assignable

eval fn <T, U> __builtin_is_assignable() -> bool

Returns true when a U can be assigned to a T. Maps to __is_assignable.

__builtin_is_destructible

eval fn <T> __builtin_is_destructible() -> bool

Returns true when a T can be destroyed. Maps to __is_destructible.

__builtin_ctz

fn <T> __builtin_ctz(v: T) -> u32

Counts trailing zero bits of v, viewed as the unsigned type of T's width. ctz(0) is the bit width. Maps to __builtin_ctzg.

Plain fn, not eval fn, so it accepts run-time values; it is constexpr in C++, so constant arguments still fold.

__builtin_clz

fn <T> __builtin_clz(v: T) -> u32

Counts leading zero bits of v, viewed as the unsigned type of T's width. clz(0) is the bit width. Maps to __builtin_clzg.

__builtin_popcount

fn <T> __builtin_popcount(v: T) -> u32

Counts the set bits of v, viewed as the unsigned type of T's width. Maps to __builtin_popcountg.

__builtin_bswap

fn <T> __builtin_bswap(v: T) -> T

Reverses the byte order of v. A 1-byte T is returned unchanged. Maps to __builtin_bswap16 / 32 / 64.

__builtin_rotl

fn <T> __builtin_rotl(v: T, n: u32) -> T

Rotates v left by n bits; n is taken modulo the bit width of T.

__builtin_rotr

fn <T> __builtin_rotr(v: T, n: u32) -> T

Rotates v right by n bits; n is taken modulo the bit width of T.

__builtin_add_overflow

fn <T> __builtin_add_overflow(a: T, b: T, result: *T) -> bool

Computes a + b, stores the wrapped result in *result and returns true when the exact value did not fit in T. Maps to __builtin_add_overflow.

Parameters

  • result: Receives the wrapped value even when the call returns true.

__builtin_sub_overflow

fn <T> __builtin_sub_overflow(a: T, b: T, result: *T) -> bool

Computes a - b, stores the wrapped result in *result and returns true when the exact value did not fit in T. Maps to __builtin_sub_overflow.

Parameters

  • result: Receives the wrapped value even when the call returns true.

__builtin_mul_overflow

fn <T> __builtin_mul_overflow(a: T, b: T, result: *T) -> bool

Computes a * b, stores the wrapped result in *result and returns true when the exact value did not fit in T. Maps to __builtin_mul_overflow.

Parameters

  • result: Receives the wrapped value even when the call returns true.

__builtin_expect

inline fn __builtin_expect(cond: bool, expected: bool) -> bool

Returns cond, hinting that it is usually expected. Maps to __builtin_expect.

__builtin_expect_prob

inline fn __builtin_expect_prob(cond: bool, expected: bool, p: f64) -> bool

Returns cond, hinting its likely value from the probability p that it equals expected.

Only the direction of the hint is kept (p >= 0.5): clang takes an exact probability only as a literal, and p is a run-time value here. Maps to __builtin_expect.

__builtin_unreachable

inline fn __builtin_unreachable() -> !

Tells the optimizer that control never reaches this call. Maps to __builtin_unreachable.

Safety

Reaching it is undefined behaviour.

__builtin_trap

inline fn __builtin_trap() -> !

Aborts execution immediately with a trap instruction (ud2, brk, ...). Maps to __builtin_trap. Prints nothing and runs no handlers.

__builtin_debugtrap

inline fn __builtin_debugtrap()

Stops in an attached debugger and otherwise continues. Maps to __builtin_debugtrap.

__builtin_assume

inline fn __builtin_assume(cond: bool)

Tells the optimizer that cond is true at this point. Maps to __builtin_assume.

Safety

If cond is false the behaviour is undefined. cond is not evaluated for effects the program relies on.

__builtin_prefetch

inline fn __builtin_prefetch(ptr: unsafe *const u8, rw: i32 = 0, locality: i32 = 3)

Hints that the cache line holding ptr will be accessed soon. Maps to __builtin_prefetch; never faults, even for an invalid address.

Parameters

  • rw: 0 for a read (default), anything else for a write.
  • locality: 0 (no reuse) to 3 (keep in all cache levels, the default); other values are treated as 3.

__builtin_is_constant_evaluated

inline fn __builtin_is_constant_evaluated() -> bool

Returns true when evaluated during constant evaluation and false at run time. Maps to __builtin_is_constant_evaluated.

__builtin_constant_p

fn <T> __builtin_constant_p(v: T) -> bool

Returns true when the optimizer can fold v to a compile-time constant at this call. A false result proves nothing. Maps to __builtin_constant_p.

__builtin_crash

inline fn __builtin_crash(msg: *const u8, len: usize, exit_code: i32) -> !

Writes msg[0..len) and a newline to stderr, then terminates the process with exit_code via _Exit (no atexit handlers, no destructors). Never returns.

Parameters

  • exit_code: The process exit status.

Safety

msg must be valid for reads of len bytes.

__builtin_signal

inline fn __builtin_signal(msg: *const u8, len: usize, signal: SIGNAL) -> !

Writes msg[0..len) and a newline to stderr, then raises signal at its default action. Never returns.

Safety

msg must be valid for reads of len bytes.

__builtin_abort

inline fn __builtin_abort() -> !

Terminates the process abnormally. Maps to __builtin_abort; never returns.

__builtin_atomic_load

fn <T> __builtin_atomic_load(ptr: *const T, order: MemoryOrder) -> T

Atomically reads *ptr. Maps to __atomic_load_n.

Pass order as a constant so the inlined helper folds it; a run-time order compiles to a switch.

Parameters

  • order: Relaxed, Consume, Acquire or SeqCst.

__builtin_atomic_store

fn <T> __builtin_atomic_store(ptr: *T, v: T, order: MemoryOrder)

Atomically writes v to *ptr. Maps to __atomic_store_n.

Parameters

  • order: Relaxed, Release or SeqCst.

__builtin_atomic_exchange

fn <T> __builtin_atomic_exchange(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically replaces *ptr with v and returns the previous value. Maps to __atomic_exchange_n.

__builtin_atomic_cas

fn <T> __builtin_atomic_cas(
    ptr: *T,
    expected: *T,
    desired: T,
    weak: bool,
    succ: MemoryOrder,
    fail: MemoryOrder
) -> bool

Compare-and-swap: if *ptr == *expected, stores desired and returns true; otherwise copies *ptr into *expected and returns false. Maps to __atomic_compare_exchange_n.

Parameters

  • weak: A weak exchange may fail spuriously; use it in a retry loop.
  • succ: The order when the exchange happens.
  • fail: The order of the load when it does not; it may not be Release or AcqRel nor stronger than succ.

__builtin_atomic_fetch_add

fn <T> __builtin_atomic_fetch_add(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically applies + to *ptr with v and returns the value *ptr had before. Maps to __atomic_fetch_add.

__builtin_atomic_fetch_sub

fn <T> __builtin_atomic_fetch_sub(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically applies - to *ptr with v and returns the value *ptr had before. Maps to __atomic_fetch_sub.

__builtin_atomic_fetch_and

fn <T> __builtin_atomic_fetch_and(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically applies & to *ptr with v and returns the value *ptr had before. Maps to __atomic_fetch_and.

__builtin_atomic_fetch_or

fn <T> __builtin_atomic_fetch_or(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically applies | to *ptr with v and returns the value *ptr had before. Maps to __atomic_fetch_or.

__builtin_atomic_fetch_xor

fn <T> __builtin_atomic_fetch_xor(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically applies ^ to *ptr with v and returns the value *ptr had before. Maps to __atomic_fetch_xor.

__builtin_atomic_fetch_max

fn <T> __builtin_atomic_fetch_max(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically applies max to *ptr with v and returns the value *ptr had before. Maps to __atomic_fetch_max.

__builtin_atomic_fetch_min

fn <T> __builtin_atomic_fetch_min(ptr: *T, v: T, order: MemoryOrder) -> T

Atomically applies min to *ptr with v and returns the value *ptr had before. Maps to __atomic_fetch_min.

__builtin_atomic_fence

inline fn __builtin_atomic_fence(order: MemoryOrder)

A full memory fence with the given ordering. Maps to __atomic_thread_fence.

__builtin_atomic_signal_fence

inline fn __builtin_atomic_signal_fence(order: MemoryOrder)

A compiler-only fence with the given ordering, against a signal handler on the same thread; it emits no instruction. Maps to __atomic_signal_fence.

__builtin_atomic_is_lock_free

eval fn <T> __builtin_atomic_is_lock_free() -> bool

Returns true when atomic operations on a T are always lock-free. Maps to __atomic_always_lock_free(sizeof(T), 0).

TargetArch

enum TargetArch { Unknown, X86, X86_64, Arm, AArch64, RiscV32, RiscV64, Wasm32, Wasm64, PowerPC64, LoongArch64 }

The CPU architecture family of the compilation target.

TargetOS

enum TargetOS { Unknown, Linux, Windows, MacOS, IOS, FreeBSD, NetBSD, OpenBSD, Wasi, Emscripten, Android, Freestanding }

The operating system of the compilation target; Freestanding when none is detected.

TargetEnv

enum TargetEnv { Unknown, Gnu, Musl, Msvc, MinGW, Android, Eabi }

The ABI environment of the compilation target (libc / toolchain flavour). Unknown when the driver did not define one for the triple.

TargetInfo

struct TargetInfo

A description of the compilation target, from __builtin_target_info().

extend TargetInfo

extend TargetInfo

TargetInfo.is_linux

eval fn is_linux(const self) -> bool

Returns true for Linux.

TargetInfo.is_windows

eval fn is_windows(const self) -> bool

Returns true for Windows.

TargetInfo.is_macos

eval fn is_macos(const self) -> bool

Returns true for macOS.

TargetInfo.is_apple

eval fn is_apple(const self) -> bool

Returns true for macOS or iOS.

TargetInfo.is_bsd

eval fn is_bsd(const self) -> bool

Returns true for FreeBSD, NetBSD or OpenBSD.

TargetInfo.is_unix

eval fn is_unix(const self) -> bool

Returns true for Linux, Android, Apple and BSD targets.

TargetInfo.is_wasm

eval fn is_wasm(const self) -> bool

Returns true for wasm32 or wasm64.

TargetInfo.is_64bit

eval fn is_64bit(const self) -> bool

Returns true when pointers are 64 bits wide.

TargetInfo.is_musl

eval fn is_musl(const self) -> bool

Returns true when the environment is musl.

__builtin_target_info

eval fn __builtin_target_info() -> TargetInfo

Returns a TargetInfo for the compilation target. Evaluated at compile time from clang's predefined macros and __kairo_env_<env>__, which the driver defines from the triple (nothing else tells musl from glibc).

Generated from Kairo source, Apache-2.0 WITH AdditionRef-Kairo-Runtime-exception.