]> git.proxmox.com Git - wasi-libc.git/commitdiff
Use __BIGGEST_ALIGNMENT__ instead of max_align_t (#375)
authorYAMAMOTO Takashi <yamamoto@midokura.com>
Mon, 9 Jan 2023 16:33:58 +0000 (01:33 +0900)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 2 Aug 2023 10:24:08 +0000 (12:24 +0200)
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
libc-bottom-half/headers/public/__struct_sockaddr_in.h
libc-bottom-half/headers/public/__struct_sockaddr_in6.h
libc-bottom-half/headers/public/__struct_sockaddr_storage.h
libc-bottom-half/headers/public/__struct_sockaddr_un.h

index 9891b90bea4fdb71b1fbbe714959078b049a30f0..2e14d95258f52dc281cdffe667910eda9a7f2fbc 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef __wasilibc___struct_sockaddr_h
 #define __wasilibc___struct_sockaddr_h
 
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
 #include <__typedef_sa_family_t.h>
 
 struct sockaddr {
index 73dc5c6ba38d6a4085c2540cb04cfae9c7386f6a..5d4ce51becc4557a65db04ab15dcad95f5233053 100644 (file)
@@ -1,15 +1,12 @@
 #ifndef __wasilibc___struct_sockaddr_in_h
 #define __wasilibc___struct_sockaddr_in_h
 
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
 #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;
 };
index a220f913771c4605430b21bcc30683e2c97db28c..98703dcbeb65467429c2f77c1bdffbe888d6a22a 100644 (file)
@@ -1,15 +1,12 @@
 #ifndef __wasilibc___struct_sockaddr_in6_h
 #define __wasilibc___struct_sockaddr_in6_h
 
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
 #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;
index 1ae26a7ffce01c4776e5b25bd4bb846f628ed70f..b4ebad2fed1e4a543b2733d87ecd6cdc9c991ca8 100644 (file)
@@ -1,13 +1,10 @@
 #ifndef __wasilibc___struct_sockaddr_storage_h
 #define __wasilibc___struct_sockaddr_storage_h
 
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
 #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];
 };
 
index a5be6e5d86b5065fa8e24b56dbb696c6dbdd0236..637119495a23b7fb132b000c487fb9435bbb97fd 100644 (file)
@@ -1,13 +1,10 @@
 #ifndef __wasilibc___struct_sockaddr_un_h
 #define __wasilibc___struct_sockaddr_un_h
 
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
 #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