Ruby 3.3.5p100 (2024-09-03 revision ef084cc8f4958c1b6e4ead99136631bef6d8ddba)
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 <stdarg.h>
14#include <stddef.h>
15#include <stdint.h>
16#include <stdio.h>
17#include <string.h>
18
24#ifndef PRISM_EXPORTED_FUNCTION
25# ifdef PRISM_EXPORT_SYMBOLS
26# ifdef _WIN32
27# define PRISM_EXPORTED_FUNCTION __declspec(dllexport) extern
28# else
29# define PRISM_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
30# endif
31# else
32# define PRISM_EXPORTED_FUNCTION
33# endif
34#endif
35
42#if defined(__GNUC__)
43# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index)))
44#elif defined(__clang__)
45# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((__format__(__printf__, string_index, argument_index)))
46#else
47# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index)
48#endif
49
55#if defined(__GNUC__)
56# define PRISM_ATTRIBUTE_UNUSED __attribute__((unused))
57#else
58# define PRISM_ATTRIBUTE_UNUSED
59#endif
60
65#if defined(_MSC_VER) && !defined(inline)
66# define inline __inline
67#endif
68
73#if !defined(snprintf) && defined(_MSC_VER) && (_MSC_VER < 1900)
74# define snprintf _snprintf
75#endif
76
81#define PM_CONCATENATE(left, right) left ## right
82
88#if defined(_Static_assert)
89# define PM_STATIC_ASSERT(line, condition, message) _Static_assert(condition, message)
90#else
91# define PM_STATIC_ASSERT(line, condition, message) typedef char PM_CONCATENATE(static_assert_, line)[(condition) ? 1 : -1]
92#endif
93
94#endif
Defines old _.