diff options
author | Taras Kondratiuk <taras.kondratiuk@linaro.org> | 2014-07-21 20:17:13 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-07-23 13:32:36 +0400 |
commit | f9c3c07126c2d91e671464450cceb9c389a13cc9 (patch) | |
tree | 572f99c2b4f4378acce5e5111934201b96a5186d | |
parent | e76f3c7e6f7c263ce7efadb26075bccfc6d35346 (diff) |
debug: Convert ODP_ASSERT to a runtime assertion
Accordingly to architecture document this should be a runtime
assertion and call abort() in case of failure.
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Reviewed-by: Anders Roxell <anders.roxell@linaro.org>
Tested-by: Mike Holmes <mike.holmes@linaro.org>
-rw-r--r-- | include/odp_debug.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/odp_debug.h b/include/odp_debug.h index edc775f..9a5ea2a 100644 --- a/include/odp_debug.h +++ b/include/odp_debug.h @@ -38,9 +38,14 @@ extern "C" { #endif /** - * Compile time assertion-macro - fail compilation if cond is false. + * Runtime assertion-macro - aborts if 'cond' is false. */ -#define ODP_ASSERT(cond, msg) typedef char msg[(cond) ? 1 : -1] +#ifndef ODP_NO_DEBUG +#define ODP_ASSERT(cond, msg) \ + do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0) +#else +#define ODP_ASSERT(cond, msg) +#endif /** * Compile time assertion-macro - fail compilation if cond is false. |