All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: sfr@canb.auug.org.au, akpm@linux-foundation.org,
	linuxppc-dev@lists.ozlabs.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-next@vger.kernel.org
Subject: Re: linux-next: tree build failure
Date: Mon, 19 Oct 2009 11:19:29 -0700	[thread overview]
Message-ID: <1255976369.13995.98.camel@slab.beaverton.ibm.com> (raw)
In-Reply-To: <4AD6EB17020000780001A050@vpn.id2.novell.com>

On Thu, 2009-10-15 at 08:27 +0100, Jan Beulich wrote:
> >>> Hollis Blanchard <hollisb@us.ibm.com> 15.10.09 00:57 >>>
> >On Fri, 2009-10-09 at 12:14 -0700, Hollis Blanchard wrote:
> >> Rusty's version of BUILD_BUG_ON() does indeed fix the build break, and
> >> also exposes the bug in kvmppc_account_exit_stat(). So to recap:
> >> 
> >> original: built but didn't work
> >> Jan's: doesn't build
> >> Rusty's: builds and works
> >> 
> >> Where do you want to go from here?
> >
> >Jan, what are your thoughts? Your BUILD_BUG_ON patch has broken the
> >build, and we still need to fix it.
> 
> My perspective is that it just uncovered already existing brokenness. And
> honestly, I won't be able to get to look into this within the next days. (And
> btw., when I run into issues with other people's code changes, quite
> frequently I'm told to propose a patch, so I'm also having some
> philosophical problem understanding why I can't simply expect the same
> when people run into issues with changes I made, especially in cases like
> this where it wasn't me introducing the broken code.) So, if this can wait
> for a couple of days, I can try to find time to look into this. Otherwise, I'd
> rely on someone running into the actual issue to implement a solution.

