Module: xenomai-forge
Branch: master
Commit: 175c2bb506a752d10ee6a9936d4f510555aca14d
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=175c2bb506a752d10ee6a9936d4f510555aca14d

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Nov 27 17:20:29 2011 +0100

copperplate/debug: introduce helpers for optimization

---

 include/copperplate/debug.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/copperplate/debug.h b/include/copperplate/debug.h
index 2811e2b..8ff4cd1 100644
--- a/include/copperplate/debug.h
+++ b/include/copperplate/debug.h
@@ -21,8 +21,19 @@
 
 #ifdef __XENO_DEBUG__
 
+#include <stdint.h>
 #include <pthread.h>
 
+static inline int bad_pointer(const void *ptr)
+{
+       return ptr == NULL || ((intptr_t)ptr & (sizeof(intptr_t)-1)) != 0;
+}
+
+static inline int must_check(void)
+{
+       return 1;
+}
+
 struct threadobj;
 
 struct error_frame {
@@ -90,6 +101,16 @@ int debug_pkg_init(void);
 
 #else /* !__XENO_DEBUG__ */
 
+static inline int bad_pointer(const void *ptr)
+{
+       return 0;
+}
+
+static inline int must_check(void)
+{
+       return 0;
+}
+
 #define debug(fmt, args...)  do { } while (0)
 
 struct backtrace_data {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to