From 5be9588ed42d1a4ed297bdc76d9e05e582e78969 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 13 Mar 2013 17:32:37 +0000 Subject: Fixe to kernel build and syscalls. git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5738 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/include/assert.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'nuttx/include/assert.h') 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) \ -- cgit v1.2.3