Sorry, I thought it was clear, but to be more explicit: I propose the
following patch, which replaces the current BUILD_BUG_ON implementation
with Rusty's version.

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -677,18 +677,19 @@ struct sysinfo {
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
-/* Force a compilation error if condition is true */
-#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
-
-/* Force a compilation error if condition is constant and true */
-#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
-
-/* Force a compilation error if condition is true, but also produce a
-   result (of value 0 and type size_t), so the expression can be used
-   e.g. in a structure initializer (or where-ever else comma expressions
-   aren't permitted). */
-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
-#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
+#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_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
+#define BUILD_BUG_ON(condition) \
+		do {                                                            \
+				((void)sizeof(char[1 - 2*!!(condition)]));              \
+				if (condition) __build_bug_on_failed = 1;               \
+		} while(0)
+#define MAYBE_BUILD_BUG_ON(condition) BUILD_BUG_ON(condition)
+#endif
 
 /* Trap pasters of __FUNCTION__ at compile-time */
 #define __FUNCTION__ (__func__)


-- 
Hollis Blanchard
IBM Linux Technology Center


WARNING: multiple messages have this Message-ID (diff)
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Jan Beulich <JBeulich@novell.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, 19 Oct 2009 11:19:29 -0700	[thread overview]
Message-ID: <1255976369.13995.98.camel@slab.beaverton.ibm.com> (raw)
In-Reply-To: <4AD6EB17020000780001A050@vpn.id2.novell.com>

On Thu, 2009-10-15 at 08:27 +0100, Jan Beulich wrote:
> >>> Hollis Blanchard <hollisb@us.ibm.com> 15.10.09 00:57 >>>
> >On Fri, 2009-10-09 at 12:14 -0700, Hollis Blanchard wrote:
> >> Rusty's version of BUILD_BUG_ON() does indeed fix the build break, and
> >> also exposes the bug in kvmppc_account_exit_stat(). So to recap:
> >> 
> >> original: built but didn't work
> >> Jan's: doesn't build
> >> Rusty's: builds and works
> >> 
> >> Where do you want to go from here?
> >
> >Jan, what are your thoughts? Your BUILD_BUG_ON patch has broken the
> >build, and we still need to fix it.
> 
> My perspective is that it just uncovered already existing brokenness. And
> honestly, I won't be able to get to look into this within the next days. (And
> btw., when I run into issues with other people's code changes, quite
> frequently I'm told to propose a patch, so I'm also having some
> philosophical problem understanding why I can't simply expect the same
> when people run into issues with changes I made, especially in cases like
> this where it wasn't me introducing the broken code.) So, if this can wait
> for a couple of days, I can try to find time to look into this. Otherwise, I'd
> rely on someone running into the actual issue to implement a solution.

Sorry, I thought it was clear, but to be more explicit: I propose the
following patch, which replaces the current BUILD_BUG_ON implementation
with Rusty's version.

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -677,18 +677,19 @@ struct sysinfo {
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
-/* Force a compilation error if condition is true */
-#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
-
-/* Force a compilation error if condition is constant and true */
-#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
-
-/* Force a compilation error if condition is true, but also produce a
-   result (of value 0 and type size_t), so the expression can be used
-   e.g. in a structure initializer (or where-ever else comma expressions
-   aren't permitted). */
-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
-#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
+#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_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
+#define BUILD_BUG_ON(condition) \
+		do {                                                            \
+				((void)sizeof(char[1 - 2*!!(condition)]));              \
+				if (condition) __build_bug_on_failed = 1;               \
+		} while(0)
+#define MAYBE_BUILD_BUG_ON(condition) BUILD_BUG_ON(condition)
+#endif
 
 /* Trap pasters of __FUNCTION__ at compile-time */
 #define __FUNCTION__ (__func__)


-- 
Hollis Blanchard
IBM Linux Technology Center

WARNING: multiple messages have this Message-ID (diff)
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: sfr@canb.auug.org.au, akpm@linux-foundation.org,
	linuxppc-dev@lists.ozlabs.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-next@vger.kernel.org
Subject: Re: linux-next: tree build failure
Date: Mon, 19 Oct 2009 18:19:29 +0000	[thread overview]
Message-ID: <1255976369.13995.98.camel@slab.beaverton.ibm.com> (raw)
In-Reply-To: <4AD6EB17020000780001A050@vpn.id2.novell.com>

On Thu, 2009-10-15 at 08:27 +0100, Jan Beulich wrote:
> >>> Hollis Blanchard <hollisb@us.ibm.com> 15.10.09 00:57 >>>
> >On Fri, 2009-10-09 at 12:14 -0700, Hollis Blanchard wrote:
> >> Rusty's version of BUILD_BUG_ON() does indeed fix the build break, and
> >> also exposes the bug in kvmppc_account_exit_stat(). So to recap:
> >> 
> >> original: built but didn't work
> >> Jan's: doesn't build
> >> Rusty's: builds and works
> >> 
> >> Where do you want to go from here?
> >
> >Jan, what are your thoughts? Your BUILD_BUG_ON patch has broken the
> >build, and we still need to fix it.
> 
> My perspective is that it just uncovered already existing brokenness. And
> honestly, I won't be able to get to look into this within the next days. (And
> btw., when I run into issues with other people's code changes, quite
> frequently I'm told to propose a patch, so I'm also having some
> philosophical problem understanding why I can't simply expect the same
> when people run into issues with changes I made, especially in cases like
> this where it wasn't me introducing the broken code.) So, if this can wait
> for a couple of days, I can try to find time to look into this. Otherwise, I'd
> rely on someone running into the actual issue to implement a solution.

Sorry, I thought it was clear, but to be more explicit: I propose the
following patch, which replaces the current BUILD_BUG_ON implementation
with Rusty's version.

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -677,18 +677,19 @@ struct sysinfo {
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
-/* Force a compilation error if condition is true */
-#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
-
-/* Force a compilation error if condition is constant and true */
-#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
-
-/* Force a compilation error if condition is true, but also produce a
-   result (of value 0 and type size_t), so the expression can be used
-   e.g. in a structure initializer (or where-ever else comma expressions
-   aren't permitted). */
-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
-#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
+#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_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
+#define BUILD_BUG_ON(condition) \
+		do {                                                            \
+				((void)sizeof(char[1 - 2*!!(condition)]));              \
+				if (condition) __build_bug_on_failed = 1;               \
+		} while(0)
+#define MAYBE_BUILD_BUG_ON(condition) BUILD_BUG_ON(condition)
+#endif
 
 /* Trap pasters of __FUNCTION__ at compile-time */
 #define __FUNCTION__ (__func__)


-- 
Hollis Blanchard
IBM Linux Technology Center


  reply	other threads:[~2009-10-19 18:19 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-29  9:28 linux-next: tree build failure Jan Beulich
2009-09-29  9:28 ` Jan Beulich
2009-09-29  9:28 ` Jan Beulich
2009-09-29  9:28 ` Jan Beulich
2009-09-29  9:51 ` roel kluin
2009-09-29  9:51   ` roel kluin
2009-09-29  9:51   ` roel kluin
2009-09-29  9:51   ` roel kluin
2009-09-30  6:29   ` Jan Beulich
2009-09-30  6:29     ` Jan Beulich
2009-09-30  6:29     ` Jan Beulich
2009-09-30  6:29     ` Jan Beulich
2009-09-29 23:39 ` Hollis Blanchard
2009-09-29 23:39   ` Hollis Blanchard
2009-09-29 23:39   ` Hollis Blanchard
2009-09-29 23:39   ` Hollis Blanchard
2009-09-30  6:35   ` Jan Beulich
2009-09-30  6:35     ` Jan Beulich
2009-09-30  6:35     ` Jan Beulich
2009-09-30  6:35     ` Jan Beulich
2009-10-02 15:48     ` Hollis Blanchard
2009-10-02 15:48       ` Hollis Blanchard
2009-10-02 15:48       ` Hollis Blanchard
2009-10-02 15:48       ` Hollis Blanchard
2009-10-05  6:58       ` Jan Beulich
2009-10-05  6:58         ` Jan Beulich
2009-10-05  6:58         ` Jan Beulich
2009-10-05  6:58         ` Jan Beulich
2009-10-09 19:14         ` Hollis Blanchard
2009-10-09 19:14           ` Hollis Blanchard
2009-10-09 19:14           ` Hollis Blanchard
2009-10-14 22:57           ` Hollis Blanchard
2009-10-14 22:57             ` Hollis Blanchard
2009-10-14 22:57             ` Hollis Blanchard
2009-10-15  7:27             ` Jan Beulich
2009-10-15  7:27               ` Jan Beulich
2009-10-15  7:27               ` Jan Beulich
2009-10-15  7:27               ` Jan Beulich
2009-10-19 18:19               ` Hollis Blanchard [this message]
2009-10-19 18:19                 ` Hollis Blanchard
2009-10-19 18:19                 ` Hollis Blanchard
2009-10-20  1:12                 ` Rusty Russell
2009-10-20  1:24                   ` Rusty Russell
2009-10-20  1:12                   ` Rusty Russell
2009-10-20  1:29                   ` Hollis Blanchard
2009-10-20  1:29                     ` Hollis Blanchard
2009-10-20  1:29                     ` Hollis Blanchard
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  3:57                       ` Rusty Russell
2009-10-20  3:45                       ` Rusty Russell
2009-10-20  3:45                       ` Rusty Russell
2009-10-20 13:58                       ` Américo Wang
2009-10-20 13:58                         ` Américo Wang
2009-10-20 13:58                         ` Américo Wang
2009-10-20 14:43                         ` Alan Jenkins
2009-10-20 14:43                           ` Alan Jenkins
2009-10-20 14:43                           ` Alan Jenkins
2009-10-23  1:50                           ` Américo Wang
2009-10-23  1:50                             ` Américo Wang
2009-10-23  1:50                             ` Américo Wang
2009-10-23  1:50                             ` Américo Wang
2009-10-22 21:04                       ` Hollis Blanchard
2009-10-22 21:04                         ` Hollis Blanchard
2009-10-22 21:04                         ` Hollis Blanchard
2009-10-22 21:04                         ` Hollis Blanchard
2009-10-29 21:30                       ` Hollis Blanchard
2009-10-29 21:30                         ` Hollis Blanchard
2009-10-29 21:30                         ` Hollis Blanchard
2009-11-05  0:20                       ` Stephen Rothwell
2009-11-05  0:20                         ` Stephen Rothwell
2009-11-05  0:20                         ` Stephen Rothwell
2009-11-05  0:20                         ` Stephen Rothwell
2009-11-05  6:28                         ` Rusty Russell
2009-11-05  6:40                           ` Rusty Russell
2009-11-05  6:28                           ` Rusty Russell
2009-11-05  6:37                           ` Rusty Russell
2009-11-05  6:49                             ` Rusty Russell
2009-11-05  6:37                             ` Rusty Russell
2009-11-05  6:37                             ` Rusty Russell
2009-11-05  6:38                           ` Stephen Rothwell
2009-11-05  6:38                             ` Stephen Rothwell
2009-11-05  6:38                             ` Stephen Rothwell
2009-11-06  6:30                             ` Rusty Russell
2009-11-06  6:42                               ` Rusty Russell
2009-11-06  6:30                               ` Rusty Russell
2009-11-06  6:30                               ` Rusty Russell
2009-11-05  6:01                       ` Benjamin Herrenschmidt
2009-11-05  6:01                         ` Benjamin Herrenschmidt
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-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
2009-09-24  5:21 ` Stephen Rothwell
2009-09-24  5:21 ` Stephen Rothwell
2009-09-29  0:00 ` Hollis Blanchard
2009-09-29  0:00   ` Hollis Blanchard
2009-09-29  0:00   ` Hollis Blanchard
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=1255976369.13995.98.camel@slab.beaverton.ibm.com \
    --to=hollisb@us.ibm.com \
    --cc=JBeulich@novell.com \
    --cc=akpm@linux-foundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.