summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-02-17 00:51:04 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-27 23:16:14 +0100
commitd69cf5529d3fdbbfd3d1d6b429a67f912e3c4f44 (patch)
tree034c8fedbfd86d1ed00036ae657cb4cebaa0c499
parent5cf9885fde9c9697e4adade00cd71beb8bf4624b (diff)
Also align mach_msg_type_long_t to complex_alignof
This was a miss in the previous patch given that mach_msg_type_long_t is 12 bytes long so won't neatly align to 8 bytes. Message-Id: <Y+8VyADQ8+bRRUcp@jupiter.tail36e24.ts.net>
-rw-r--r--utils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/utils.c b/utils.c
index f2f45f6..000a47f 100644
--- a/utils.c
+++ b/utils.c
@@ -304,9 +304,14 @@ WriteFieldDeclPrim(FILE *file, const argument_t *arg,
fprintf(file, "\t\tmach_msg_type_%st %s;\n",
arg->argLongForm ? "long_" : "", arg->argTTName);
- if (!arg->argLongForm && complex_alignof > sizeof_mach_msg_type_t) {
- /* Pad mach_msg_type_t in case we need alignment by more than its size. */
- fprintf(file, "\t\tchar %s_pad[%d];\n", arg->argTTName, complex_alignof - sizeof_mach_msg_type_t);
+
+ /* Pad mach_msg_type_t/mach_msg_type_long_t in case we need alignment by more than its size. */
+ if (!arg->argLongForm && sizeof_mach_msg_type_t % complex_alignof) {
+ fprintf(file, "\t\tchar %s_pad[%d];\n",
+ arg->argTTName, complex_alignof - sizeof_mach_msg_type_t % complex_alignof);
+ } else if (arg->argLongForm && sizeof_mach_msg_type_long_t % complex_alignof) {
+ fprintf(file, "\t\tchar %s_pad[%d];\n", arg->argTTName,
+ complex_alignof - sizeof_mach_msg_type_long_t % complex_alignof);
}
if (it->itInLine && it->itVarArray)