[PATCH] tools: Remove conflicting BITS_PER_LONG define

From: Alexander Sverdlin
Date: Wed Sep 12 2018 - 13:02:58 EST


CC .../tools/objtool/builtin-check.o
...
In file included from .../tools/arch/x86/include/uapi/asm/bitsperlong.h:11:0,
from .../tools/include/asm-generic/bitops/__ffs.h:6,
from .../tools/include/asm-generic/bitops.h:16,
from .../tools/include/linux/bitops.h:35,
from .../tools/include/linux/hashtable.h:13,
from elf.h:24,
from check.h:22,
from builtin-check.c:30:
.../tools/include/asm-generic/bitsperlong.h:8:0: error: "BITS_PER_LONG" redefined [-Werror]
#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)

Include <asm/bitsperlong.h> instead as other headers do.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
---

Seen during x86_64 build. Seems that most of the compilers do not define
__SIZEOF_LONG__, but my does.

tools/include/linux/bitops.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/include/linux/bitops.h b/tools/include/linux/bitops.h
index acc704b..4ae5232 100644
--- a/tools/include/linux/bitops.h
+++ b/tools/include/linux/bitops.h
@@ -3,16 +3,13 @@
#define _TOOLS_LINUX_BITOPS_H_

#include <asm/types.h>
+#include <asm/bitsperlong.h>
#include <linux/compiler.h>

#ifndef __WORDSIZE
#define __WORDSIZE (__SIZEOF_LONG__ * 8)
#endif

-#ifndef BITS_PER_LONG
-# define BITS_PER_LONG __WORDSIZE
-#endif
-
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
#define BITS_PER_BYTE 8
--
2.4.6