Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Cyrill Gorcunov
On Mon, Dec 19, 2011 at 11:50:31AM +0100, Ingo Molnar wrote: ... > > The tool-specific BUG() implementation can be added as a delta > on top of that. It's in fact better to keep those two steps > separate. > OK, will do on top. Cyrill -- To unsubscribe from this list: send the line "u

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Pekka Enberg
* Cyrill Gorcunov wrote: On Mon, Dec 19, 2011 at 11:40:09AM +0100, Ingo Molnar wrote: GDB will catch that signal. Yeah, good point! Pekka, drop this patch please, I'll make new one at evening. On Mon, 19 Dec 2011, Ingo Molnar wrote: Patch is good as-is IMO - assert() was used before so i

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Ingo Molnar
* Cyrill Gorcunov wrote: > On Mon, Dec 19, 2011 at 11:40:09AM +0100, Ingo Molnar wrote: > > > > GDB will catch that signal. > > > > Yeah, good point! Pekka, drop this patch please, I'll make new one at evening. Patch is good as-is IMO - assert() was used before so it's not a regression per

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Cyrill Gorcunov
On Mon, Dec 19, 2011 at 11:40:09AM +0100, Ingo Molnar wrote: > > GDB will catch that signal. > Yeah, good point! Pekka, drop this patch please, I'll make new one at evening. Cyrill -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vg

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Ingo Molnar
* Cyrill Gorcunov wrote: > +# > +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - > 2*!!(condition)])) > +#define BUG_ON(condition)assert(!(condition)) Just a sidenote, the patch is fine but the above will result in weird double negated assertion messages. it's better to just

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Pekka Enberg
On Mon, Dec 19, 2011 at 10:25 AM, Cyrill Gorcunov wrote: >> You don't need to convert all of them at the same time but we're not >> adding new assert() calls. >> > > You both (Pekka and Ingo) know the way how to convince people ;) > Something like below? Perfect! I'll apply it later today. Thanks

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Cyrill Gorcunov
On Mon, Dec 19, 2011 at 10:19:43AM +0200, Pekka Enberg wrote: > On Mon, Dec 19, 2011 at 09:13:28AM +0200, Pekka Enberg wrote: > >> > > >> >-    BUILD_BUG_ON(i > E820_X_MAX); > >> >+    assert(i <= E820_X_MAX); > >> > >> We should use BUG_ON() like tools/perf does. > > On Mon, Dec 19, 2011 at 9:57

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Pekka Enberg
On Mon, Dec 19, 2011 at 09:13:28AM +0200, Pekka Enberg wrote: >> > >> >-    BUILD_BUG_ON(i > E820_X_MAX); >> >+    assert(i <= E820_X_MAX); >> >> We should use BUG_ON() like tools/perf does. On Mon, Dec 19, 2011 at 9:57 AM, Cyrill Gorcunov wrote: > We dont have it yet. So I'll introduce this help

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-19 Thread Ingo Molnar
* Cyrill Gorcunov wrote: > On Mon, Dec 19, 2011 at 09:13:28AM +0200, Pekka Enberg wrote: > > > > > >- BUILD_BUG_ON(i > E820_X_MAX); > > >+ assert(i <= E820_X_MAX); > > > > We should use BUG_ON() like tools/perf does. > > > > We dont have it yet. So I'll introduce this helper later, > but no

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-18 Thread Cyrill Gorcunov
On Mon, Dec 19, 2011 at 09:13:28AM +0200, Pekka Enberg wrote: > > > >-BUILD_BUG_ON(i > E820_X_MAX); > >+assert(i <= E820_X_MAX); > > We should use BUG_ON() like tools/perf does. > We dont have it yet. So I'll introduce this helper later, but note that we will have to cover _all_ assert()

Re: [PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-18 Thread Pekka Enberg
On Mon, 19 Dec 2011, Cyrill Gorcunov wrote: BUILD_BUG_ON is unable to catch errors on expression which can't be evaluated at compile time. Signed-off-by: Cyrill Gorcunov --- tools/kvm/x86/bios.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-2.6.git/tools/kvm/x86/bios.c

[PATCH] kvm tools: Use assert() helper to check a variable value

2011-12-18 Thread Cyrill Gorcunov
BUILD_BUG_ON is unable to catch errors on expression which can't be evaluated at compile time. Signed-off-by: Cyrill Gorcunov --- tools/kvm/x86/bios.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-2.6.git/tools/kvm/x86/bios.c ===