about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/net
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-05-18 09:33:19 +0200
committerFlorian Weimer <fweimer@redhat.com>2024-05-18 09:33:19 +0200
commit8d7b6b4cb27d4dec1dd5f7960298c1699275f962 (patch)
treed3233e6a49dbde86dee8ea46920714a1adbbddb7 /sysdeps/unix/sysv/linux/net
parent2a99e2398d9d717c034e915f7846a49e623f5450 (diff)
downloadglibc-8d7b6b4cb27d4dec1dd5f7960298c1699275f962.tar.gz
glibc-8d7b6b4cb27d4dec1dd5f7960298c1699275f962.tar.xz
glibc-8d7b6b4cb27d4dec1dd5f7960298c1699275f962.zip
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/unix/sysv/linux/net')
-rw-r--r--sysdeps/unix/sysv/linux/net/if_packet.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/net/if_packet.h b/sysdeps/unix/sysv/linux/net/if_packet.h
index 9ffb69b508..c17e1c23c5 100644
--- a/sysdeps/unix/sysv/linux/net/if_packet.h
+++ b/sysdeps/unix/sysv/linux/net/if_packet.h
@@ -26,7 +26,7 @@
    From Linux 2.1 the AF_PACKET interface is preferred and you should
    consider using it in place of this one.  */
 
-struct sockaddr_pkt
+struct __attribute_struct_may_alias__ sockaddr_pkt
   {
     __SOCKADDR_COMMON (spkt_);
     unsigned char spkt_device[14];