File tree Expand file tree Collapse file tree 2 files changed +6
-19
lines changed
Expand file tree Collapse file tree 2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change 2424#include < cpptl/forwards.h>
2525#endif
2626
27- // Conditional NORETURN attribute on the throw functions would:
28- // a) suppress false positives from static code analysis
29- // b) possibly improve optimization opportunities.
30- #if !defined(JSONCPP_NORETURN)
31- #if defined(_MSC_VER)
32- #define JSONCPP_NORETURN __declspec (noreturn)
33- #elif defined(__GNUC__)
34- #define JSONCPP_NORETURN __attribute__ ((__noreturn__))
35- #else
36- #define JSONCPP_NORETURN
37- #endif
38- #endif
39-
4027// Disable warning C4251: <data member>: <type> needs to have dll-interface to
4128// be used by...
4229#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
@@ -89,9 +76,9 @@ class JSON_API LogicError : public Exception {
8976#endif
9077
9178// / used internally
92- JSONCPP_NORETURN void throwRuntimeError (String const & msg);
79+ [[noreturn]] void throwRuntimeError (String const & msg);
9380// / used internally
94- JSONCPP_NORETURN void throwLogicError (String const & msg);
81+ [[noreturn]] void throwLogicError (String const & msg);
9582
9683/* * \brief Type of the value held by a Value object.
9784 */
Original file line number Diff line number Diff line change @@ -232,15 +232,15 @@ Exception::~Exception() JSONCPP_NOEXCEPT {}
232232char const * Exception::what () const JSONCPP_NOEXCEPT { return msg_.c_str (); }
233233RuntimeError::RuntimeError (String const & msg) : Exception(msg) {}
234234LogicError::LogicError (String const & msg) : Exception(msg) {}
235- JSONCPP_NORETURN void throwRuntimeError (String const & msg) {
235+ [[noreturn]] void throwRuntimeError (String const & msg) {
236236 throw RuntimeError (msg);
237237}
238- JSONCPP_NORETURN void throwLogicError (String const & msg) {
238+ [[noreturn]] void throwLogicError (String const & msg) {
239239 throw LogicError (msg);
240240}
241241#else // !JSON_USE_EXCEPTION
242- JSONCPP_NORETURN void throwRuntimeError (String const & msg) { abort (); }
243- JSONCPP_NORETURN void throwLogicError (String const & msg) { abort (); }
242+ [[noreturn]] void throwRuntimeError (String const & msg) { abort (); }
243+ [[noreturn]] void throwLogicError (String const & msg) { abort (); }
244244#endif
245245
246246// //////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments