[PATCH 1/2] config: add compatibility for old compilers with new UAPI headers
Maxime Coquelin
maxime.coquelin at redhat.com
Wed Sep 30 17:37:27 CEST 2026
On Wed, Sep 30, 2026 at 5:26 PM Stephen Hemminger <
stephen at networkplumber.org> wrote:
> On Wed, 30 Sep 2026 11:57:59 +0200
> Maxime Coquelin <maxime.coquelin at redhat.com> wrote:
>
> > This patch adds a compatibility define for __counted_by attribute,
> > which is not present in older compilers but required for recent UAPI
> > headers like vfio.h.
> >
> > Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
> > ---
> > config/rte_config.h | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/config/rte_config.h b/config/rte_config.h
> > index 0447cdf2ad..307e7dac62 100644
> > --- a/config/rte_config.h
> > +++ b/config/rte_config.h
> > @@ -25,6 +25,15 @@
> > #define RTE_TOOLCHAIN_MSVC 1
> > #endif
> >
> > +/*
> > + * Compatibility define for Linux kernel UAPI headers that may use
> __counted_by
> > + * attribute for bounds checking. This attribute is not understood by
> userspace
> > + * compilers, so define it as empty if not already provided.
> > + */
> > +#ifndef __counted_by
> > +#define __counted_by(m)
> > +#endif
> > +
> > /* legacy defines */
> > #ifdef RTE_EXEC_ENV_LINUX
> > #define RTE_EXEC_ENV_LINUXAPP 1
>
> NAK this is best done by keeping up to date stddef over in virtio headers.
>
>
This is for VFIO, not Virtio but that does not change the issue.
Problem is importing stddef in UAPI as currently done, does not work,
because the system version is included first so the imported one is
discarded.
An alternative solution I tested would be to include the imported headers
first,
but it means imported headers get silently intermixed, which worked in my
test
but could lead to hard to debug issues.
While not ideal, the solution proposed in this patch is harmless, we are
talking
about an attribute defined as empty.
Thomas, David, what do you think?
Thanks,
Maxime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20260930/6dc1b8e1/attachment.htm>
More information about the dev
mailing list