master hovercats/oakiss / pkg / strace / patch / 0009-Use-ISO-C-alignment-and-attribute-syntax.patch
 1From 8fbfd70d38e4dbff3c4ec6c9362ad7c765e5089f Mon Sep 17 00:00:00 2001
 2From: Michael Forney <mforney@mforney.org>
 3Date: Wed, 1 Apr 2026 23:28:49 -0700
 4Subject: [PATCH] Use ISO C alignment and attribute syntax
 5
 6---
 7 src/gcc_compat.h | 4 ++--
 8 src/quota.c      | 4 ++--
 9 src/rtnl_link.c  | 4 ++--
10 src/sockaddr.c   | 4 ++--
11 4 files changed, 8 insertions(+), 8 deletions(-)
12
13diff --git a/src/gcc_compat.h b/src/gcc_compat.h
14index 35291b747..7e576d35c 100644
15--- a/src/gcc_compat.h
16+++ b/src/gcc_compat.h
17@@ -54,8 +54,8 @@
18 #  define ATTRIBUTE_PACKED	__attribute__((__packed__))
19 # else
20 #  define ATTRIBUTE_FORMAT(args)	/* empty */
21-#  define ATTRIBUTE_ALIGNED(arg)	/* empty */
22-#  define ATTRIBUTE_PACKED	/* empty */
23+#  define ATTRIBUTE_ALIGNED(arg)	_Alignas(arg)
24+#  define ATTRIBUTE_PACKED	[[gnu::packed]]
25 # endif
26 
27 /*
28diff --git a/src/quota.c b/src/quota.c
29index c3aeda229..bf6ca186c 100644
30--- a/src/quota.c
31+++ b/src/quota.c
32@@ -36,7 +36,7 @@
33  * leads to problems when it is used on 32-bit tracee which does not have such
34  * padding.
35  */
36-struct if_dqblk {
37+struct ATTRIBUTE_PACKED if_dqblk {
38 	uint64_t dqb_bhardlimit;
39 	uint64_t dqb_bsoftlimit;
40 	uint64_t dqb_curspace;
41@@ -46,7 +46,7 @@ struct if_dqblk {
42 	uint64_t dqb_btime;
43 	uint64_t dqb_itime;
44 	uint32_t dqb_valid;
45-} ATTRIBUTE_PACKED;
46+};
47 
48 struct if_nextdqblk {
49 	uint64_t dqb_bhardlimit;
50diff --git a/src/rtnl_link.c b/src/rtnl_link.c
51index acc244560..e345e87d3 100644
52--- a/src/rtnl_link.c
53+++ b/src/rtnl_link.c
54@@ -926,10 +926,10 @@ decode_ifla_vf_guid(struct tcb *const tcp,
55 	 * aligned;  trying to handle both possible attribute sizes.
56 	 */
57 	union {
58-		struct {
59+		struct ATTRIBUTE_PACKED {
60 			uint32_t vf;
61 			uint64_t guid;
62-		} ATTRIBUTE_PACKED ivg_32;
63+		} ivg_32;
64 		struct {
65 			uint32_t vf;
66 			uint64_t ATTRIBUTE_ALIGNED(8) guid;
67diff --git a/src/sockaddr.c b/src/sockaddr.c
68index 98220288d..afa2fd6a8 100644
69--- a/src/sockaddr.c
70+++ b/src/sockaddr.c
71@@ -757,9 +757,9 @@ print_sockaddr_data_bt(struct tcb *tcp, const void *const buf,
72 		uint16_t			hci_channel;
73 	};
74 
75-	struct bdaddr {
76+	struct ATTRIBUTE_PACKED bdaddr {
77 		uint8_t				b[6];
78-	} ATTRIBUTE_PACKED;
79+	};
80 
81 	struct sockaddr_sco {
82 		/* sa_family_t */ uint16_t	sco_family;
83-- 
842.49.0
85