From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
qemu-devel@nongnu.org, afaerber@suse.de, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH v1 0/5] Add error_abort and associated cleanups
Date: Wed, 04 Dec 2013 07:46:31 -0700 [thread overview]
Message-ID: <529F4047.4000104@redhat.com> (raw)
In-Reply-To: <87bo0xnfos.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]
On 12/04/2013 02:11 AM, Markus Armbruster wrote:
> No objection to asserting that the caller passed an error object when
> the error object is the only way to signal failure. You can't force
> your callers to check for failure, but the assertion could help prevent
> accidental misuse.
>
> Assertions fire at run-time, though.
Unfortunately true.
>
> Asserting "argument not null" first thing in the function should enable
> a sufficiently smart whole-program static checker to flag null
> arguments.
Coverity is such a checker; I think clang can as well.
>
> But having such a static check right at compile-time would be much
> better. Could attribute nonnull do it? If yes, do we still need the
> assertion?
gcc's implementation of attribute nonnull is complete trash. And the
gcc developers know it. The attribute is still useful for Coverity, but
at least in libvirt, we have taken to using the attribute ONLY when
compiling under a static checker and omitting it under gcc because gcc's
implementation of the attribute is so horribly botched.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308
So even with attribute nonnull, you still need the assertion.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
next prev parent reply other threads:[~2013-12-04 14:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 5:49 [Qemu-devel] [RFC PATCH v1 0/5] Add error_abort and associated cleanups Peter Crosthwaite
2013-12-03 5:49 ` [Qemu-devel] [RFC PATCH v1 1/5] error: Add error_abort Peter Crosthwaite
2013-12-03 5:50 ` [Qemu-devel] [RFC PATCH v1 2/5] hw: Remove assert_no_error usages Peter Crosthwaite
2013-12-03 9:35 ` Markus Armbruster
2013-12-03 10:04 ` Peter Crosthwaite
2013-12-03 5:51 ` [Qemu-devel] [RFC PATCH v1 3/5] target-i386: Remove assert_no_error usage Peter Crosthwaite
2013-12-03 5:51 ` [Qemu-devel] [RFC PATCH v1 4/5] qemu-option: Remove qemu_opts_create_nofail Peter Crosthwaite
2013-12-03 9:42 ` Markus Armbruster
2013-12-03 10:17 ` Peter Crosthwaite
2013-12-03 10:44 ` Markus Armbruster
2013-12-04 6:45 ` Peter Crosthwaite
2013-12-03 5:52 ` [Qemu-devel] [RFC PATCH v1 5/5] qerror: Remove assert_no_error() Peter Crosthwaite
2013-12-03 9:44 ` [Qemu-devel] [RFC PATCH v1 0/5] Add error_abort and associated cleanups Markus Armbruster
2013-12-03 11:49 ` Igor Mammedov
2013-12-03 11:57 ` Paolo Bonzini
2013-12-03 12:03 ` Peter Crosthwaite
2013-12-03 12:58 ` Eric Blake
2013-12-03 13:53 ` Markus Armbruster
2013-12-03 20:33 ` Igor Mammedov
2013-12-03 20:43 ` Eric Blake
2013-12-04 9:11 ` Markus Armbruster
2013-12-04 14:46 ` Eric Blake [this message]
2013-12-05 10:37 ` Paolo Bonzini
2013-12-05 15:32 ` Igor Mammedov
2013-12-05 15:59 ` Paolo Bonzini
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=529F4047.4000104@redhat.com \
--to=eblake@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
/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).