Applied, thanks! Flavio Cruz, le dim. 19 févr. 2023 18:11:05 -0500, a ecrit: > By using uintptr_t, we ensure that all 64 bit stubs are free of > undefined behavior since we support up to 8-byte alignment. This works > fine given that Mig will type check types that have higher alignment > requirements through the use of _Static_assert. > > This even works for a 64 bit kernel / 32 bit user land since we can use > mig64 to build stubs for the 8-byte aligned kernel stubs and existing 32 > bit mig to build the old user side stubs. Pragma is no longer required as we > take > advantage of the compiler to drive the alignment and avoid undefined > behavior. > --- > cpu.sym | 2 +- > utils.c | 2 -- > 2 files changed, 1 insertion(+), 3 deletions(-) > > diff --git a/cpu.sym b/cpu.sym > index 39ae712..bee12f0 100644 > --- a/cpu.sym > +++ b/cpu.sym > @@ -95,7 +95,7 @@ expr MACH_MSG_TYPE_POLYMORPHIC > > > /* Types used in interfaces */ > -expr sizeof(natural_t) desired_complex_alignof > +expr sizeof(uintptr_t) desired_complex_alignof > expr sizeof(void*) sizeof_pointer > expr sizeof(char) sizeof_char > expr sizeof(short) sizeof_short > diff --git a/utils.c b/utils.c > index f2f45f6..419105a 100644 > --- a/utils.c > +++ b/utils.c > @@ -342,12 +342,10 @@ void > WriteStructDecl(FILE *file, const argument_t *args, write_list_fn_t *func, > u_int mask, const char *name) > { > - fprintf(file, "#pragma pack(push,%d)\n", complex_alignof); > fprintf(file, "\ttypedef struct {\n"); > fprintf(file, "\t\tmach_msg_header_t Head;\n"); > WriteList(file, args, func, mask, "\n", "\n"); > fprintf(file, "\t} %s;\n", name); > - fprintf(file, "#pragma pack(pop)\n"); > fprintf(file, "\n"); > } > > -- > 2.39.1 > >
-- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.