Ruby
3.4.1p0 (2024-12-25 revision 48d4efcb85000e1ebae42004e963b5d0cedddcf2)
prism
defines.h
Go to the documentation of this file.
1
9
#ifndef PRISM_DEFINES_H
10
#define PRISM_DEFINES_H
11
12
#include <ctype.h>
13
#include <limits.h>
14
#include <math.h>
15
#include <
stdarg.h
>
16
#include <stddef.h>
17
#include <stdint.h>
18
#include <stdio.h>
19
#include <string.h>
20
25
#define __STDC_FORMAT_MACROS
26
#include <inttypes.h>
27
33
#ifndef PRISM_DEPTH_MAXIMUM
34
#define PRISM_DEPTH_MAXIMUM 1000
35
#endif
36
42
#ifndef PRISM_EXPORTED_FUNCTION
43
# ifdef PRISM_EXPORT_SYMBOLS
44
# ifdef _WIN32
45
# define PRISM_EXPORTED_FUNCTION __declspec(dllexport) extern
46
# else
47
# define PRISM_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
48
# endif
49
# else
50
# define PRISM_EXPORTED_FUNCTION
51
# endif
52
#endif
53
60
#if defined(__GNUC__)
61
# if defined(__MINGW_PRINTF_FORMAT)
62
# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(__MINGW_PRINTF_FORMAT, string_index, argument_index)))
63
# else
64
# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index)))
65
# endif
66
#elif defined(__clang__)
67
# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((__format__(__printf__, string_index, argument_index)))
68
#else
69
# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index)
70
#endif
71
77
#if defined(__GNUC__)
78
# define PRISM_ATTRIBUTE_UNUSED __attribute__((unused))
79
#else
80
# define PRISM_ATTRIBUTE_UNUSED
81
#endif
82
87
#if defined(_MSC_VER) && !defined(inline)
88
# define inline __inline
89
#endif
90
95
#if !defined(snprintf) && defined(_MSC_VER) && (_MSC_VER < 1900)
96
# define snprintf _snprintf
97
#endif
98
103
#define PM_CONCATENATE(left, right) left ## right
104
110
#if defined(_Static_assert)
111
# define PM_STATIC_ASSERT(line, condition, message) _Static_assert(condition, message)
112
#else
113
# define PM_STATIC_ASSERT(line, condition, message) typedef char PM_CONCATENATE(static_assert_, line)[(condition) ? 1 : -1]
114
#endif
115
121
#ifdef _WIN32
122
# define PRISM_HAS_MMAP
123
#else
124
# include <unistd.h>
125
# ifdef _POSIX_MAPPED_FILES
126
# define PRISM_HAS_MMAP
127
# endif
128
#endif
129
135
#ifndef PRISM_HAS_NO_FILESYSTEM
136
# define PRISM_HAS_FILESYSTEM
137
#endif
138
144
#ifdef __MINGW64__
145
#include <float.h>
146
#define PRISM_ISINF(x) (!_finite(x))
147
#else
148
#define PRISM_ISINF(x) isinf(x)
149
#endif
150
168
#ifdef PRISM_XALLOCATOR
169
#include "prism_xallocator.h"
170
#else
171
#ifndef xmalloc
176
#define xmalloc malloc
177
#endif
178
179
#ifndef xrealloc
184
#define xrealloc realloc
185
#endif
186
187
#ifndef xcalloc
192
#define xcalloc calloc
193
#endif
194
195
#ifndef xfree
200
#define xfree free
201
#endif
202
#endif
203
208
#ifdef PRISM_BUILD_MINIMAL
210
#define PRISM_EXCLUDE_SERIALIZATION
211
213
#define PRISM_EXCLUDE_JSON
214
216
#define PRISM_EXCLUDE_PACK
217
219
#define PRISM_EXCLUDE_PRETTYPRINT
220
222
#define PRISM_ENCODING_EXCLUDE_FULL
223
#endif
224
229
#if defined(__GNUC__) || defined(__clang__)
231
#define PRISM_LIKELY(x) __builtin_expect(!!(x), 1)
232
234
#define PRISM_UNLIKELY(x) __builtin_expect(!!(x), 0)
235
#else
237
#define PRISM_LIKELY(x) (x)
238
240
#define PRISM_UNLIKELY(x) (x)
241
#endif
242
243
#endif
stdarg.h
Defines old _.
Generated by
1.13.2