提交 b27c83f6 编写于 作者: D dota17 提交者: Jordan Bayles

Delete JSONCPP_DEPRECATED, use [[deprecated]] instead. (#978)

* delete JSONCPP_DEPRECATED, use [[deprecated]]

* add pragma warning(disable:4996)

* add error C2416

* update

* update

* update
上级 483eba84
......@@ -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
......
......@@ -25,6 +25,10 @@
#pragma pack(push, 8)
#if defined(_MSC_VER)
#pragma warning(disable : 4996)
#endif
namespace Json {
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> 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 <a HREF="http://www.json.org">JSON</a>
......@@ -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
......
......@@ -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.
......
......@@ -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:
/**
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册