Blame SOURCES/glibc-rh1418978-max_align_t.patch

fa3bfd
This patch adds a definition of max_align_t to the internal
fa3bfd
<sys/cdefs.h> header, for use in support/ functionality and elsewhere.
fa3bfd
fa3bfd
The definition must support being compiled in C11 or C++11 mode and
fa3bfd
must check both __STDC_VERSION__ and __cplusplus versions.
fa3bfd
fa3bfd
Upstream does not need this because all files are compiled in C11
fa3bfd
mode, making available the GCC definition in <stddef.h>
fa3bfd
fa3bfd
Also change malloc/tst-malloc-thread-fail.c to use the new definition.
fa3bfd
fa3bfd
Index: glibc-2.17-c758a686/include/sys/cdefs.h
fa3bfd
===================================================================
fa3bfd
--- glibc-2.17-c758a686.orig/include/sys/cdefs.h
fa3bfd
+++ glibc-2.17-c758a686/include/sys/cdefs.h
fa3bfd
@@ -15,6 +15,18 @@ rtld_hidden_proto (__chk_fail)
fa3bfd
 
fa3bfd
 
fa3bfd
 # define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__)))
fa3bfd
+
fa3bfd
+/* This mirrors the C11/C++11 max_align_t type provided by GCC, but it
fa3bfd
+   is also available in C99 mode.  The aligned attributes are required
fa3bfd
+   because some ABIs have reduced alignment requirements for struct and
fa3bfd
+   union members.  */
fa3bfd
+#if __STDC_VERSION__ < 201112L && __cplusplus < 201103L
fa3bfd
+typedef struct {
fa3bfd
+  long long ll __attribute__ ((__aligned__ (__alignof__ (long long))));
fa3bfd
+  long double ld __attribute__ ((__aligned__ (__alignof__ (long double))));
fa3bfd
+} max_align_t;
fa3bfd
+#endif /* __STDC_VERSION__ < 201112 && __cplusplus < 201103L */
fa3bfd
+
fa3bfd
 #endif
fa3bfd
 
fa3bfd
 #endif
fa3bfd
Index: glibc-2.17-c758a686/malloc/tst-malloc-thread-fail.c
fa3bfd
===================================================================
fa3bfd
--- glibc-2.17-c758a686.orig/malloc/tst-malloc-thread-fail.c
fa3bfd
+++ glibc-2.17-c758a686/malloc/tst-malloc-thread-fail.c
fa3bfd
@@ -30,16 +30,6 @@
fa3bfd
 #include <sys/resource.h>
fa3bfd
 #include <sys/wait.h>
fa3bfd
 #include <unistd.h>
fa3bfd
-#include <stddef.h>
fa3bfd
-
fa3bfd
-/* This mirrors the C11 max_align_t type provided by GCC, but it is
fa3bfd
-   also available in C99 mode.  The aligned attributes are required
fa3bfd
-   because some ABIs have reduced alignment requirements for struct
fa3bfd
-   and union members.  */
fa3bfd
-typedef struct {
fa3bfd
-  long long ll __attribute__ ((__aligned__ (__alignof__ (long long))));
fa3bfd
-  long double ld __attribute__ ((__aligned__ (__alignof__ (long double))));
fa3bfd
-} libc_max_align_t;
fa3bfd
 
fa3bfd
 /* Wrapper for calloc with an optimization barrier.  */
fa3bfd
 static void *
fa3bfd
@@ -93,7 +83,7 @@ allocate_1 (void)
fa3bfd
     {
fa3bfd
     case with_malloc:
fa3bfd
       return (struct allocate_result)
fa3bfd
-        {malloc (allocation_size), __alignof__ (libc_max_align_t)};
fa3bfd
+        {malloc (allocation_size), _Alignof (max_align_t)};
fa3bfd
     case with_realloc:
fa3bfd
       {
fa3bfd
         void *p = realloc (NULL, 16);
fa3bfd
@@ -106,7 +96,7 @@ allocate_1 (void)
fa3bfd
             if (q == NULL)
fa3bfd
               free (p);
fa3bfd
           }
fa3bfd
-        return (struct allocate_result) {q, __alignof__ (libc_max_align_t)};
fa3bfd
+        return (struct allocate_result) {q, _Alignof (max_align_t)};
fa3bfd
       }
fa3bfd
     case with_aligned_alloc:
fa3bfd
       {
fa3bfd
@@ -155,7 +145,7 @@ allocate_1 (void)
fa3bfd
                 printf ("error: non-zero byte at offset %zu\n", i);
fa3bfd
                 abort ();
fa3bfd
               }
fa3bfd
-        return (struct allocate_result) {p, __alignof__ (libc_max_align_t)};
fa3bfd
+        return (struct allocate_result) {p, _Alignof (max_align_t)};
fa3bfd
       }
fa3bfd
     }
fa3bfd
   abort ();