mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-21 15:30:58 +08:00
clang-tidy fixes again (#1155)
* [clang-tidy] remove redundant string initialization Found with readability-redundant-string-init Signed-off-by: Rosen Penev <rosenp@gmail.com> * [clang-tidy] switch to raw strings Easier to read. Found with modernize-raw-string-literal Signed-off-by: Rosen Penev <rosenp@gmail.com> * [clang-tidy] fix performance issues Found with performance* Signed-off-by: Rosen Penev <rosenp@gmail.com> * fix extra comma warnings Found with clang's -Wextra-semi-stmt Signed-off-by: Rosen Penev <rosenp@gmail.com> * remove JSONCPP_OP_EXPLICIT This codebase in C++11. No need for compatibility with C++98. Signed-off-by: Rosen Penev <rosenp@gmail.com> * remove JSONCPP_NOEXCEPT This codebase is C++11 now. No need for this macro. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@@ -21,19 +21,19 @@
|
||||
|
||||
// @todo <= add detail about condition in exception
|
||||
#define JSON_ASSERT(condition) \
|
||||
{ \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
Json::throwLogicError("assert json failed"); \
|
||||
} \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define JSON_FAIL_MESSAGE(message) \
|
||||
{ \
|
||||
do { \
|
||||
OStringStream oss; \
|
||||
oss << message; \
|
||||
Json::throwLogicError(oss.str()); \
|
||||
abort(); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#else // JSON_USE_EXCEPTION
|
||||
|
||||
@@ -52,8 +52,10 @@
|
||||
#endif
|
||||
|
||||
#define JSON_ASSERT_MESSAGE(condition, message) \
|
||||
if (!(condition)) { \
|
||||
JSON_FAIL_MESSAGE(message); \
|
||||
}
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
JSON_FAIL_MESSAGE(message); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif // JSON_ASSERTIONS_H_INCLUDED
|
||||
|
@@ -74,20 +74,6 @@ extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
|
||||
// C++11 should be used directly in JSONCPP.
|
||||
#define JSONCPP_OVERRIDE override
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#define JSONCPP_NOEXCEPT noexcept
|
||||
#define JSONCPP_OP_EXPLICIT explicit
|
||||
#elif defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define JSONCPP_NOEXCEPT throw()
|
||||
#define JSONCPP_OP_EXPLICIT explicit
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
#define JSONCPP_NOEXCEPT noexcept
|
||||
#define JSONCPP_OP_EXPLICIT explicit
|
||||
#else
|
||||
#define JSONCPP_NOEXCEPT throw()
|
||||
#define JSONCPP_OP_EXPLICIT
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#if __has_extension(attribute_deprecated_with_message)
|
||||
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||
|
@@ -67,8 +67,8 @@ namespace Json {
|
||||
class JSON_API Exception : public std::exception {
|
||||
public:
|
||||
Exception(String msg);
|
||||
~Exception() JSONCPP_NOEXCEPT override;
|
||||
char const* what() const JSONCPP_NOEXCEPT override;
|
||||
~Exception() noexcept override;
|
||||
char const* what() const noexcept override;
|
||||
|
||||
protected:
|
||||
String msg_;
|
||||
@@ -421,7 +421,7 @@ public:
|
||||
bool empty() const;
|
||||
|
||||
/// Return !isNull()
|
||||
JSONCPP_OP_EXPLICIT operator bool() const;
|
||||
explicit operator bool() const;
|
||||
|
||||
/// Remove all object members and array elements.
|
||||
/// \pre type() is arrayValue, objectValue, or nullValue
|
||||
|
Reference in New Issue
Block a user