If BITS_PER_LONG gets already defined in
linux/tools/include/linux/bitops.h it shouldn't be
redefined in tools/include/asm-generic/bitsperlong.h.

This patch prevents such compilation error:
[..]/linux/tools/include/asm-generic/bitsperlong.h:8:0:
error: "BITS_PER_LONG" redefined [-Werror]
 #define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)

In file included from [..]/linux/tools/include/linux/hashtable.h:13:0,
                 from elf.h:24,
                 from check.h:22,
                 from builtin-check.c:30:
[..]/linux/tools/include/linux/bitops.h:13:0:
note: this is the location of the previous definition

Signed-off-by: Wladislav Wiebe <[email protected]>
---
 tools/include/asm-generic/bitsperlong.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/include/asm-generic/bitsperlong.h
b/tools/include/asm-generic/bitsperlong.h
index 8f2283052333..c69a5fa3a096 100644
--- a/tools/include/asm-generic/bitsperlong.h
+++ b/tools/include/asm-generic/bitsperlong.h
@@ -4,11 +4,13 @@

 #include <uapi/asm-generic/bitsperlong.h>

+#ifndef BITS_PER_LONG
 #ifdef __SIZEOF_LONG__
 #define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
 #else
 #define BITS_PER_LONG __WORDSIZE
 #endif
+#endif

 #if BITS_PER_LONG != __BITS_PER_LONG
 #error Inconsistent word size. Check asm/bitsperlong.h
-- 
2.16.1

Reply via email to