[PATCH v2] RFC: replace GCC marker extension with C11 anonymous unions
Morten Brørup
mb at smartsharesystems.com
Tue Feb 13 18:09:58 CET 2024
> From: Tyler Retzlaff [mailto:roretzla at linux.microsoft.com]
> Sent: Tuesday, 13 February 2024 07.46
>
> The zero sized RTE_MARKER<n> typedefs are a GCC extension unsupported
> by
> MSVC. Replace the use of the RTE_MARKER typedefs with anonymous
> unions.
>
> Note:
>
> v1 of the series tried to maintain the API after some study it has been
> discovered that some existing uses of the markers do not produce
> compilation
> failure but evaluate to unintended values in the absence of adaptation.
> For this reason the existing markers cannot be removed because it is
> too hard
> to identify what needs to be changed by consumers. While the ABI has
> been
> maintained the subtle API change is just too risky.
>
> The question I'm asking now is how to gracefully deprecate the markers
> while allowing consumption of the struct on Windows.
>
> I propose the following:
>
> * Introduce the unions as per-this series except instead of adding
> members
> that match the original RTE_MARKER field names provide *new* names.
> * Retain (conditionally compiled away on Windows) the existing
> RTE_MARKER
> fields with their original names.
> * Convert in-tree code to use the new names in the unions.
>
> The old names & markers would be announced for deprecation and
> eventually
> removed and when they are the conditional compilation would also go
> away.
>
> Thoughts?
Seems like the right thing to do!
The modified type of rearm_data might not be noticed by out-of-tree PMD developers, so using a new name for the new type reduces the risk.
If some of the markers maintain their type or get a compatible type (from an API perspective), they can keep their names.
More information about the dev
mailing list