OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[CORE] Introduce OPENVINO_DEBUG_ASSERT (#31262)
Egor Duplenskiia326ce085973
diff --git a/src/core/include/openvino/core/except.hpp b/src/core/include/openvino/core/except.hppindex 022844b9702..1c8d1c1bbed 100644--- a/src/core/include/openvino/core/except.hpp+++ b/src/core/include/openvino/core/except.hpp@@ -185,6 +185,20 @@ protected:/// \throws ::ov::AssertFailure if `cond` is false.#define OPENVINO_ASSERT(...) OPENVINO_ASSERT_HELPER(::ov::AssertFailure, ::ov::AssertFailure::default_msg, __VA_ARGS__)+/// \brief Debug version of OPENVINO_ASSERT that is only active when NDEBUG is not defined+/// i.e. Release / production builds.+// Can be used as a more convenient replacement for `assert()` in performance critical parts of code+/// \param ... Error message info to be added to the error message via the `<<`+/// stream-insertion operator. Note that the expressions here will be evaluated lazily,+/// i.e., only if the `cond` evaluates to `false`.+/// \throws ::ov::AssertFailure if `cond` is false and NDEBUG is not defined.+#ifndef NDEBUG+# define OPENVINO_DEBUG_ASSERT(...) \+ OPENVINO_ASSERT_HELPER(::ov::AssertFailure, ::ov::AssertFailure::default_msg, __VA_ARGS__)+#else+# define OPENVINO_DEBUG_ASSERT(...)+#endif+/// \brief Macro to signal a code path that is unreachable in a successful execution. It's/// implemented with OPENVINO_ASSERT macro./// \param ... Additional error message that should describe why that execution path is unreachable.