[v5,2/3] net/intel: use portable version of __builtin_add_overflow

Message ID 1741962820-27123-3-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State New
Delegated to: David Marchand
Headers
Series add portable version of __builtin_add_overflow |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andre Muezerie March 14, 2025, 2:33 p.m. UTC
__builtin_add_overflow is gcc specific. It should be replaced with
a portable version that can also be used with other compilers.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 drivers/net/intel/ice/base/ice_osdep.h | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Bruce Richardson March 14, 2025, 2:46 p.m. UTC | #1
On Fri, Mar 14, 2025 at 07:33:39AM -0700, Andre Muezerie wrote:
> __builtin_add_overflow is gcc specific. It should be replaced with
> a portable version that can also be used with other compilers.
> 
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index 7b96fcde03..e6c5512430 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -14,6 +14,7 @@ 
 #include <stdbool.h>
 
 #include <rte_common.h>
+#include <rte_math.h>
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
 #include <rte_memzone.h>
@@ -128,6 +129,10 @@  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 rte_add_overflow
+#endif
+
 #endif /* __INTEL_NET_BASE_OSDEP__ */
 
 #ifndef __always_unused