From 8d7b6b4cb27d4dec1dd5f7960298c1699275f962 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sat, 18 May 2024 09:33:19 +0200 Subject: socket: Use may_alias on sockaddr structs (bug 19622) This supports common coding patterns. The GCC C front end before version 7 rejects the may_alias attribute on a struct definition if it was not present in a previous forward declaration, so this attribute can only be conditionally applied. This implements the spirit of the change in Austin Group issue 1641. Suggested-by: Marek Polacek Suggested-by: Jakub Jelinek Reviewed-by: Sam James Reviewed-by: Carlos O'Donell --- socket/sys/un.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'socket') diff --git a/socket/sys/un.h b/socket/sys/un.h index bf03b7d6ce..ff9cbd6efa 100644 --- a/socket/sys/un.h +++ b/socket/sys/un.h @@ -26,7 +26,7 @@ __BEGIN_DECLS /* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ -struct sockaddr_un +struct __attribute_struct_may_alias__ sockaddr_un { __SOCKADDR_COMMON (sun_); char sun_path[108]; /* Path name. */ -- cgit v1.2.3