[PATCH 1/3] struct packed: Use gcc_struct on Windows
Eli Zaretskii
eliz@gnu.org
Thu Jul 21 18:23:58 GMT 2022
> Cc: gdb-patches@sourceware.org
> From: Pedro Alves <pedro@palves.net>
> Date: Thu, 21 Jul 2022 19:15:17 +0100
>
> >> No. The attribute only changes the layout of that particular structure.
> >
> > And we are 110% sure that structure will never be passed to any other
> > code?
>
> What other code are you talking about? struct packed is used in GDB's internal
> structures. Nothing outside GDB ever sees it. GDB doesn't export a C api.
> And if it did, we probably wouldn't use struct packed in exported structures.
If this is supposed to be based on our vigilance and manual prevention
of exporting it, I think it's fragile and not very reliable. If we
forget or miss something, we get a subtly broken build.
> >>> Can you tell why we must have the regular GCC layout of bitfields
> >>> here?
> >>
> >> Because without it the struct won't really be packed.
> >
> > Can you tell why is that necessary?
Can you answer this question, please?
What I'm actually asking is whether there's any alternative which
would avoid overriding the defaults in this matter.
> > In any case, I'm very uneasy about changes that break ABI
> > compatibility between parts of a program.
>
> But no ABI compatibility is broken.
But it could be, even if today it isn't.
More information about the Gdb-patches
mailing list