[dpdk-dev] [PATCH 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0

Natanael Copa ncopa at alpinelinux.org
Mon Mar 11 18:36:58 CET 2019

There is no standard saying that __WORDSIZE should be be defined or in
what include it should be defined. Use a portable way to detect 64 bit

This fixes a warning when building with musl libc:

 warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]

Signed-off-by: Natanael Copa <ncopa at alpinelinux.org>

This was not really a compile error but the warning looked scary enough.

There are various alternative ways to detect 64bit user-space at compile time,
but this is the most portable way I think.

 drivers/bus/dpaa/include/fsl_qman.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index e43841499..7f3f40d49 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -11,11 +11,12 @@
 extern "C" {
+#include <limits.h>
 #include <dpaa_rbtree.h>
 #include <rte_eventdev.h>
 /* FQ lookups (turn this on for 64bit user-space) */
-#if (__WORDSIZE == 64)
+#if (ULONG_MAX == 0xffffffffffffffff)
 /* if FQ lookups are supported, this controls the number of initialised,
  * s/w-consumed FQs that can be supported at any one time.

More information about the dev mailing list