linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@novell.com>
To: Hollis Blanchard <hollisb@us.ibm.com>
Cc: sfr@canb.auug.org.au, Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org,
	linux-next@vger.kernel.org, akpm@linux-foundation.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: linux-next: tree build failure
Date: Mon, 05 Oct 2009 07:58:25 +0100	[thread overview]
Message-ID: <4AC9B5310200007800017EA1@vpn.id2.novell.com> (raw)
In-Reply-To: <1254498517.3839.17.camel@slab.beaverton.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

>>> Hollis Blanchard <hollisb@us.ibm.com> 02.10.09 17:48 >>>
>On Wed, 2009-09-30 at 07:35 +0100, Jan Beulich wrote:
>> The one Rusty suggested the other day may help here. I don't like it
>> as a drop-in replacement for BUILD_BUG_ON() though (due to it
>> deferring the error generated to the linking stage), I'd rather view
>> this as an improvement to MAYBE_BUILD_BUG_ON() (which should
>> then be used here).
>
>Can you be more specific?
>
>I have no idea what Rusty suggested where. I can't even guess what

I'm attaching Rusty's response I was referring to.

>MAYBE_BUILD_BUG_ON() is supposed to do (sounds like a terrible name).

Agreed - but presumably better than just deleting the bogus instances
altogether...

Jan

[-- Attachment #2: Type: message/rfc822, Size: 2578 bytes --]

From: Rusty Russell <rusty@rustcorp.com.au>
To: "Jan Beulich" <JBeulich@novell.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix BUILD_BUG_ON() and a couple of bogus uses of it
Date: Wed, 23 Sep 2009 10:27:00 +0930
Message-ID: <200909231027.01006.rusty@rustcorp.com.au>

On Wed, 19 Aug 2009 01:29:25 am Jan Beulich wrote:
> gcc permitting variable length arrays makes the current construct
> used for BUILD_BUG_ON() useless, as that doesn't produce any diagnostic
> if the controlling expression isn't really constant. Instead, this
> patch makes it so that a bit field gets used here. Consequently, those
> uses where the condition isn't really constant now also need fixing.
> 
> Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
> MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even
> if the expression is compile time constant (__builtin_constant_p()
> yields true), the array is still deemed of variable length by gcc, and
> hence the whole expression doesn't have the intended effect.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>

We used to use an undefined symbol here; diagnostics are worse but it catches
more stuff.

Perhaps a hybrid is the way to go?

#ifndef __OPTIMIZE__
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#else
/* If it's a constant, catch it at compile time, otherwise at link time. */
extern int __build_bug_on_failed;
#define BUILD_BUG_ON(condition) \
	do { 								\
		((void)sizeof(char[1 - 2*!!(condition)]));		\
		if (condition) __build_bug_on_failed = 1;		\
	} while(0)
#endif

Thanks,
Rusty.

[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

  reply	other threads:[~2009-10-05  6:58 UTC|newest]

Thread overview: 64+ 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 [this message]
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
     [not found]                               ` <200910201415.34361.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2009-10-22 21:04                                 ` Hollis Blanchard
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-10-29 21:30                               ` Hollis Blanchard
2009-11-05  6:01                               ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2009-12-16  7:21 linux-next: tree build failure Stephen Rothwell
2009-12-16  9:02 ` Felipe Balbi
2009-12-16 10:10 ` Liam Girdwood
2009-10-01  3:19 Stephen Rothwell
2009-10-01  7:58 ` Jens Axboe
2009-10-01 10:41   ` Stephen Rothwell
2009-09-24  5:21 Stephen Rothwell
     [not found] ` <20090924152102.8d7d40cf.sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
2009-09-29  0:00   ` Hollis Blanchard
2009-08-17  8:39 Stephen Rothwell
2009-08-03  0:35 Stephen Rothwell
2009-08-03  1:01 ` NeilBrown
2009-08-03  1:30   ` Stephen Rothwell
2009-07-27  7:53 Stephen Rothwell
2009-07-27  9:21 ` Karsten Keil
2009-07-27 15:06   ` David Miller
2009-07-28  4:22     ` Stephen Rothwell
2009-04-07  3:41 Stephen Rothwell
2009-04-07 10:00 ` Mark Brown
2009-04-08  1:48 ` Takashi Iwai
2009-03-23  9:38 Stephen Rothwell
2009-03-23 22:27 ` Mauro Carvalho Chehab
2009-03-23 23:25   ` Stephen Rothwell
2009-03-05  7:41 Stephen Rothwell
2009-03-06  5:01 ` Rusty Russell
2009-01-16  5:37 Stephen Rothwell
2009-01-16  7:25 ` Peter Zijlstra
2009-01-16  9:03   ` Ingo Molnar
2009-01-16 10:39     ` Stephen Rothwell
2009-01-16 10:53 ` Ingo Molnar
2009-01-16 11:53   ` Stephen Rothwell
2009-01-16 12:32     ` Ingo Molnar
2008-11-28 10:04 Stephen Rothwell
2008-11-28 10:25 ` Takashi Iwai
2008-11-28 10:43   ` Stephen Rothwell
2008-11-28 17:23     ` Takashi Iwai
2008-10-21  8:30 Stephen Rothwell
2008-08-25 10:33 Stephen Rothwell
2008-08-25 16:36 ` Steven Rostedt
2008-06-30 14:35 Stephen Rothwell

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=4AC9B5310200007800017EA1@vpn.id2.novell.com \
    --to=jbeulich@novell.com \
    --cc=akpm@linux-foundation.org \
    --cc=hollisb@us.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).