[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' inst
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments |
Date: |
Tue, 27 Jun 2017 15:12:25 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
On 06/19/2017 08:26 AM, Eduardo Habkost wrote:
>> Is gcc's __attribute__((nonnull)) any better? It seems to apply
>> to the whole function prototype rather than an individual argument
>> though so probably not :-(
>
> It's possible to specify which arguments are non-null with
> nonnull(<arg-index>, ...). It's harder to use, but probably more
> Coccinelle-friendly.
Libvirt uses it, wrapped in a macro; for example:
int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virCPUDefCopyModel(virCPUDefPtr dst,
const virCPUDef *src,
bool resetPolicy)
{ ...
and at least Coverity is able to use that information (libvirt had
problems in the past where older gcc _silently_ mis-optimized a program
that used the attribute, and ended up having our macro defined only
during Coverity and not during normal compilation; but I think that's
finally been resolved now that newer gcc is saner in its behavior). I
don't know how much smarts Coccinelle has for coming up with the right
parameter number in an automated conversion patch, though.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [RFC 09/15] [coccinelle] Use ERR_IS_* macros, (continued)
- [Qemu-devel] [RFC 09/15] [coccinelle] Use ERR_IS_* macros, Eduardo Habkost, 2017/06/13
- [Qemu-devel] [RFC 12/15] error: Make IGNORED_ERRORS not a NULL pointer, Eduardo Habkost, 2017/06/13
- [Qemu-devel] [RFC 13/15] rdma: Simplify var declaration to avoid confusing Coccinelle, Eduardo Habkost, 2017/06/13
- [Qemu-devel] [RFC 04/15] [coccinelle] Use IGNORE_ERRORS instead of NULL as errp argument, Eduardo Habkost, 2017/06/13
- [Qemu-devel] [RFC 14/15] [coccinelle] Eliminate unnecessary local_err/error_propagate() usage, Eduardo Habkost, 2017/06/13
- [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments, Eduardo Habkost, 2017/06/13
- Message not available
- Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments, Eduardo Habkost, 2017/06/17
- Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments, Dr. David Alan Gilbert, 2017/06/19
- Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments, Peter Maydell, 2017/06/19
- Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments, Eduardo Habkost, 2017/06/19
- Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments,
Eric Blake <=
- Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments, Eduardo Habkost, 2017/06/27
Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored, Eric Blake, 2017/06/27
Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored, Markus Armbruster, 2017/06/28
Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored, Daniel P. Berrange, 2017/06/29
Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored, Paolo Bonzini, 2017/06/29