Ruby 3.3.5p100 (2024-09-03 revision ef084cc8f4958c1b6e4ead99136631bef6d8ddba)
|
Macro definitions used throughout the prism library. More...
#include <ctype.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | PRISM_EXPORTED_FUNCTION |
By default, we compile with -fvisibility=hidden. | |
#define | PRISM_ATTRIBUTE_FORMAT(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 | PM_CONCATENATE(left, right) |
Old Visual Studio versions before 2015 do not implement sprintf, but instead implement _snprintf. | |
#define | PM_STATIC_ASSERT(line, condition, message) |
We want to be able to use static assertions, but they weren't standardized until C11. | |
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 inline __inline |
#define PM_CONCATENATE | ( | left, | |
right ) |
#define PM_STATIC_ASSERT | ( | line, | |
condition, | |||
message ) |
We want to be able to use static assertions, but they weren't standardized until C11.
As such, we polyfill it here by making a hacky typedef that will fail to compile due to a negative array size if the condition is false.
#define PRISM_ATTRIBUTE_FORMAT | ( | 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.
This macro does that in a compiler-agnostic way.
#define PRISM_ATTRIBUTE_UNUSED __attribute__((unused)) |