diff options
author | Florian Weimer <fweimer@redhat.com> | 2024-05-18 09:33:19 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2024-05-18 09:33:19 +0200 |
commit | 8d7b6b4cb27d4dec1dd5f7960298c1699275f962 (patch) | |
tree | d3233e6a49dbde86dee8ea46920714a1adbbddb7 /sysdeps/mach | |
parent | 2a99e2398d9d717c034e915f7846a49e623f5450 (diff) | |
download | glibc-8d7b6b4cb27d4dec1dd5f7960298c1699275f962.zip glibc-8d7b6b4cb27d4dec1dd5f7960298c1699275f962.tar.gz glibc-8d7b6b4cb27d4dec1dd5f7960298c1699275f962.tar.bz2 |
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 <polacek@redhat.com>
Suggested-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Sam James <sam@gentoo.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/bits/socket.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 3e72f9f..b5eeac3 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -153,7 +153,7 @@ enum __socket_type #include <bits/sockaddr.h> /* Structure describing a generic socket address. */ -struct sockaddr +struct __attribute_struct_may_alias__ sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ @@ -170,7 +170,7 @@ struct sockaddr #define _SS_PADSIZE \ (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) -struct sockaddr_storage +struct __attribute_struct_may_alias__ sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ char __ss_padding[_SS_PADSIZE]; |