|
| #define | __STDC_FORMAT_MACROS |
| | We want to be able to use the PRI* macros for printing out integers, but on some platforms they aren't included unless this is already defined.
|
| |
| #define | PRISM_DEPTH_MAXIMUM 10000 |
| | When we are parsing using recursive descent, we want to protect against malicious payloads that could attempt to crash our parser.
|
| |
| #define | PRISM_EXPORTED_FUNCTION |
| | By default, we compile with -fvisibility=hidden.
|
| |
| #define | PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index))) |
| | Certain compilers support specifying that a function accepts variadic parameters that look like printf format strings to provide a better developer experience when someone is using the function.
|
| |
| #define | PRISM_ATTRIBUTE_UNUSED __attribute__((unused)) |
| | GCC will warn if you specify a function or parameter that is unused at runtime.
|
| |
| #define | inline __inline |
| | Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
|
| |
| #define | PRISM_FORCE_INLINE __forceinline |
| | Force a function to be inlined at every call site.
|
| |
| #define | PM_CONCATENATE(left, right) left ## right |
| | Old Visual Studio versions before 2015 do not implement sprintf, but instead implement _snprintf.
|
| |
| #define | PM_STATIC_ASSERT(line, condition, message) typedef char PM_CONCATENATE(static_assert_, line)[(condition) ? 1 : -1] |
| | We want to be able to use static assertions, but they weren't standardized until C11.
|
| |
| #define | PRISM_HAS_FILESYSTEM |
| | In general, libc for embedded systems does not support memory-mapped files.
|
| |
| #define | PRISM_ISINF(x) isinf(x) |
| | isinf on POSIX systems it accepts a float, a double, or a long double.
|
| |
| #define | xmalloc malloc |
| | If you build prism with a custom allocator, configure it with "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc, xrealloc, xcalloc, and xfree.
|
| |
| #define | xrealloc realloc |
| | The realloc function that should be used.
|
| |
| #define | xcalloc calloc |
| | The calloc function that should be used.
|
| |
| #define | xfree free |
| | The free function that should be used.
|
| |
| #define | xfree_sized(p, s) xfree(((void)(s), (p))) |
| | The free_sized function that should be used.
|
| |
| #define | xrealloc_sized(p, ns, os) xrealloc((p), ((void)(os), (ns))) |
| | The xrealloc_sized function that should be used.
|
| |
| #define | PRISM_LIKELY(x) __builtin_expect(!!(x), 1) |
| | If PRISM_BUILD_MINIMAL is defined, then we're going to define every possible switch that will turn off certain features of prism.
|
| |
| #define | PRISM_UNLIKELY(x) __builtin_expect(!!(x), 0) |
| | The compiler should predicate that this branch will not be taken.
|
| |
| #define | pm_ctzll(v) ((unsigned) __builtin_ctzll(v)) |
| | Platform detection for SIMD / fast-path implementations.
|
| |
| #define | PRISM_FALLTHROUGH __attribute__((fallthrough)); |
| | We use -Wimplicit-fallthrough to guard potentially unintended fall-through between cases of a switch.
|
| |
| #define | PM_FLEX_ARY_LEN /* data[] */ |
| | A macro for defining a flexible array member.
|
| |
| #define | PRISM_ALIGNAS _Alignas |
| | We need to align nodes in the AST to a pointer boundary so that it can be safely cast to different node types.
|
| |
| #define | PRISM_ALIGNOF _Alignof |
| | Get the alignment requirement of a type.
|
| |
Macro definitions used throughout the prism library.
This file should be included first by any *.h or *.c in prism for consistency and to ensure that the macros are defined before they are used.
Definition in file defines.h.
| #define pm_ctzll |
( |
|
v | ) |
((unsigned) __builtin_ctzll(v)) |
Platform detection for SIMD / fast-path implementations.
At most one of these macros is defined, selecting the best available vectorization strategy. Count trailing zero bits in a 64-bit value. Used by SWAR identifier scanning to find the first non-matching byte in a word.
Precondition: v must be nonzero. The result is undefined when v == 0 (matching the behavior of __builtin_ctzll and _BitScanForward64).
Definition at line 299 of file defines.h.
If you build prism with a custom allocator, configure it with "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc, xrealloc, xcalloc, and xfree.
For example, your prism_xallocator.h file could look like this:
#ifndef PRISM_XALLOCATOR_H
#define PRISM_XALLOCATOR_H
#define xmalloc my_malloc
#define xrealloc my_realloc
#define xcalloc my_calloc
#define xfree my_free
#define xrealloc_sized my_realloc_sized
#define xfree_sized my_free_sized
#endif
The malloc function that should be used. This can be overridden with the PRISM_XALLOCATOR define.
Definition at line 193 of file defines.h.