From: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public•gmane.org>
To: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public•gmane.org>
Cc: Jan Beulich <JBeulich-Et1tbQHTxzrQT0dZR+AlfA@public•gmane.org>,
sfr-3FnU+UHB4dNDw9hX6IcOSA@public•gmane.org,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public•gmane.org,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public•gmane.org,
kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
linux-next-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
Subject: Re: [PATCH] BUILD_BUG_ON: make it handle more cases
Date: Thu, 22 Oct 2009 14:04:37 -0700 [thread overview]
Message-ID: <1256245477.7495.30.camel@slab.austin.ibm.com> (raw)
In-Reply-To: <200910201415.34361.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
On Tue, 2009-10-20 at 14:15 +1030, Rusty Russell wrote:
> BUILD_BUG_ON used to use the optimizer to do code elimination or fail
> at link time; it was changed to first the size of a negative array (a
> nicer compile time error), then (in
> 8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield.
>
> bitfields: needs a literal constant at parse time, and can't be put under
> "if (__builtin_constant_p(x))" for example.
> negative array: can handle anything, but if the compiler can't tell it's
> a constant, silently has no effect.
> link time: breaks link if the compiler can't determine the value, but the
> linker output is not usually as informative as a compiler error.
>
> If we use the negative-array-size method *and* the link time trick,
> we get the ability to use BUILD_BUG_ON() under __builtin_constant_p()
> branches, and maximal ability for the compiler to detect errors at
> build time.
>
> Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public•gmane.org>
Thanks Rusty, this indeed fixes the problem.
Acked-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public•gmane.org>
--
Hollis Blanchard
IBM Linux Technology Center
next prev parent reply other threads:[~2009-10-22 21:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-29 9:28 linux-next: tree build failure Jan Beulich
[not found] ` <4AC1E15502000078000516B5-Qfbpwmsw6RoS3W1tAdPHOtBPR1lH4CV8@public.gmane.org>
2009-09-29 9:51 ` roel kluin
[not found] ` <25e057c00909290251h55c0dc25o4ab1f2e84c920dca-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-30 6:29 ` Jan Beulich
2009-09-29 23:39 ` Hollis Blanchard
[not found] ` <1254267572.15622.1621.camel-yDUrRDS8jBVhsM67afOH+sxtgHpCUUYS@public.gmane.org>
2009-09-30 6:35 ` Jan Beulich
[not found] ` <4AC318450200007800017355-Qfbpwmsw6RoS3W1tAdPHOtBPR1lH4CV8@public.gmane.org>
2009-10-02 15:48 ` Hollis Blanchard
2009-10-05 6:58 ` Jan Beulich
2009-10-09 19:14 ` Hollis Blanchard
2009-10-14 22:57 ` Hollis Blanchard
2009-10-15 7:27 ` Jan Beulich
2009-10-19 18:19 ` Hollis Blanchard
2009-10-20 1:12 ` Rusty Russell
[not found] ` <200910201142.34006.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2009-10-20 1:29 ` Hollis Blanchard
2009-10-20 3:45 ` [PATCH] BUILD_BUG_ON: make it handle more cases Rusty Russell
2009-10-20 13:58 ` Américo Wang
2009-10-20 14:43 ` Alan Jenkins
[not found] ` <9b2b86520910200743h4e134cf8jd2860d42b3936597-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-23 1:50 ` Américo Wang
2009-10-29 21:30 ` Hollis Blanchard
[not found] ` <200910201415.34361.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2009-10-22 21:04 ` Hollis Blanchard [this message]
2009-11-05 0:20 ` Stephen Rothwell
2009-11-05 6:28 ` Rusty Russell
[not found] ` <200911051658.36265.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2009-11-05 6:37 ` Rusty Russell
2009-11-05 6:38 ` Stephen Rothwell
[not found] ` <20091105173842.c94ba501.sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
2009-11-06 6:30 ` Rusty Russell
2009-11-05 6:01 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1256245477.7495.30.camel@slab.austin.ibm.com \
--to=hollisb-r/jw6+rmf7hqt0dzr+alfa@public$(echo .)gmane.org \
--cc=JBeulich-Et1tbQHTxzrQT0dZR+AlfA@public$(echo .)gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public$(echo .)gmane.org \
--cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=linux-next-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public$(echo .)gmane.org \
--cc=rusty-8n+1lVoiYb80n/F98K4Iww@public$(echo .)gmane.org \
--cc=sfr-3FnU+UHB4dNDw9hX6IcOSA@public$(echo .)gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox