[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwj1eajCY2cF-xBzUqfnoZz+u1EGzWUsJBDnjWes3qj8g@mail.gmail.com>
Date: Mon, 21 Nov 2011 20:35:36 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: David Daney <ddaney.cavm@...il.com>
Cc: ralf@...ux-mips.org, Andrew Morton <akpm@...ux-foundation.org>,
David Rientjes <rientjes@...gle.com>,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
David Daney <david.daney@...ium.com>
Subject: Re: [PATCH 1/2] kernel.h: Add BUILD_BUG_ON_USED() macro.
On Mon, Nov 21, 2011 at 5:31 PM, David Daney <ddaney.cavm@...il.com> wrote:
>
> The GCC function attribute error("message") was added in version 4.3,
> so we define a new macro __linktime_error(message) to expand to this
> for GCC-4.3 and later. This will give us an error diagnostic from the
> compiler on the line that fails. For other compilers
> __linktime_error(message) expands to nothing, and we have to be
> content with a link time error, but at least we will still get a build
> error.
Ok. This looks quite reasonable, and I suspect we could replace some
of the other cases that currently use link-time errors with this and
get slightly better error reporting. It also looks like we should use
this __attribute__((__error__())) approach for our current
BUILD_BUG_ON() thing, instead of playing with the whole "negative
array size" thing.
And it does seem like glibc already uses this thing heavily, so we can
even expect it to work.
That said, I'm still not comfy actually applying these patches during
the -rc series. But for the next merge window, no problem.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists