From 871b311e7e8d2fe2bbdcc78ee04d8070349c048f Mon Sep 17 00:00:00 2001 From: Dani-Hub Date: Sun, 8 Mar 2015 01:19:08 +0100 Subject: [PATCH 1/2] Provide JSONCPP_DEPRECATED definitions for clang and gcc --- include/json/config.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/json/config.h b/include/json/config.h index f14aaa8..5a2558d 100644 --- a/include/json/config.h +++ b/include/json/config.h @@ -70,6 +70,11 @@ #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 /// Indicates that the following function is deprecated. #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) +#elif (defined(__clang__) && __has_attribute(deprecated)) || \ + (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) +#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) #endif #if !defined(JSONCPP_DEPRECATED) From 5003983029ac29693265e5d60566e28cf3847fea Mon Sep 17 00:00:00 2001 From: Dani-Hub Date: Sun, 8 Mar 2015 18:48:24 +0100 Subject: [PATCH 2/2] Make preprocessor query robust against older gcc versions --- include/json/config.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/json/config.h b/include/json/config.h index 5a2558d..0dcd8ae 100644 --- a/include/json/config.h +++ b/include/json/config.h @@ -70,8 +70,11 @@ #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 /// Indicates that the following function is deprecated. #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) -#elif (defined(__clang__) && __has_attribute(deprecated)) || \ - (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) +#elif defined(__clang__) && defined(__has_feature) +#if __has_feature(attribute_deprecated_with_message) +#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +#endif +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) #define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) #elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))