File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 22
22
#include < cpptl/forwards.h>
23
23
#endif
24
24
25
+ // Conditional NORETURN attribute on the throw functions would:
26
+ // a) suppress false positives from static code analysis
27
+ // b) possibly improve optimization opportunities.
28
+ #if !defined(JSONCPP_NORETURN)
29
+ # if defined(_MSC_VER)
30
+ # define JSONCPP_NORETURN __declspec (noreturn)
31
+ # elif defined(__GNUC__)
32
+ # define JSONCPP_NORETURN __attribute__ ((__noreturn__))
33
+ # else
34
+ # define JSONCPP_NORETURN
35
+ # endif
36
+ #endif
37
+
25
38
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
26
39
// be used by...
27
40
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
@@ -69,9 +82,9 @@ class JSON_API LogicError : public Exception {
69
82
};
70
83
71
84
// / used internally
72
- void throwRuntimeError (JSONCPP_STRING const & msg);
85
+ JSONCPP_NORETURN void throwRuntimeError (JSONCPP_STRING const & msg);
73
86
// / used internally
74
- void throwLogicError (JSONCPP_STRING const & msg);
87
+ JSONCPP_NORETURN void throwLogicError (JSONCPP_STRING const & msg);
75
88
76
89
/* * \brief Type of the value held by a Value object.
77
90
*/
You can’t perform that action at this time.
0 commit comments