[rtems commit] score: Rename RTEMS_OBFUSCATE_POINTER()

Sebastian Huber sebh at rtems.org
Thu Oct 13 05:15:38 UTC 2016


Module:    rtems
Branch:    master
Commit:    f5eff007a44ad20c2a420b66903508e9d6c3b066
Changeset: http://git.rtems.org/rtems/commit/?id=f5eff007a44ad20c2a420b66903508e9d6c3b066

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Oct 13 07:09:49 2016 +0200

score: Rename RTEMS_OBFUSCATE_POINTER()

The inline asm construct works for everything which fits into a
register.

Close #2790.

---

 cpukit/score/include/rtems/linkersets.h     |  4 ++--
 cpukit/score/include/rtems/score/basedefs.h | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/cpukit/score/include/rtems/linkersets.h b/cpukit/score/include/rtems/linkersets.h
index b790fa5..390d2cb 100644
--- a/cpukit/score/include/rtems/linkersets.h
+++ b/cpukit/score/include/rtems/linkersets.h
@@ -30,13 +30,13 @@ extern "C" {
 #define RTEMS_LINKER_SET_ASSIGN_BEGIN( set, item ) \
   do { \
     item = _LINKER_SET_BEGIN( set ); \
-    RTEMS_OBFUSCATE_POINTER( item ); \
+    RTEMS_OBFUSCATE_VARIABLE( item ); \
   } while ( 0 )
 
 #define RTEMS_LINKER_SET_ASSIGN_END( set, item ) \
   do { \
     item = _LINKER_SET_END( set ); \
-    RTEMS_OBFUSCATE_POINTER( item ); \
+    RTEMS_OBFUSCATE_VARIABLE( item ); \
   } while ( 0 )
 
 #define RTEMS_LINKER_SET_SIZE( set ) \
diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index ea4d831..d142163 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -222,13 +222,15 @@
 #endif
 
 /**
- * @brief Obfuscates the pointer so that the compiler cannot perform
- * optimizations based on the pointer value.
+ * @brief Obfuscates the variable so that the compiler cannot perform
+ * optimizations based on the variable value.
+ *
+ * The variable must be simple enough to fit into a register.
  */
 #if defined(__GNUC__)
-  #define RTEMS_OBFUSCATE_POINTER( _ptr ) __asm__("" : "+r" (_ptr))
+  #define RTEMS_OBFUSCATE_VARIABLE( _var ) __asm__("" : "+r" (_var))
 #else
-  #define RTEMS_OBFUSCATE_POINTER( _ptr ) (void) (_ptr)
+  #define RTEMS_OBFUSCATE_VARIABLE( _var ) (void) (_var)
 #endif
 
 #if __cplusplus >= 201103L



More information about the vc mailing list