summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2006-03-11 00:20:10 +0000
committerschodet2006-03-11 00:20:10 +0000
commit25e0271f872d86cd1fce02327ccc7534127c9cf7 (patch)
treef67c2ce85bfe103aff368c11d7ef86507b136877
parent5b1d2edb7a9b97afc30b8d4c28010b3f5adb8a07 (diff)
Ajout de assert.
Ajout des u8, u16 et compagnie.
-rw-r--r--n/avr/common/common.h35
1 files changed, 34 insertions, 1 deletions
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 <stdint.h>
-#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 <assert.h>
+
+/* 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 */