[PATCH v2 5/6] drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__
Andre Muezerie
andremue at linux.microsoft.com
Wed Dec 4 22:41:05 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/raw/ifpga/base/opae_osdep.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/raw/ifpga/base/opae_osdep.h b/drivers/raw/ifpga/base/opae_osdep.h
index cb780b1fed..bb8d2a1dd6 100644
--- a/drivers/raw/ifpga/base/opae_osdep.h
+++ b/drivers/raw/ifpga/base/opae_osdep.h
@@ -31,10 +31,10 @@ struct uuid {
#ifndef LINUX_MACROS
#ifndef BITS_PER_LONG
-#define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
+#define BITS_PER_LONG (sizeof(long) * 8)
#endif
#ifndef BITS_PER_LONG_LONG
-#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8)
+#define BITS_PER_LONG_LONG (sizeof(long long) * 8)
#endif
#ifndef BIT
#define BIT(a) (1UL << (a))
--
2.47.0.vfs.0.3
More information about the dev
mailing list