File tree 2 files changed +6
-19
lines changed 2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change 24
24
#include < cpptl/forwards.h>
25
25
#endif
26
26
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
-
40
27
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
41
28
// be used by...
42
29
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
@@ -89,9 +76,9 @@ class JSON_API LogicError : public Exception {
89
76
#endif
90
77
91
78
// / used internally
92
- JSONCPP_NORETURN void throwRuntimeError (String const & msg);
79
+ [[noreturn]] void throwRuntimeError (String const & msg);
93
80
// / used internally
94
- JSONCPP_NORETURN void throwLogicError (String const & msg);
81
+ [[noreturn]] void throwLogicError (String const & msg);
95
82
96
83
/* * \brief Type of the value held by a Value object.
97
84
*/
Original file line number Diff line number Diff line change @@ -232,15 +232,15 @@ Exception::~Exception() JSONCPP_NOEXCEPT {}
232
232
char const * Exception::what () const JSONCPP_NOEXCEPT { return msg_.c_str (); }
233
233
RuntimeError::RuntimeError (String const & msg) : Exception(msg) {}
234
234
LogicError::LogicError (String const & msg) : Exception(msg) {}
235
- JSONCPP_NORETURN void throwRuntimeError (String const & msg) {
235
+ [[noreturn]] void throwRuntimeError (String const & msg) {
236
236
throw RuntimeError (msg);
237
237
}
238
- JSONCPP_NORETURN void throwLogicError (String const & msg) {
238
+ [[noreturn]] void throwLogicError (String const & msg) {
239
239
throw LogicError (msg);
240
240
}
241
241
#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 (); }
244
244
#endif
245
245
246
246
// //////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments