Go to the documentation of this file.
9 #ifndef PRISM_DEFINES_H
10 #define PRISM_DEFINES_H
25 #define __STDC_FORMAT_MACROS
33 #ifndef PRISM_DEPTH_MAXIMUM
34 #define PRISM_DEPTH_MAXIMUM 1000
42 #ifndef PRISM_EXPORTED_FUNCTION
43 # ifdef PRISM_EXPORT_SYMBOLS
45 # define PRISM_EXPORTED_FUNCTION __declspec(dllexport) extern
47 # define PRISM_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
50 # define PRISM_EXPORTED_FUNCTION
61 # if defined(__MINGW_PRINTF_FORMAT)
62 # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(__MINGW_PRINTF_FORMAT, string_index, argument_index)))
64 # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index)))
66 #elif defined(__clang__)
67 # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((__format__(__printf__, string_index, argument_index)))
69 # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index)
78 # define PRISM_ATTRIBUTE_UNUSED __attribute__((unused))
80 # define PRISM_ATTRIBUTE_UNUSED
87 #if defined(_MSC_VER) && !defined(inline)
88 # define inline __inline
95 #if !defined(snprintf) && defined(_MSC_VER) && (_MSC_VER < 1900)
96 # define snprintf _snprintf
103 #define PM_CONCATENATE(left, right) left ## right
110 #if defined(_Static_assert)
111 # define PM_STATIC_ASSERT(line, condition, message) _Static_assert(condition, message)
113 # define PM_STATIC_ASSERT(line, condition, message) typedef char PM_CONCATENATE(static_assert_, line)[(condition) ? 1 : -1]
122 # define PRISM_HAS_MMAP
125 # ifdef _POSIX_MAPPED_FILES
126 # define PRISM_HAS_MMAP
135 #ifndef PRISM_HAS_NO_FILESYSTEM
136 # define PRISM_HAS_FILESYSTEM
147 # define isinf(x) (sizeof(x) == sizeof(float) ? !_finitef(x) : !_finite(x))
167 #ifdef PRISM_XALLOCATOR
168 #include "prism_xallocator.h"
175 #define xmalloc malloc
183 #define xrealloc realloc
191 #define xcalloc calloc
207 #ifdef PRISM_BUILD_MINIMAL
209 #define PRISM_EXCLUDE_SERIALIZATION
212 #define PRISM_EXCLUDE_JSON
215 #define PRISM_EXCLUDE_PACK
218 #define PRISM_EXCLUDE_PRETTYPRINT
221 #define PRISM_ENCODING_EXCLUDE_FULL
228 #if defined(__GNUC__) || defined(__clang__)
230 #define PRISM_LIKELY(x) __builtin_expect(!!(x), 1)
233 #define PRISM_UNLIKELY(x) __builtin_expect(!!(x), 0)
236 #define PRISM_LIKELY(x) (x)
239 #define PRISM_UNLIKELY(x) (x)