[PATCH v5 11/14] eal: expand most macros to empty when using MSVC
Tyler Retzlaff
roretzla at linux.microsoft.com
Mon Apr 17 17:16:33 CEST 2023
On Sat, Apr 15, 2023 at 03:52:27PM -0700, Stephen Hemminger wrote:
> On Sun, 16 Apr 2023 00:41:54 +0200
> Morten Brørup <mb at smartsharesystems.com> wrote:
>
> > > > > > > /**
> > > > > > > * Force a structure to be packed
> > > > > > > */
> > > > > > > +#ifndef RTE_TOOLCHAIN_MSVC
> > > > > > > #define __rte_packed __attribute__((__packed__))
> > > > > > > +#else
> > > > > > > +#define __rte_packed
> > > > > > > +#endif
>
> Could there be cases this gets used for protocol headers or interacting with
> HW memory map, And if not packed then the code will not function correctly?
yes, that's one of the valid / correct use cases and it can't be avoided
if the structs are nested in recursively composed layout.
there are a few instances where we don't need compiler generated
static-stride. that is we don't need to force packing to get sizeof(T)
== offsetof(T.lastfield) + sizeof(T.lastfield).
anyway, this is more of an evaluate on a case by case basis for
candidates that aren't needed.
ty
More information about the dev
mailing list