NAME
NO_SANITIZE_ALIGNMENT,
NO_SANITIZE_UNDEFINED,
NO_SANITIZE_SIGNED_INTEGER_OVERFLOW,
NO_SANITIZE_UNSIGNED_INTEGER_OVERFLOW,
FALLTHROUGH, UNUSED,
NDEBUG_UNUSED,
STATIC_ASSERT, UNSAFE_CAST,
countof —
compiler macros
SYNOPSIS
#include
<libks/compiler.h>
__attribute__((NO_SANITIZE_ALIGNMENT))
__attribute__((NO_SANITIZE_UNDEFINED))
__attribute__((NO_SANITIZE_SIGNED_INTEGER_OVERFLOW))
__attribute__((NO_SANITIZE_UNSIGNED_INTEGER_OVERFLOW))
FALLTHROUGH;
UNUSED(variable);
NDEBUG_UNUSED(variable);
STATIC_ASSERT(expression,
message);
UNSAFE_CAST(type,
variable);
countof(variable);
DESCRIPTION
The compiler macros can be used to instruct the compiler about certain properties of the source code.
The NO_SANITIZE_ALIGNMENT macro is
intended to be used as an __attribute__ argument applicable to functions,
instructing the compiler to omit the alignment sanitizer.
The NO_SANITIZE_UNDEFINED macro is
intended to be used as an __attribute__ argument applicable to functions,
instructing the compiler to omit the undefined behavior sanitizer.
The NO_SANITIZE_SIGNED_INTEGER_OVERFLOW
macro is intended to be used as an __attribute__ argument applicable to
functions, instructing the compiler to omit the signed integer overflow
sanitizer.
The NO_SANITIZE_UNSIGNED_INTEGER_OVERFLOW
macro is intended to be used as an __attribute__ argument applicable to
functions, instructing the compiler to omit the unsigned integer overflow
sanitizer.
The FALLTHROUGH macro annotates a switch
case as intentionally continuing execution to the next case.
The
UNUSED()
macro annotates variable as being unused.
The
NDEBUG_UNUSED()
macro annotates variable as being unused if
NDEBUG is defined.
The
STATIC_ASSERT()
macro ensures expression evalutes non-zero at compile
time.
The
UNSAFE_CAST()
macro is performs an unsafe cast, tricking the compiler to not emit a
warning nor error.
The
countof()
macro returns the number of elements in variable which
is required to be an array.
AUTHORS
Anton Lindqvist <anton@basename.se>