From 25e0271f872d86cd1fce02327ccc7534127c9cf7 Mon Sep 17 00:00:00 2001 From: schodet Date: Sat, 11 Mar 2006 00:20:10 +0000 Subject: Ajout de assert. Ajout des u8, u16 et compagnie. --- n/avr/common/common.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'n') diff --git a/n/avr/common/common.h b/n/avr/common/common.h index 7ab5063..54ed501 100644 --- a/n/avr/common/common.h +++ b/n/avr/common/common.h @@ -27,6 +27,39 @@ #include -#define assert(x) +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef int8_t i8; +typedef int16_t i16; +typedef int32_t i32; + +#ifndef HOST + +# define assert(x) + +#else /* HOST */ + +# ifdef NDEBUG +# warning "you should not disable debug" +# endif + +# include + +/* Should use __assert instead of __assert_fail if not using GCC. This is + * left as an exercise to the reader :). */ +# if __GNUC_PREREQ (3, 0) +# define assert_print(expr, msg) \ + (__ASSERT_VOID_CAST (__builtin_expect (!!(expr), 1) ? 0 : \ + (__assert_fail (msg, __FILE__, __LINE__, \ + __ASSERT_FUNCTION), 0))) +# else +# define assert_print(expr, msg) \ + (__ASSERT_VOID_CAST ((expr) ? 0 : \ + (__assert_fail (msg, __FILE__, __LINE__, \ + __ASSERT_FUNCTION), 0))) +# endif + +#endif /* HOST */ #endif /* common_h */ -- cgit v1.2.3