Skip to contentSkip to conversation

mips: do not redefine BUILD_BUG()

PATCH In review Cong Wang 4 participants 4 messages Feb 3, 2012 MIPS

lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 mips: do not redefine BUILD_BUG()

On mips, we got

include/linux/kernel.h:717:1: error: "BUILD_BUG" redefined arch/mips/include/asm/page.h:43:1: error: this is the location of the previous definition make[3]: *** [arch/mips/sgi-ip27/ip27-console.o] Error 1
make[2]: *** [arch/mips/sgi-ip27] Error 2
make[1]: *** [arch/mips] Error 2
make: *** [sub-make] Error 2

use generic BUILD_BUG() instead of re-defining one.

---

arch/mips/include/asm/page.h +1 -3
index d417909..e14121a 100644
@@ -39,9 +39,7 @@
 #define HPAGE_MASK	(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
 #else /* !CONFIG_HUGETLB_PAGE */
-# ifndef BUILD_BUG
-#  define BUILD_BUG() do { extern void __build_bug(void); __build_bug(); } while (0)
-# endif
+#include <linux/kernel.h>
 #define HPAGE_SHIFT	({BUILD_BUG(); 0; })
 #define HPAGE_SIZE	({BUILD_BUG(); 0; })
 #define HPAGE_MASK	({BUILD_BUG(); 0; })
#1 lore raw

Hello.

Quoted 19 lines · Cong Wang

On mips, we got

include/linux/kernel.h:717:1: error: "BUILD_BUG" redefined arch/mips/include/asm/page.h:43:1: error: this is the location of the previous definition make[3]: *** [arch/mips/sgi-ip27/ip27-console.o] Error 1
make[2]: *** [arch/mips/sgi-ip27] Error 2
make[1]: *** [arch/mips] Error 2
make: *** [sub-make] Error 2

use generic BUILD_BUG() instead of re-defining one.

---

arch/mips/include/asm/page.h +0 -0
index d417909..e14121a 100644

arch/mips/include/asm/page.h line 42

Quoted 4 lines
arch/mips/include/asm/page.h +0 -1
@@ -39,9 +39,7 @@
  #define HPAGE_MASK	(~(HPAGE_SIZE - 1))
  #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
  #else /* !CONFIG_HUGETLB_PAGE */
-# ifndef BUILD_BUG

Not clear why we get the error if we're protected with #ifndef...

arch/mips/include/asm/page.h

Quoted 3 lines
arch/mips/include/asm/page.h +1 -2
-#  define BUILD_BUG() do { extern void __build_bug(void); __build_bug(); } while (0)
-# endif
+#include<linux/kernel.h>

Do not do #include among the #define's...

arch/mips/include/asm/page.h line 45

Quoted 3 lines
arch/mips/include/asm/page.h +0 -0
  #define HPAGE_SHIFT	({BUILD_BUG(); 0; })
  #define HPAGE_SIZE	({BUILD_BUG(); 0; })
  #define HPAGE_MASK	({BUILD_BUG(); 0; })

WBR, Sergei

#2 lore raw
Quoted 4 lines · Sergei Shtylyov
Quoted 3 lines

include/linux/kernel.h:717:1: error: "BUILD_BUG" redefined arch/mips/include/asm/page.h:43:1: error: this is the location of the previous definition

Quoted 9 lines

arch/mips/include/asm/page.h line 42

Quoted 7 lines
arch/mips/include/asm/page.h +0 -1
@@ -39,9 +39,7 @@
  #define HPAGE_MASK    (~(HPAGE_SIZE - 1))
  #define HUGETLB_PAGE_ORDER    (HPAGE_SHIFT - PAGE_SHIFT)
  #else /* !CONFIG_HUGETLB_PAGE */
-# ifndef BUILD_BUG

  Not clear why we get the error if we're protected with #ifndef...

Because this is the first definition. It's redefined later.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#3 lore raw
In reply to Cong Wang
Quoted 9 lines · Cong Wang

On mips, we got

include/linux/kernel.h:717:1: error: "BUILD_BUG" redefined arch/mips/include/asm/page.h:43:1: error: this is the location of the previous definition make[3]: *** [arch/mips/sgi-ip27/ip27-console.o] Error 1
make[2]: *** [arch/mips/sgi-ip27] Error 2
make[1]: *** [arch/mips] Error 2
make: *** [sub-make] Error 2

Quoted 3 lines

use generic BUILD_BUG() instead of re-defining one.

This is already fixed in linux-mips.org repository:

commit 2f5d5510507626ee799b6d1304d154569b6dfe05

Author: Ralf Baechle <[email protected]>
Date:   Mon Jan 16 12:38:05 2012 +0100

MIPS: Remove temporary kludge from <asm/page.h>

JC.