[PATCH 03/18] sparse: lib.c should handle being built 32-bit, compiling 64-bit, on x86.

John Levon <[email protected]>
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
Signed-off-by: John Levon <[email protected]>
---
 lib.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib.c b/lib.c
index be71e5b3..f20e0885 100644
--- a/lib.c
+++ b/lib.c
@@ -440,6 +440,10 @@ static void handle_arch_m64_finalize(void)
 	switch (arch_m64) {
 	case ARCH_LP32:
 		/* default values */
+#if defined(__x86_64__) || defined (__i386)
+		add_pre_buffer("#weak_define __i386__ 1\n");
+ 		add_pre_buffer("#weak_define __i386 1\n");
+#endif
 		return;
 	case ARCH_LP64:
 		bits_in_long = 64;
@@ -459,7 +463,7 @@ static void handle_arch_m64_finalize(void)
 	case_64bit_common:
 		bits_in_pointer = 64;
 		pointer_alignment = 8;
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined (__i386)
 		add_pre_buffer("#weak_define __x86_64__ 1\n");
  		add_pre_buffer("#weak_define __x86_64 1\n");
 #endif
-- 
2.14.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.