You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2018/11/13 17:18:31 UTC

[mynewt-core] 01/02: sys/sys: DEBUG_ASSERT()

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 06cefe8e5f37600a518e79423cf8b17100d35d18
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Nov 5 13:57:50 2018 -0800

    sys/sys: DEBUG_ASSERT()
    
    This macro is like `DEBUG_PANIC()`, except it only crashes the system if
    the provided expression evaluates to false.
---
 sys/sys/include/sys/debug_panic.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/sys/include/sys/debug_panic.h b/sys/sys/include/sys/debug_panic.h
index 1c3ef70..14a9e72 100644
--- a/sys/sys/include/sys/debug_panic.h
+++ b/sys/sys/include/sys/debug_panic.h
@@ -28,4 +28,10 @@
 #define DEBUG_PANIC()
 #endif
 
+#if MYNEWT_VAL(DEBUG_PANIC_ENABLED)
+#define DEBUG_ASSERT(expr) ((expr) ? (void)0 : OS_CRASH())
+#else
+#define DEBUG_ASSERT(expr)
+#endif
+
 #endif