[PATCH v2 1/6] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
Andre Muezerie
andremue at linux.microsoft.com
Wed Dec 4 22:41:01 CET 2024
Macro __SIZEOF_LONG__ is not standardized and MSVC does not define it.
Therefore the errors below are seen with MSVC:
../lib/mldev/mldev_utils_scalar.c(465): error C2065:
'__SIZEOF_LONG__': undeclared identifier
../lib/mldev/mldev_utils_scalar.c(478): error C2051:
case expression not constant
../lib/mldev/mldev_utils_scalar_bfloat16.c(33): error C2065:
'__SIZEOF_LONG__': undeclared identifier
../lib/mldev/mldev_utils_scalar_bfloat16.c(49): error C2051:
case expression not constant
Turns out that the places where __SIZEOF_LONG__ is currently
being used can equally well use sizeof(long) instead.
Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
---
drivers/bus/fslmc/mc/fsl_mc_cmd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bus/fslmc/mc/fsl_mc_cmd.h b/drivers/bus/fslmc/mc/fsl_mc_cmd.h
index a768774c89..10804e6c5d 100644
--- a/drivers/bus/fslmc/mc/fsl_mc_cmd.h
+++ b/drivers/bus/fslmc/mc/fsl_mc_cmd.h
@@ -29,7 +29,7 @@
#define le32_to_cpu rte_le_to_cpu_32
#define le16_to_cpu rte_le_to_cpu_16
-#define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
+#define BITS_PER_LONG (sizeof(long) * 8)
#define GENMASK(h, l) \
(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
--
2.47.0.vfs.0.3
More information about the dev
mailing list