Subject: Re: error: implicit declarations of BUG/BUG_ON/WARN_ON/WARN_ON_ONCE

From: Fengguang Wu <[email-masked]>
Date: Fri, 22 Jun 2012 15:13:05 +0800

On Mon, Jun 18, 2012 at 09:54:40AM -0700, Randy Dunlap wrote:
> On 06/15/2012 09:27 AM, Randy Dunlap wrote:
> 
> > On 06/14/2012 11:52 PM, Fengguang Wu wrote:
> > 
> >> On Fri, Jun 15, 2012 at 02:33:03PM +1000, Stephen Rothwell wrote:
> >>> Hi all,
> >>>
> >>> Changes since 20120614:
> >>>
> >>> My fixes tree contains:
> >>> 	fix bug.h's inclusion of kernel.h
> >>
> >> I got these errors with the attached randconfig. Not sure which change
> >> triggers them.
> > 
> > Ditto.  When CONFIG_BUG is not enabled.
> 
> 
> This problem is still in linux-next of 20120618...

It's now in Linus' tree..

Paul, any idea to fix this? The attached .config can reproduce the bug.

2603efa31a0377eeaa06723bded8a1d644dd4901 is the first bad commit

commit 2603efa31a0377eeaa06723bded8a1d644dd4901
Author: Paul Mundt <[email-masked]>
Date:   Mon Jun 18 13:54:17 2012 +0900

    bug.h: Fix up powerpc build regression.

    The asm-generic/bug.h __ASSEMBLY__ guarding is completely bogus, which
    tripped up the powerpc build when the kernel.h include was added:

        In file included from include/asm-generic/bug.h:5:0,
                         from arch/powerpc/include/asm/bug.h:127,
                         from arch/powerpc/kernel/head_64.S:31:
        include/linux/kernel.h:44:0: warning: "ALIGN" redefined [enabled by default]
        include/linux/linkage.h:57:0: note: this is the location of the previous definition
        include/linux/sysinfo.h: Assembler messages:
        include/linux/sysinfo.h:7: Error: Unrecognized opcode: `struct'
        include/linux/sysinfo.h:8: Error: Unrecognized opcode: `__kernel_long_t'

    Moving the __ASSEMBLY__ guard up and stashing the kernel.h include under
    it fixes this up, as well as covering the case the original fix was
    attempting to handle.

    Tested-by: Stephen Rothwell <[email-masked]>
    Acked-by: Arnd Bergmann <[email-masked]>
    Signed-off-by: Paul Mundt <[email-masked]>
    Signed-off-by: Linus Torvalds <[email-masked]>

:040000 040000 bc1fd62eeb2dfd9163a34b249ac39b568cfd4395 573f2854b3ae3ed58fe93b126159d6d47d9263bd M      include
bisect run success

Thanks,
Fengguang

> 
> > 
> >>   CC      arch/x86/kernel/asm-offsets.s
> >> In file included from /c/kernel-tests/mm/arch/x86/include/asm/atomic.h:6:0,
> >>                  from /c/kernel-tests/mm/include/linux/atomic.h:4,
> >>                  from /c/kernel-tests/mm/include/linux/crypto.h:20,
> >>                  from /c/kernel-tests/mm/arch/x86/kernel/asm-offsets.c:8:
> >> /c/kernel-tests/mm/arch/x86/include/asm/processor.h: In function 慻et_aperfmperf?:
> >> /c/kernel-tests/mm/arch/x86/include/asm/processor.h:937:2: error: implicit declaration of function 慦ARN_ON_ONCE? [-Werror=implicit-function-declaration]
> >> In file included from /c/kernel-tests/mm/include/linux/thread_info.h:54:0,
> >>                  from /c/kernel-tests/mm/include/linux/preempt.h:9,
> >>                  from /c/kernel-tests/mm/include/linux/spinlock.h:50,
> >>                  from /c/kernel-tests/mm/include/linux/mmzone.h:7,
> >>                  from /c/kernel-tests/mm/include/linux/gfp.h:4,
> >>                  from /c/kernel-tests/mm/include/linux/slab.h:12,
> >>                  from /c/kernel-tests/mm/include/linux/crypto.h:24,
> >>                  from /c/kernel-tests/mm/arch/x86/kernel/asm-offsets.c:8:
> >> /c/kernel-tests/mm/arch/x86/include/asm/thread_info.h: In function 憇et_restore_sigmask?:
> >> /c/kernel-tests/mm/arch/x86/include/asm/thread_info.h:250:2: error: implicit declaration of function 慦ARN_ON? [-Werror=implicit-function-declaration]
> >> In file included from /c/kernel-tests/mm/include/linux/mmzone.h:717:0,
> >>                  from /c/kernel-tests/mm/include/linux/gfp.h:4,
> >>                  from /c/kernel-tests/mm/include/linux/slab.h:12,
> >>                  from /c/kernel-tests/mm/include/linux/crypto.h:24,
> >>                  from /c/kernel-tests/mm/arch/x86/kernel/asm-offsets.c:8:
> >> /c/kernel-tests/mm/include/linux/memory_hotplug.h: In function 慻eneric_alloc_nodedata?:
> >> /c/kernel-tests/mm/include/linux/memory_hotplug.h:152:2: error: implicit declaration of function 態UG? [-Werror=implicit-function-declaration]                                               
> >> In file included from /c/kernel-tests/mm/arch/x86/include/asm/apic.h:12:0,                                                                
> >>                  from /c/kernel-tests/mm/arch/x86/include/asm/smp.h:13,
> >>                  from /c/kernel-tests/mm/include/linux/smp.h:38,
> >>                  from /c/kernel-tests/mm/include/linux/topology.h:33,
> >>                  from /c/kernel-tests/mm/include/linux/gfp.h:7,
> >>                  from /c/kernel-tests/mm/include/linux/slab.h:12,
> >>                  from /c/kernel-tests/mm/include/linux/crypto.h:24,
> >>                  from /c/kernel-tests/mm/arch/x86/kernel/asm-offsets.c:8:
> >> /c/kernel-tests/mm/arch/x86/include/asm/fixmap.h: In function 憊irt_to_fix?:
> >> /c/kernel-tests/mm/arch/x86/include/asm/fixmap.h:220:2: error: implicit declaration of function 態UG_ON? [-Werror=implicit-function-declaration]
> >>   HOSTLD  scripts/genksyms/genksyms
> >> cc1: some warnings being treated as errors
> >> make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
> >> make[1]: *** [prepare0] Error 2
> >> make[1]: *** Waiting for unfinished jobs....
> >>
> >> Thanks,
> >> Fengguang
> > 
> > 
> > 
> 
> 
> 
> -- 
> ~Randy