From 705c8e022f39cd885787457986e396cc78d0997d Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 27 Dec 2022 19:56:33 +0900 Subject: [PATCH] Use __BIGGEST_ALIGNMENT__ instead of max_align_t Also, remove no longer necessary __need_STDDEF_H_misc stuff. References: https://github.com/WebAssembly/wasi-libc/pull/335 https://github.com/WebAssembly/wasi-sdk/issues/111 https://github.com/llvm/llvm-project/blob/2e999b7dd1934a44d38c3a753460f1e5a217e9a5/clang/lib/Headers/stddef.h#L106-L113 --- libc-bottom-half/headers/public/__struct_sockaddr.h | 3 --- libc-bottom-half/headers/public/__struct_sockaddr_in.h | 5 +---- libc-bottom-half/headers/public/__struct_sockaddr_in6.h | 5 +---- libc-bottom-half/headers/public/__struct_sockaddr_storage.h | 5 +---- libc-bottom-half/headers/public/__struct_sockaddr_un.h | 5 +---- 5 files changed, 4 insertions(+), 19 deletions(-) diff --git a/libc-bottom-half/headers/public/__struct_sockaddr.h b/libc-bottom-half/headers/public/__struct_sockaddr.h index 9891b90be..2e14d9525 100644 --- a/libc-bottom-half/headers/public/__struct_sockaddr.h +++ b/libc-bottom-half/headers/public/__struct_sockaddr.h @@ -1,9 +1,6 @@ #ifndef __wasilibc___struct_sockaddr_h #define __wasilibc___struct_sockaddr_h -#define __need_STDDEF_H_misc -#include - #include <__typedef_sa_family_t.h> struct sockaddr { diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_in.h b/libc-bottom-half/headers/public/__struct_sockaddr_in.h index 73dc5c6ba..5d4ce51be 100644 --- a/libc-bottom-half/headers/public/__struct_sockaddr_in.h +++ b/libc-bottom-half/headers/public/__struct_sockaddr_in.h @@ -1,15 +1,12 @@ #ifndef __wasilibc___struct_sockaddr_in_h #define __wasilibc___struct_sockaddr_in_h -#define __need_STDDEF_H_misc -#include - #include <__typedef_sa_family_t.h> #include <__typedef_in_port_t.h> #include <__struct_in_addr.h> struct sockaddr_in { - _Alignas(max_align_t) sa_family_t sin_family; + __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; }; diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_in6.h b/libc-bottom-half/headers/public/__struct_sockaddr_in6.h index a220f9137..98703dcbe 100644 --- a/libc-bottom-half/headers/public/__struct_sockaddr_in6.h +++ b/libc-bottom-half/headers/public/__struct_sockaddr_in6.h @@ -1,15 +1,12 @@ #ifndef __wasilibc___struct_sockaddr_in6_h #define __wasilibc___struct_sockaddr_in6_h -#define __need_STDDEF_H_misc -#include - #include <__typedef_sa_family_t.h> #include <__typedef_in_port_t.h> #include <__struct_in6_addr.h> struct sockaddr_in6 { - _Alignas(max_align_t) sa_family_t sin6_family; + __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin6_family; in_port_t sin6_port; unsigned sin6_flowinfo; struct in6_addr sin6_addr; diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_storage.h b/libc-bottom-half/headers/public/__struct_sockaddr_storage.h index 1ae26a7ff..b4ebad2fe 100644 --- a/libc-bottom-half/headers/public/__struct_sockaddr_storage.h +++ b/libc-bottom-half/headers/public/__struct_sockaddr_storage.h @@ -1,13 +1,10 @@ #ifndef __wasilibc___struct_sockaddr_storage_h #define __wasilibc___struct_sockaddr_storage_h -#define __need_STDDEF_H_misc -#include - #include <__typedef_sa_family_t.h> struct sockaddr_storage { - _Alignas(max_align_t) sa_family_t ss_family; + __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t ss_family; char __ss_data[32]; }; diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_un.h b/libc-bottom-half/headers/public/__struct_sockaddr_un.h index a5be6e5d8..637119495 100644 --- a/libc-bottom-half/headers/public/__struct_sockaddr_un.h +++ b/libc-bottom-half/headers/public/__struct_sockaddr_un.h @@ -1,13 +1,10 @@ #ifndef __wasilibc___struct_sockaddr_un_h #define __wasilibc___struct_sockaddr_un_h -#define __need_STDDEF_H_misc -#include - #include <__typedef_sa_family_t.h> struct sockaddr_un { - _Alignas(max_align_t) sa_family_t sun_family; + __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sun_family; }; #endif