]> Savannah Git Hosting - gnulib.git/commitdiff
Use attribute __aligned__ with clang.
authorBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 16:12:36 +0000 (18:12 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 16:12:36 +0000 (18:12 +0200)
* lib/stdalign.in.h (_Alignas): Treat clang like GCC.
* lib/stddef.in.h (_GL_STDDEF_ALIGNAS): Likewise.

ChangeLog
lib/stdalign.in.h
lib/stddef.in.h

index 7347ea828b63607e5d2cf63a358bbb732df53b4c..7c8865e2928d7510d9ccb8b4b91506115d1c05bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-08-09  Bruno Haible  <bruno@clisp.org>
+
+       Use attribute __aligned__ with clang.
+       * lib/stdalign.in.h (_Alignas): Treat clang like GCC.
+       * lib/stddef.in.h (_GL_STDDEF_ALIGNAS): Likewise.
+
 2020-08-09  Bruno Haible  <bruno@clisp.org>
 
        Use __alignof__ with clang.
index 10eedc550e34d11f97767f68455c0dd430a647f6..ad1bd008a118ca8126fc38c0a187406b2c29706e 100644 (file)
 #  define _Alignas(a) alignas (a)
 # elif ((defined __APPLE__ && defined __MACH__                  \
          ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__)                 \
-         : __GNUC__ && !defined __ibmxl__) \
-        || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
+         : __GNUC__ && !defined __ibmxl__)                      \
+        || (4 <= __clang_major__)                               \
+        || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC))  \
         || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)
 #  define _Alignas(a) __attribute__ ((__aligned__ (a)))
 # elif 1300 <= _MSC_VER
index d556ae87969c9effcc3cdef20df1e8212885bf9a..19d09998d57f3d1bb4e85c54fd67dd44c85b44c8 100644 (file)
@@ -97,7 +97,7 @@
    and the C11 standard allows this.  Work around this problem by
    using __alignof__ (which returns 8 for double) rather than _Alignof
    (which returns 4), and align each union member accordingly.  */
-#   ifdef __GNUC__
+#   if defined __GNUC__ || (__clang_major__ >= 4)
 #    define _GL_STDDEF_ALIGNAS(type) \
        __attribute__ ((__aligned__ (__alignof__ (type))))
 #   else