diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-28 11:57:31 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-31 09:48:11 +0200 |
commit | af97ba8f295e61f84d147cdc59b3d1d0e6209b4c (patch) | |
tree | f54b6416e5633c41f389b2e390b867bda5f9e2fa /cpukit/score/include/rtems/score/basedefs.h | |
parent | psximfs02/init.c: Increase size of buffer to avoid overwrite (diff) | |
download | rtems-af97ba8f295e61f84d147cdc59b3d1d0e6209b4c.tar.bz2 |
score: Add RTEMS_HAVE_MEMBER_SAME_TYPE()
This fixes some "variably modified" warnings and a clang compile error.
Diffstat (limited to 'cpukit/score/include/rtems/score/basedefs.h')
-rw-r--r-- | cpukit/score/include/rtems/score/basedefs.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h index 288afd41aa..4994579e48 100644 --- a/cpukit/score/include/rtems/score/basedefs.h +++ b/cpukit/score/include/rtems/score/basedefs.h @@ -373,6 +373,25 @@ extern void RTEMS_DEQUALIFY_types_not_compatible(void); #endif /*RTEMS_DEQUALIFY*/ /** + * @brief Evaluates to true if the members of two types have the same type. + * + * @param[in] _t_lhs Left hand side type. + * @param[in] _m_lhs Left hand side member. + * @param[in] _t_rhs Right hand side type. + * @param[in] _m_rhs Right hand side member. + */ +#ifdef __GNUC__ + #define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) \ + __builtin_types_compatible_p( \ + __typeof( ( (_t_lhs *) 0 )->_m_lhs ), \ + __typeof( ( (_t_rhs *) 0 )->_m_rhs ) \ + ) +#else + #define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) \ + true +#endif + +/** * @brief Concatenates _x and _y without expanding. */ #define RTEMS_CONCAT( _x, _y ) _x##_y |