[PATCH v3] drivers: remove __rte_used from functions for compatibility with MSVC
Jerin Jacob
jerinjacobk at gmail.com
Thu May 29 07:53:51 CEST 2025
On Thu, May 29, 2025 at 5:42 AM Andre Muezerie
<andremue at linux.microsoft.com> wrote:
>
> With gcc, the macro __rte_used translates to __attribute__((used)).
> MSVC has something to the same effect, but harder to use and with some
> limitations (one being that it cannot be used with "static"). Therefore,
> it makes sense to avoid __rte_used in some cases.
>
> The functions modified in this patch don't really need to use __rte_used.
> Instead, these functions can be involved in same ifdefs used in the
> callers. That way, they are only defined when needed (when
> someone is actually calling the function). Doing so makes the code
> compatible with MSVC and avoids compiler warnings about functions being
> defined but not used.
>
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> Acked-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
Updated the git commit as follows and applied to
dpdk-next-net-mrvl/for-main. Thanks
net/cnxk: improve MSVC compatibility
With gcc, the macro __rte_used translates to __attribute__((used)).
MSVC has something to the same effect, but harder to use and with some
limitations (one being that it cannot be used with "static"). Therefore,
it makes sense to avoid __rte_used in some cases.
The functions modified in this patch don't really need to use __rte_used.
Instead, these functions can be involved in same ifdefs used in the
callers. That way, they are only defined when needed (when
someone is actually calling the function). Doing so makes the code
compatible with MSVC and avoids compiler warnings about functions being
defined but not used.
Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
Acked-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
More information about the dev
mailing list