summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2021-07-20 16:02:50 -0500
committerJoel Sherrill <joel@rtems.org>2021-07-21 17:00:22 -0500
commitc5e81a2169dff197d8d750663b84b2237fd3362c (patch)
tree4aea5c0afe30d56df7dbf6eb9ab0e6ff72bd8cc5
parentnexus: Added SDHCI driver to ZynqMP (diff)
downloadrtems-libbsd-c5e81a2169dff197d8d750663b84b2237fd3362c.tar.bz2
linker_set.h: Add alignof implementation for when not C11 or C++11
The default implementation was completely broken. Use the GCC specific __alignof__ if compiling for C99 or C++03. If not C++11, C11, or GCC, then it is an error.
-rwxr-xr-xfreebsd/sys/sys/linker_set.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/freebsd/sys/sys/linker_set.h b/freebsd/sys/sys/linker_set.h
index baa5ae4c..9af53079 100755
--- a/freebsd/sys/sys/linker_set.h
+++ b/freebsd/sys/sys/linker_set.h
@@ -73,8 +73,10 @@
#define RTEMS_BSD_ALIGNOF( _type_name ) alignof( _type_name )
#elif __STDC_VERSION__ >= 201112L
#define RTEMS_BSD_ALIGNOF( _type_name ) _Alignof( _type_name )
+#elif defined(__GNUC__)
+ #define RTEMS_BSD_ALIGNOF( _type_name ) __alignof__( _type_name )
#else
- #define RTEMS_BSD_ALIGNOF( _type_name ) sizeof( _type_name )
+ #error "FIX ME! Implement RTEMS_BSD_ALIGNOF() for this environment"
#endif
#define RTEMS_BSD_SET_ALIGN( type ) \