summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-12 10:44:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-12 10:58:27 +0200
commit97eaefd49377a8c5407df3de88c1a6f35e093559 (patch)
tree13c62053d238997a01f01a512b253afa9d5d8186
parentscore: Simplify check for migrations (diff)
downloadrtems-97eaefd49377a8c5407df3de88c1a6f35e093559.tar.bz2
score: Add RTEMS_OBFUSCATE_POINTER()
Update #2790.
-rw-r--r--cpukit/score/include/rtems/score/basedefs.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index c378635bef..ea4d8314ce 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -10,7 +10,7 @@
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
- * Copyright (c) 2010-2015 embedded brains GmbH.
+ * Copyright (c) 2010, 2016 embedded brains GmbH.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -221,6 +221,16 @@
#define RTEMS_PRINTFLIKE( _format_pos, _ap_pos )
#endif
+/**
+ * @brief Obfuscates the pointer so that the compiler cannot perform
+ * optimizations based on the pointer value.
+ */
+#if defined(__GNUC__)
+ #define RTEMS_OBFUSCATE_POINTER( _ptr ) __asm__("" : "+r" (_ptr))
+#else
+ #define RTEMS_OBFUSCATE_POINTER( _ptr ) (void) (_ptr)
+#endif
+
#if __cplusplus >= 201103L
#define RTEMS_STATIC_ASSERT(cond, msg) \
static_assert(cond, # msg)