Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Eric Blake
On 04/28/2017 10:10 AM, Daniel P. Berrange wrote: >>> Or could we perhaps instead undo the damage via a hack like >>> >>> #define g_assert_cmpint g_assert_cmpint_orig >>> #define g_assert_cmpint(x, y, z) \ >>> g_assert_cmpint_orig(x, y,x); \ >>> abort() Not quite the right hack (we do

Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Daniel P. Berrange
On Fri, Apr 28, 2017 at 02:45:32PM +0100, Dr. David Alan Gilbert wrote: > * Daniel P. Berrange (berra...@redhat.com) wrote: > > On Thu, Apr 27, 2017 at 05:55:26PM +0100, Dr. David Alan Gilbert (git) > > wrote: > > > From: "Dr. David Alan Gilbert" > > > > > > Glib commit a6a875068779 (from 2013)

Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Eric Blake
On 04/28/2017 08:34 AM, Markus Armbruster wrote: >> >> Ban most of the glib assertion functions (basically everything except >> g_assert and g_assert_not_reached) except in tests/ You'll also want to exclude scripts/ and possible include/glib-compat.h... > If these are screwy enough to warrant

Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Peter Maydell
On 28 April 2017 at 14:34, Markus Armbruster wrote: > If these are screwy enough to warrant rejecting them in new code, > they're probably screwy enough to purge them from existing code: > > include/glib-compat.h:#ifndef g_assert_true > include/glib-compat.h:#define g_assert_true(expr) T

Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Dr. David Alan Gilbert
* Daniel P. Berrange (berra...@redhat.com) wrote: > On Thu, Apr 27, 2017 at 05:55:26PM +0100, Dr. David Alan Gilbert (git) wrote: > > From: "Dr. David Alan Gilbert" > > > > Glib commit a6a875068779 (from 2013) made many of the glib assert > > macros non-fatal if a flag is set. > > This causes two

Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Daniel P. Berrange
On Thu, Apr 27, 2017 at 05:55:26PM +0100, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" > > Glib commit a6a875068779 (from 2013) made many of the glib assert > macros non-fatal if a flag is set. > This causes two problems: > a) Compilers moan that your code is unsafe even

Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Markus Armbruster
"Dr. David Alan Gilbert (git)" writes: > From: "Dr. David Alan Gilbert" > > Glib commit a6a875068779 (from 2013) made many of the glib assert > macros non-fatal if a flag is set. > This causes two problems: > a) Compilers moan that your code is unsafe even though you've > put an assert in

Re: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-28 Thread Paolo Bonzini
- Original Message - > From: "Dr. David Alan Gilbert (git)" > To: qemu-devel@nongnu.org, pbonz...@redhat.com, arm...@redhat.com > Sent: Thursday, April 27, 2017 6:55:26 PM > Subject: [Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code > > F

[Qemu-devel] [PATCH] checkpatch: Disallow glib asserts in main code

2017-04-27 Thread Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" Glib commit a6a875068779 (from 2013) made many of the glib assert macros non-fatal if a flag is set. This causes two problems: a) Compilers moan that your code is unsafe even though you've put an assert in before the point of use. b) Someone evil could, in