| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#ifndef _XFUNCPROTO_H_ |
| 30 |
#define _XFUNCPROTO_H_ |
| 31 |
|
| 32 |
#ifndef NeedFunctionPrototypes |
| 33 |
#define NeedFunctionPrototypes 1 |
| 34 |
#endif |
| 35 |
|
| 36 |
#ifndef NeedVarargsPrototypes |
| 37 |
#define NeedVarargsPrototypes 1 |
| 38 |
#endif |
| 39 |
|
| 40 |
#if NeedFunctionPrototypes |
| 41 |
|
| 42 |
#ifndef NeedNestedPrototypes |
| 43 |
#define NeedNestedPrototypes 1 |
| 44 |
#endif |
| 45 |
|
| 46 |
#ifndef _Xconst |
| 47 |
#define _Xconst const |
| 48 |
#endif |
| 49 |
|
| 50 |
|
| 51 |
#if !defined(NARROWPROTO) && \ |
| 52 |
(defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) |
| 53 |
#define NARROWPROTO |
| 54 |
#endif |
| 55 |
#ifndef FUNCPROTO |
| 56 |
#define FUNCPROTO 15 |
| 57 |
#endif |
| 58 |
|
| 59 |
#ifndef NeedWidePrototypes |
| 60 |
#ifdef NARROWPROTO |
| 61 |
#define NeedWidePrototypes 0 |
| 62 |
#else |
| 63 |
#define NeedWidePrototypes 1 |
| 64 |
#endif |
| 65 |
#endif |
| 66 |
|
| 67 |
#endif |
| 68 |
|
| 69 |
#ifndef _XFUNCPROTOBEGIN |
| 70 |
#if defined(__cplusplus) || defined(c_plusplus) |
| 71 |
#define _XFUNCPROTOBEGIN extern "C" { |
| 72 |
#define _XFUNCPROTOEND } |
| 73 |
#else |
| 74 |
#define _XFUNCPROTOBEGIN |
| 75 |
#define _XFUNCPROTOEND |
| 76 |
#endif |
| 77 |
#endif |
| 78 |
|
| 79 |
|
| 80 |
#ifndef __has_attribute |
| 81 |
# define __has_attribute(x) 0 |
| 82 |
#endif |
| 83 |
#ifndef __has_feature |
| 84 |
# define __has_feature(x) 0 |
| 85 |
#endif |
| 86 |
#ifndef __has_extension |
| 87 |
# define __has_extension(x) 0 |
| 88 |
#endif |
| 89 |
|
| 90 |
|
| 91 |
#if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4)) |
| 92 |
# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x))) |
| 93 |
#else |
| 94 |
# define _X_SENTINEL(x) |
| 95 |
#endif |
| 96 |
|
| 97 |
|
| 98 |
#if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \ |
| 99 |
&& !defined(__CYGWIN__) && !defined(__MINGW32__) |
| 100 |
# define _X_EXPORT __attribute__((visibility("default"))) |
| 101 |
# define _X_HIDDEN __attribute__((visibility("hidden"))) |
| 102 |
# define _X_INTERNAL __attribute__((visibility("internal"))) |
| 103 |
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) |
| 104 |
# define _X_EXPORT __global |
| 105 |
# define _X_HIDDEN __hidden |
| 106 |
# define _X_INTERNAL __hidden |
| 107 |
#else |
| 108 |
# define _X_EXPORT |
| 109 |
# define _X_HIDDEN |
| 110 |
# define _X_INTERNAL |
| 111 |
#endif |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) |
| 116 |
# define _X_LIKELY(x) __builtin_expect(!!(x), 1) |
| 117 |
# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0) |
| 118 |
#else |
| 119 |
# define _X_LIKELY(x) (x) |
| 120 |
# define _X_UNLIKELY(x) (x) |
| 121 |
#endif |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
#if __has_attribute(__cold__) || \ |
| 126 |
(defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) |
| 127 |
# define _X_COLD __attribute__((__cold__)) |
| 128 |
#else |
| 129 |
# define _X_COLD |
| 130 |
#endif |
| 131 |
|
| 132 |
|
| 133 |
#if __has_attribute(deprecated) \ |
| 134 |
|| (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \ |
| 135 |
|| (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130)) |
| 136 |
# define _X_DEPRECATED __attribute__((deprecated)) |
| 137 |
#else |
| 138 |
# define _X_DEPRECATED |
| 139 |
#endif |
| 140 |
|
| 141 |
|
| 142 |
#if __has_extension(attribute_deprecated_with_message) || \ |
| 143 |
(defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))) |
| 144 |
# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg))) |
| 145 |
#else |
| 146 |
# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED |
| 147 |
#endif |
| 148 |
|
| 149 |
|
| 150 |
#if __has_attribute(noreturn) \ |
| 151 |
|| (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \ |
| 152 |
|| (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) |
| 153 |
# define _X_NORETURN __attribute((noreturn)) |
| 154 |
#else |
| 155 |
# define _X_NORETURN |
| 156 |
#endif |
| 157 |
|
| 158 |
|
| 159 |
#if __has_attribute(__format__) \ |
| 160 |
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) |
| 161 |
# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) |
| 162 |
#else |
| 163 |
# define _X_ATTRIBUTE_PRINTF(x,y) |
| 164 |
#endif |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
#if __has_attribute(nonnull) \ |
| 170 |
&& defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) |
| 171 |
#define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) |
| 172 |
#elif __has_attribute(nonnull) \ |
| 173 |
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) |
| 174 |
#define _X_NONNULL(args...) __attribute__((nonnull(args))) |
| 175 |
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) |
| 176 |
#define _X_NONNULL(...) |
| 177 |
#endif |
| 178 |
|
| 179 |
|
| 180 |
#if __has_attribute(__unused__) \ |
| 181 |
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205) |
| 182 |
#define _X_UNUSED __attribute__((__unused__)) |
| 183 |
#else |
| 184 |
#define _X_UNUSED |
| 185 |
#endif |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
#if defined(inline) || \ |
| 191 |
(defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) || \ |
| 192 |
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)) |
| 193 |
# define _X_INLINE inline |
| 194 |
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) |
| 195 |
# define _X_INLINE __inline__ |
| 196 |
#else |
| 197 |
# define _X_INLINE |
| 198 |
#endif |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
#ifndef _X_RESTRICT_KYWD |
| 203 |
# if defined(restrict) || \ |
| 204 |
(defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) \ |
| 205 |
&& !defined(__cplusplus)) |
| 206 |
# define _X_RESTRICT_KYWD restrict |
| 207 |
# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) |
| 208 |
# define _X_RESTRICT_KYWD __restrict__ |
| 209 |
# else |
| 210 |
# define _X_RESTRICT_KYWD |
| 211 |
# endif |
| 212 |
#endif |
| 213 |
|
| 214 |
|
| 215 |
#if __has_attribute(no_sanitize_thread) |
| 216 |
# define _X_NOTSAN __attribute__((no_sanitize_thread)) |
| 217 |
#else |
| 218 |
# define _X_NOTSAN |
| 219 |
#endif |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
#if __has_attribute(nonstring) |
| 224 |
# define _X_NONSTRING __attribute__((nonstring)) |
| 225 |
#else |
| 226 |
# define _X_NONSTRING |
| 227 |
#endif |
| 228 |
|
| 229 |
#endif |