[rtems commit] score: Add RTEMS_DECONST|DEVOLATILE|DEQUALIFY()

Sebastian Huber sebh at rtems.org
Mon Sep 8 06:46:32 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep  5 08:32:28 2014 +0200

score: Add RTEMS_DECONST|DEVOLATILE|DEQUALIFY()

---

 cpukit/score/include/rtems/score/basedefs.h |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index ec93951..361f514 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -227,6 +227,33 @@
 #define RTEMS_CONTAINER_OF( _m, _type, _member_name ) \
   ( (_type *) ( (uintptr_t) ( _m ) - offsetof( _type, _member_name ) ) )
 
+/**
+ * @brief Removes the const qualifier from a type of a variable.
+ *
+ * @param[in] _type The target type for the variable.
+ * @param[in] _var The variable.
+ */
+#define RTEMS_DECONST( _type, _var ) \
+  ((_type)(uintptr_t)(const void *) ( _var ))
+
+/**
+ * @brief Removes the volatile qualifier from a type of a variable.
+ *
+ * @param[in] _type The target type for the variable.
+ * @param[in] _var The variable.
+ */
+#define RTEMS_DEVOLATILE( _type, _var ) \
+  ((_type)(uintptr_t)(volatile void *) ( _var ))
+
+/**
+ * @brief Removes the all qualifiers from a type of a variable.
+ *
+ * @param[in] _type The target type for the variable.
+ * @param[in] _var The variable.
+ */
+#define RTEMS_DEQUALIFY( _type, _var ) \
+  ((_type)(uintptr_t)(const volatile void *) ( _var ))
+
 #ifndef ASM
   #ifdef RTEMS_DEPRECATED_TYPES
     typedef bool boolean;



More information about the vc mailing list