#ifndef JSON_GNU_C_HEADER #define JSON_GUN_C_HEADER #ifdef __GNUC__ #if defined(JSON_INT_TYPE) #if (JSON_INT_TYPE == long long) && defined(JSON_ISO_STRICT) #error, JSON_INT_TYPE cant be a long long unless JSON_ISO_STRICT is off #endif #endif #define json_deprecated(method, warning) method __attribute__((deprecated)) #if (__GNUC__ >= 3) #define JSON_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #else #define JSON_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) #endif #if (JSON_GCC_VERSION >= 40300) #define json_hot __attribute__ ((hot)) #define json_cold __attribute__ ((cold)) #define json_pure json_nothrow __attribute__ ((pure, hot)) #define json_malloc_attr json_nothrow __attribute__ ((malloc, hot)) /* Can do priorities */ #if (JSON_WRITE_PRIORITY == HIGH) #define json_write_priority __attribute__ ((hot)) #elif (JSON_WRITE_PRIORITY == LOW) #define json_write_priority __attribute__ ((cold)) #else #define json_write_priority #endif #if (JSON_READ_PRIORITY == HIGH) #define json_read_priority __attribute__ ((hot)) #elif (JSON_READ_PRIORITY == LOW) #define json_read_priority __attribute__ ((cold)) #else #define json_read_priority #endif #define json_likely(x) __builtin_expect((long)((bool)(x)),1) #define json_unlikely(x) __builtin_expect((long)((bool)(x)),0) #else #if (JSON_GCC_VERSION >= 29600) #define json_pure json_nothrow __attribute__ ((pure)) #define json_likely(x) __builtin_expect((long)((bool)(x)),1) #define json_unlikely(x) __builtin_expect((long)((bool)(x)),0) #else #define json_pure json_nothrow #define json_likely(x) x #define json_unlikely(x) x #endif #define json_malloc_attr json_nothrow __attribute__ ((malloc)) #define json_write_priority #define json_read_priority #define json_hot #define json_cold #endif #define json_nothrow throw() // I disabled all throw(x) statements to avoid a new warning. // The internet says the old throw(x) idea was bad and didn't do anything good. // Warning: this could make code operate differently. If the JSON code threw an unexpected exception, it would bubble up like a normal exception. It might get caught and silently thrown away. :( // ./Visual_C.h Does this same trick. It disables the throw(x). So it's like we're turning off assertions. No guarantee that nothing will change, but not an unexpected thing to do, either. // This is a 3rd party library which hasn't been updated in years. // // About the warning: // https://stackoverflow.com/questions/13841559/deprecated-throw-list-in-c11 // // Alternative ways to get rid of a warning: // https://stackoverflow.com/questions/13459602/how-can-i-get-rid-of-deprecated-warnings-in-deprecated-functions-in-gcc // //#define json_throws(x) throw(x) #define json_throws(x) #ifdef JSON_LESS_MEMORY #define PACKED(x) :x __attribute__ ((packed)) #define BITS(x) :x #endif #endif #endif