mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-21 02:00:33 +01:00
Merge pull request #445 from ya1gaurav/patch-36
Added NORETURN for throw functions.
This commit is contained in:
commit
59e327f50b
@ -22,6 +22,19 @@
|
|||||||
#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)
|
||||||
@ -69,9 +82,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// used internally
|
/// used internally
|
||||||
void throwRuntimeError(JSONCPP_STRING const& msg);
|
JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg);
|
||||||
/// used internally
|
/// used internally
|
||||||
void throwLogicError(JSONCPP_STRING const& msg);
|
JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg);
|
||||||
|
|
||||||
/** \brief Type of the value held by a Value object.
|
/** \brief Type of the value held by a Value object.
|
||||||
*/
|
*/
|
||||||
|
@ -171,11 +171,11 @@ RuntimeError::RuntimeError(JSONCPP_STRING const& msg)
|
|||||||
LogicError::LogicError(JSONCPP_STRING const& msg)
|
LogicError::LogicError(JSONCPP_STRING const& msg)
|
||||||
: Exception(msg)
|
: Exception(msg)
|
||||||
{}
|
{}
|
||||||
void throwRuntimeError(JSONCPP_STRING const& msg)
|
JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg)
|
||||||
{
|
{
|
||||||
throw RuntimeError(msg);
|
throw RuntimeError(msg);
|
||||||
}
|
}
|
||||||
void throwLogicError(JSONCPP_STRING const& msg)
|
JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg)
|
||||||
{
|
{
|
||||||
throw LogicError(msg);
|
throw LogicError(msg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user