Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions include/json/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions include/json/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@

#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
* Value.
*
* \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;
Expand All @@ -50,12 +54,10 @@ class JSON_API Reader {

/** \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>
Expand Down Expand Up @@ -108,7 +110,7 @@ class JSON_API Reader {
* 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
Expand Down
4 changes: 2 additions & 2 deletions include/json/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ class JSON_API Value {
//# 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);
}
Expand Down Expand Up @@ -750,7 +750,7 @@ class JSON_API ValueIteratorBase {
/// 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.
Expand Down
8 changes: 4 additions & 4 deletions include/json/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
/** \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();

Expand All @@ -165,7 +165,7 @@ class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer {
#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();
Expand Down Expand Up @@ -225,7 +225,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter
#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();
Expand Down Expand Up @@ -294,7 +294,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API
#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:
/**
Expand Down
4 changes: 2 additions & 2 deletions src/test_lib_json/jsontest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test_lib_json/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down