[PATCH v6 1/1] net/intel: define __builtin_add_overflow for MSVC
Morten Brørup
mb at smartsharesystems.com
Thu Jun 5 16:57:24 CEST 2025
+TO: David and Thomas, were part of the discussion
+CC: Stephen
> From: Andre Muezerie [mailto:andremue at linux.microsoft.com]
> Sent: Thursday, 5 June 2025 16.47
>
> __builtin_add_overflow is gcc specific. A macro needs to be defined
> for code using this to be compiled with MSVC.
> Since only one driver is using this, this patch adds the macro to
> that driver only. It can be moved to some common place if/when
> needed.
This seems to be consensus over adding it to rte_math.h, so:
Acked-by: Morten Brørup <mb at smartsharesystems.com>
>
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
> drivers/net/intel/ice/base/ice_osdep.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/intel/ice/base/ice_osdep.h
> b/drivers/net/intel/ice/base/ice_osdep.h
> index ad6cde9896..4f635f00a4 100644
> --- a/drivers/net/intel/ice/base/ice_osdep.h
> +++ b/drivers/net/intel/ice/base/ice_osdep.h
> @@ -128,6 +128,15 @@ writeq(uint64_t value, volatile void *addr)
> #define wr64(a, reg, value) writeq((value), (a)->hw_addr + (reg))
> #define rd64(a, reg) readq((a)->hw_addr + (reg))
>
> +#ifdef RTE_TOOLCHAIN_MSVC
> +#define __builtin_add_overflow(a, b, res) \
> + _Generic((a), \
> + uint8_t : _addcarry_u8, \
> + uint16_t : _addcarry_u16, \
> + uint32_t : _addcarry_u32, \
> + uint64_t : _addcarry_u64)(0, a, b, res)
> +#endif
> +
> #endif /* __INTEL_NET_BASE_OSDEP__ */
>
> #ifndef __always_unused
> --
> 2.49.0.vfs.0.3
More information about the dev
mailing list