[PATCH v2 kvmtool 02/10] bitops.h: Include wordsize.h to provide the __WORDSIZE define

Alexandru Elisei alexandru.elisei at arm.com
Thu Jan 27 08:20:25 PST 2022


Trying to build a source file which included bitops.h, but didn't also
bring in the definition for __WORDSIZE (by including limits.h, for example)
would result in the following error:

include/linux/bitops.h:8:23: error: ‘__WORDSIZE’ undeclared (first use in this function)
    8 | #define BITS_PER_LONG __WORDSIZE
      |                       ^~~~~~~~~~

The symbol is defined in the bits/wordsize.h header file, include it.

Signed-off-by: Alexandru Elisei <alexandru.elisei at arm.com>
---
 include/linux/bitops.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 56448b71ebbf..3d31f0acf48e 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -1,6 +1,8 @@
 #ifndef _KVM_LINUX_BITOPS_H_
 #define _KVM_LINUX_BITOPS_H_
 
+#include <bits/wordsize.h>
+
 #include <linux/kernel.h>
 #include <linux/compiler.h>
 #include <asm/hweight.h>
-- 
2.31.1




More information about the linux-arm-kernel mailing list