Re: [PATCH] ARM: mx51: Fix build error due to missing include of <linux/bug.h>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Tue, Feb 28, 2012 at 10:03:33AM -0300, Fabio Estevam wrote:
> On Tue, Feb 28, 2012 at 9:53 AM, Russell King - ARM Linux
> <linux@xxxxxxxxxxxxxxxx> wrote:
> 
> > I think having the asm/bug.h replaced with linux/bug.h in linux/kernel.h
> > would be a better solution.
> 
> commit 6f863554 (kernel.h: doesn't explicitly use bug.h, so don't
> include it. ), which appears in linux-next, has removed asm/debug.h
> from linux/kernel.h.
> 
> I should have pointed this commit ID in my commit log.

No, this is not a fix, and it probably makes things worse.

linux/kernel.h _does_ use bug stuff - in ARRAY_SIZE().

ARRAY_SIZE() uses __must_be_array(), which is defined in linux/compiler-gcc.h,
which is obtained via linux/compiler.h and linux/linkage.h.

linux/compiler-gcc.h defines __must_be_array() to be:
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

and BUILD_BUG_ON_ZERO used to be in linux/kernel.h but got moved to
linux/bug.h.

Hence why people are seeing build breakage with ARRAY_SIZE().

The answer is not to start scattering lots of .c files with linux/bug.h
includes, but to fix linux/kernel.h.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


[Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [PDAs]     [Linux]     [Linux MIPS]     [Yosemite Campsites]     [Photos]

Add to Google Follow linuxarm on Twitter