mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
\#964 Delete JSONCPP_NORETURN for [[noreturn]]
This patch removes the custom JSONCPP_NORETURN macro in favor of the C++11 standard [[noreturn]] attribute.
This commit is contained in:
parent
60ba071aac
commit
9ef812a097
@ -24,19 +24,6 @@
|
|||||||
#include <cpptl/forwards.h>
|
#include <cpptl/forwards.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Conditional NORETURN attribute on the throw functions would:
|
|
||||||
// a) suppress false positives from static code analysis
|
|
||||||
// b) possibly improve optimization opportunities.
|
|
||||||
#if !defined(JSONCPP_NORETURN)
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define JSONCPP_NORETURN __declspec(noreturn)
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#define JSONCPP_NORETURN __attribute__((__noreturn__))
|
|
||||||
#else
|
|
||||||
#define JSONCPP_NORETURN
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
||||||
// be used by...
|
// be used by...
|
||||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
@ -89,9 +76,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// used internally
|
/// used internally
|
||||||
JSONCPP_NORETURN void throwRuntimeError(String const& msg);
|
[[noreturn]] void throwRuntimeError(String const& msg);
|
||||||
/// used internally
|
/// used internally
|
||||||
JSONCPP_NORETURN void throwLogicError(String const& msg);
|
[[noreturn]] void throwLogicError(String const& msg);
|
||||||
|
|
||||||
/** \brief Type of the value held by a Value object.
|
/** \brief Type of the value held by a Value object.
|
||||||
*/
|
*/
|
||||||
|
@ -232,15 +232,15 @@ Exception::~Exception() JSONCPP_NOEXCEPT {}
|
|||||||
char const* Exception::what() const JSONCPP_NOEXCEPT { return msg_.c_str(); }
|
char const* Exception::what() const JSONCPP_NOEXCEPT { return msg_.c_str(); }
|
||||||
RuntimeError::RuntimeError(String const& msg) : Exception(msg) {}
|
RuntimeError::RuntimeError(String const& msg) : Exception(msg) {}
|
||||||
LogicError::LogicError(String const& msg) : Exception(msg) {}
|
LogicError::LogicError(String const& msg) : Exception(msg) {}
|
||||||
JSONCPP_NORETURN void throwRuntimeError(String const& msg) {
|
[[noreturn]] void throwRuntimeError(String const& msg) {
|
||||||
throw RuntimeError(msg);
|
throw RuntimeError(msg);
|
||||||
}
|
}
|
||||||
JSONCPP_NORETURN void throwLogicError(String const& msg) {
|
[[noreturn]] void throwLogicError(String const& msg) {
|
||||||
throw LogicError(msg);
|
throw LogicError(msg);
|
||||||
}
|
}
|
||||||
#else // !JSON_USE_EXCEPTION
|
#else // !JSON_USE_EXCEPTION
|
||||||
JSONCPP_NORETURN void throwRuntimeError(String const& msg) { abort(); }
|
[[noreturn]] void throwRuntimeError(String const& msg) { abort(); }
|
||||||
JSONCPP_NORETURN void throwLogicError(String const& msg) { abort(); }
|
[[noreturn]] void throwLogicError(String const& msg) { abort(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user