diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-21 21:55:16 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-21 21:55:16 +0000 |
commit | efc2cf23a849f7be1d65c4cdd7767f88917c46a7 (patch) | |
tree | fbe3518a364d6b9d811e00f7201e082d50ead7e3 /nuttx/include/assert.h | |
parent | 94e5b72f50f3096b83fe50c7b57324a08e318f29 (diff) | |
download | px4-nuttx-efc2cf23a849f7be1d65c4cdd7767f88917c46a7.tar.gz px4-nuttx-efc2cf23a849f7be1d65c4cdd7767f88917c46a7.tar.bz2 px4-nuttx-efc2cf23a849f7be1d65c4cdd7767f88917c46a7.zip |
Progress toward clean SDCC compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@18 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include/assert.h')
-rw-r--r-- | nuttx/include/assert.h | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/nuttx/include/assert.h b/nuttx/include/assert.h index 831b57485..022e343ca 100644 --- a/nuttx/include/assert.h +++ b/nuttx/include/assert.h @@ -53,21 +53,42 @@ #undef ASSERTCODE #undef DEBUGASSERT -#define ASSERT(f) \ - { if (!(f)) up_assert((const ubyte *)__FILE__, (uint32)__LINE__); } +#ifdef __GNUC__ -#define ASSERTCODE(f, errCode) \ - { if (!(f)) up_assert_code((const ubyte *)__FILE__, (uint32)__LINE__, errCode); } +# define ASSERT(f) \ + { if (!(f)) up_assert((const ubyte *)__FILE__, (int)__LINE__); } + +# define ASSERTCODE(f, errCode) \ + { if (!(f)) up_assert_code((const ubyte *)__FILE__, (int)__LINE__, errCode); } + +# ifdef CONFIG_DEBUG +# define DEBUGASSERT(f) \ + { if (!(f)) up_assert((const ubyte *)__FILE__, (int)__LINE__); } +# else +# define DEBUGASSERT(f) +# endif /* CONFIG_DEBUG */ + +# define PANIC(errCode) \ + up_assert_code((const ubyte *)__FILE__, (int)__LINE__, (errCode)|0x8000) -#ifdef CONFIG_DEBUG -#define DEBUGASSERT(f) \ - { if (!(f)) up_assert((const ubyte *)__FILE__, (uint32)__LINE__); } #else -#define DEBUGASSERT(f) -#endif /* CONFIG_DEBUG */ +# define ASSERT(f) \ + { if (!(f)) up_assert(); } + +# define ASSERTCODE(f, errCode) \ + { if (!(f)) up_assert_code(errCode); } + +# ifdef CONFIG_DEBUG +# define DEBUGASSERT(f) \ + { if (!(f)) up_assert(); } +# else +# define DEBUGASSERT(f) +# endif /* CONFIG_DEBUG */ -#define PANIC(errCode) \ - up_assert_code((const ubyte *)__FILE__, (uint32)__LINE__, ((errCode)|(0x8000))) +# define PANIC(errCode) \ + up_assert_code((errCode)|0x8000) + +#endif /************************************************************ * Included Files @@ -84,9 +105,14 @@ extern "C" { #define EXTERN extern #endif -EXTERN void up_assert(const ubyte *fileName, uint32 lineNum); -EXTERN void up_assert_code(const ubyte *fileName, uint32 lineNum, - uint16 errorCode); +#ifdef __GNUC__ +EXTERN void up_assert(const ubyte *fileName, int lineNum); +EXTERN void up_assert_code(const ubyte *fileName, int lineNum, + int error_code); +#else +EXTERN void up_assert(void); +EXTERN void up_assert_code(int error_code); +#endif #undef EXTERN #ifdef __cplusplus |