diff --git a/include/json/config.h b/include/json/config.h index 2f70522..6426c3b 100644 --- a/include/json/config.h +++ b/include/json/config.h @@ -104,25 +104,6 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...); #define JSONCPP_OP_EXPLICIT #endif -#ifdef __clang__ -#if __has_extension(attribute_deprecated_with_message) -#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) -#endif -#elif defined(__GNUC__) // not clang (gcc comes later since clang emulates gcc) -#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) -#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) -#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) -#endif // GNUC version -#elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates - // MSVC) -#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) -#endif // __clang__ || __GNUC__ || _MSC_VER - -#if !defined(JSONCPP_DEPRECATED) -#define JSONCPP_DEPRECATED(message) -#endif // if !defined(JSONCPP_DEPRECATED) - #if defined(__GNUC__) && (__GNUC__ >= 6) #define JSON_USE_INT64_DOUBLE_CONVERSION 1 #endif diff --git a/include/json/reader.h b/include/json/reader.h index ce216a3..f8158cf 100644 --- a/include/json/reader.h +++ b/include/json/reader.h @@ -25,6 +25,10 @@ #pragma pack(push, 8) +#if defined(_MSC_VER) +#pragma warning(disable : 4996) +#endif + namespace Json { /** \brief Unserialize a JSON document into a @@ -32,7 +36,7 @@ namespace Json { * * \deprecated Use CharReader and CharReaderBuilder. */ -class JSON_API Reader { +class [[deprecated("deprecated Use CharReader and CharReaderBuilder.")]] JSON_API Reader { public: typedef char Char; typedef const Char* Location; @@ -50,12 +54,10 @@ public: /** \brief Constructs a Reader allowing all features for parsing. */ - JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead") Reader(); /** \brief Constructs a Reader allowing the specified feature set for parsing. */ - JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead") Reader(const Features& features); /** \brief Read a Value from a JSON @@ -108,7 +110,7 @@ public: * occurred during parsing. * \deprecated Use getFormattedErrorMessages() instead (typo fix). */ - JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.") + [[deprecated("Use getFormattedErrorMessages() instead.")]] String getFormatedErrorMessages() const; /** \brief Returns a user friendly string that list errors in the parsed diff --git a/include/json/value.h b/include/json/value.h index 30ce89f..a478848 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -564,7 +564,7 @@ public: //# endif /// \deprecated Always pass len. - JSONCPP_DEPRECATED("Use setComment(String const&) instead.") + [[deprecated("Use setComment(String const&) instead.")]] void setComment(const char* comment, CommentPlacement placement) { setComment(String(comment, strlen(comment)), placement); } @@ -750,7 +750,7 @@ public: /// objectValue. /// \deprecated This cannot be used for UTF-8 strings, since there can be /// embedded nulls. - JSONCPP_DEPRECATED("Use `key = name();` instead.") + [[deprecated("Use `key = name();` instead.")]] char const* memberName() const; /// Return the member name of the referenced Value, or NULL if it is not an /// objectValue. diff --git a/include/json/writer.h b/include/json/writer.h index 12fd36a..3280141 100644 --- a/include/json/writer.h +++ b/include/json/writer.h @@ -145,7 +145,7 @@ public: /** \brief Abstract class for writers. * \deprecated Use StreamWriter. (And really, this is an implementation detail.) */ -class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer { +class [[deprecated("Use StreamWriter instead")]] JSON_API Writer { public: virtual ~Writer(); @@ -165,7 +165,7 @@ public: #pragma warning(push) #pragma warning(disable : 4996) // Deriving from deprecated class #endif -class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter +class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API FastWriter : public Writer { public: FastWriter(); @@ -225,7 +225,7 @@ private: #pragma warning(push) #pragma warning(disable : 4996) // Deriving from deprecated class #endif -class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API +class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API StyledWriter : public Writer { public: StyledWriter(); @@ -294,7 +294,7 @@ private: #pragma warning(push) #pragma warning(disable : 4996) // Deriving from deprecated class #endif -class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API +class [[deprecated("Use StreamWriterBuilder instead")]] JSON_API StyledStreamWriter { public: /** diff --git a/src/test_lib_json/jsontest.cpp b/src/test_lib_json/jsontest.cpp index c0b5296..4c59d07 100644 --- a/src/test_lib_json/jsontest.cpp +++ b/src/test_lib_json/jsontest.cpp @@ -378,8 +378,8 @@ void Runner::preventDialogOnCrash() { _CrtSetReportHook(&msvcrtSilentReportHook); #endif // if defined(_MSC_VER) - // @todo investigate this handler (for buffer overflow) - // _set_security_error_handler +// @todo investigate this handler (for buffer overflow) +// _set_security_error_handler #if defined(_WIN32) // Prevents the system from popping a dialog for debugging if the diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp index fcda60e..e700c38 100644 --- a/src/test_lib_json/main.cpp +++ b/src/test_lib_json/main.cpp @@ -2522,7 +2522,7 @@ JSONTEST_FIXTURE(IteratorTest, const) { Json::Value const v; JSONTEST_ASSERT_THROWS( Json::Value::iterator it(v.begin()) // Compile, but throw. - ); + ); Json::Value value;