summaryrefslogtreecommitdiff
path: root/nuttx/include/assert.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-13 17:32:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-13 17:32:37 +0000
commit5be9588ed42d1a4ed297bdc76d9e05e582e78969 (patch)
treea975a5a0d60e1cd2255ba0bd3ed397c72dc4745d /nuttx/include/assert.h
parent1125cbdc2d38da82d9631aa0ae1d9030f641126e (diff)
downloadpx4-nuttx-5be9588ed42d1a4ed297bdc76d9e05e582e78969.tar.gz
px4-nuttx-5be9588ed42d1a4ed297bdc76d9e05e582e78969.tar.bz2
px4-nuttx-5be9588ed42d1a4ed297bdc76d9e05e582e78969.zip
Fixe to kernel build and syscalls.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5738 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include/assert.h')
-rw-r--r--nuttx/include/assert.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/nuttx/include/assert.h b/nuttx/include/assert.h
index 62ffb3a6e..f3e2854fc 100644
--- a/nuttx/include/assert.h
+++ b/nuttx/include/assert.h
@@ -49,10 +49,12 @@
/* Macro Name: ASSERT, ASSERTCODE, et al. */
-#undef ASSERT
-#undef ASSERTCODE
-#undef DEBUGASSERT
-#undef PANIC
+#undef ASSERT - Assert if the condition is not true
+#undef ASSERTCODE - Assert with an error code if the condition is not true
+#undef VERIFY - Assert if a function returns a negative value
+#undef DEBUGASSERT - Like ASSERT, but only if CONFIG_DEBUG is defined
+#undef DEBUGVERIFY - Like VERIFY, but only if CONFIG_DEBUG is defined
+#undef PANIC - Unconditional error with code
#ifdef CONFIG_HAVE_FILENAME
@@ -62,11 +64,17 @@
# define ASSERTCODE(f, code) \
{ if (!(f)) up_assert_code((const uint8_t *)__FILE__, (int)__LINE__, code); }
+# define VERIFY(f) \
+ { if ((f) < 0) up_assert((const uint8_t *)__FILE__, (int)__LINE__); }
+
# ifdef CONFIG_DEBUG
# define DEBUGASSERT(f) \
{ if (!(f)) up_assert((const uint8_t *)__FILE__, (int)__LINE__); }
+# define DEBUGVERIFY(f) \
+ { if ((f) < 0) up_assert((const uint8_t *)__FILE__, (int)__LINE__); }
# else
# define DEBUGASSERT(f)
+# define DEBUGVERIFY(f) ((void)(f))
# endif /* CONFIG_DEBUG */
# define PANIC(code) \
@@ -79,11 +87,17 @@
# define ASSERTCODE(f, code) \
{ if (!(f)) up_assert_code(code); }
+# define VERIFY(f) \
+ { if ((f) < 0) up_assert(); }
+
# ifdef CONFIG_DEBUG
# define DEBUGASSERT(f) \
{ if (!(f)) up_assert(); }
+# define DEBUGVERIFY(f) \
+ { if ((f) < 0) up_assert(); }
# else
# define DEBUGASSERT(f)
+# define DEBUGVERIFY(f) ((void)(f))
# endif /* CONFIG_DEBUG */
# define PANIC(code) \