1 #ifndef JSON_GNU_C_HEADER
2 #define JSON_GNU_C_HEADER
6 #define json_deprecated(method, warning) method __attribute__((deprecated))
9 #define JSON_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
11 #define JSON_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
14 #if (JSON_GCC_VERSION >= 40300)
15 #define json_hot __attribute__ ((hot))
16 #define json_cold __attribute__ ((cold))
17 #define json_pure json_nothrow __attribute__ ((pure, hot))
18 #define json_malloc_attr json_nothrow __attribute__ ((malloc, hot))
21 #if (JSON_WRITE_PRIORITY == HIGH)
22 #define json_write_priority __attribute__ ((hot))
23 #elif (JSON_WRITE_PRIORITY == LOW)
24 #define json_write_priority __attribute__ ((cold))
26 #define json_write_priority
29 #if (JSON_READ_PRIORITY == HIGH)
30 #define json_read_priority __attribute__ ((hot))
31 #elif (JSON_READ_PRIORITY == LOW)
32 #define json_read_priority __attribute__ ((cold))
34 #define json_read_priority
37 #define json_likely(x) __builtin_expect((long)((bool)(x)),1)
38 #define json_unlikely(x) __builtin_expect((long)((bool)(x)),0)
40 #if (JSON_GCC_VERSION >= 29600)
41 #define json_pure json_nothrow __attribute__ ((pure))
42 #define json_likely(x) __builtin_expect((long)((bool)(x)),1)
43 #define json_unlikely(x) __builtin_expect((long)((bool)(x)),0)
45 #define json_pure json_nothrow
46 #define json_likely(x) x
47 #define json_unlikely(x) x
50 #define json_malloc_attr json_nothrow __attribute__ ((malloc))
51 #define json_write_priority
52 #define json_read_priority
57 #define json_nothrow throw()
58 #define json_throws(x) throw(x)
60 #ifdef JSON_LESS_MEMORY
61 #define PACKED(x) :x __attribute__ ((packed))