[rtems commit] basedefs: Add RTEMS_ALIGNOF()

Sebastian Huber sebh at rtems.org
Fri Feb 19 06:09:18 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Feb 10 06:43:39 2021 +0100

basedefs: Add RTEMS_ALIGNOF()

---

 cpukit/include/rtems/score/basedefs.h | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h
index c3a46f5..c423c53 100644
--- a/cpukit/include/rtems/score/basedefs.h
+++ b/cpukit/include/rtems/score/basedefs.h
@@ -10,7 +10,7 @@
 /*
  * Copyright (C) 2014 Paval Pisa
  * Copyright (C) 2011, 2013 On-Line Applications Research Corporation (OAR)
- * Copyright (C) 2009, 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2009, 2021 embedded brains GmbH (http://www.embedded-brains.de)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -156,6 +156,25 @@ extern "C" {
   #define RTEMS_ALIGNED( _alignment )
 #endif
 
+/* Generated from spec:/rtems/basedefs/if/alignof */
+
+/**
+ * @ingroup RTEMSAPIBaseDefs
+ *
+ * @brief Gets the alignment requirement of the type.
+ *
+ * @param _type_name is the type name to get the alignment requirement for.
+ *
+ * @return Returns the alignment requirement of the type.
+ */
+#if __cplusplus >= 201103L
+  #define RTEMS_ALIGNOF( _type_name ) alignof( _type_name )
+#elif __STDC_VERSION__ >= 201112L
+  #define RTEMS_ALIGNOF( _type_name ) _Alignof( _type_name )
+#else
+  #define RTEMS_ALIGNOF( _type_name ) sizeof( _type_name )
+#endif
+
 /* Generated from spec:/rtems/basedefs/if/alloc-align */
 
 /**



More information about the vc mailing list