bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH mig] Also align mach_msg_type_long_t to complex_alignof


From: Samuel Thibault
Subject: Re: [PATCH mig] Also align mach_msg_type_long_t to complex_alignof
Date: Mon, 27 Feb 2023 23:16:22 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le ven. 17 févr. 2023 00:51:04 -0500, a ecrit:
> 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.
> ---
>  utils.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/utils.c b/utils.c
> index f2f45f6..9af78e9 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -304,10 +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)
>      {
> -- 
> 2.39.1
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]