[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: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC 15/15] [test only] Use 'Error *err[static 1]' instead of 'Error **errp' to catch NULL errp arguments |
Date: |
Mon, 19 Jun 2017 10:43:51 +0100 |
On 19 June 2017 at 09:48, Dr. David Alan Gilbert <address@hidden> wrote:
> * Eduardo Habkost (address@hidden) wrote:
>> On Thu, Jun 15, 2017 at 01:14:15PM +0100, Dr. David Alan Gilbert wrote:
>> > * Eduardo Habkost (address@hidden) wrote:
>> > > void visit_start_struct(Visitor *v, const char *name, void **obj,
>> > > - size_t size, Error **errp);
>> > > + size_t size, Error *errp[static 1]);
>> > >
>> >
>> > Is it possible to typedef that to something that hides the magic syntax?
>> > Then we could get that down to QError errp or something like that?
>>
>> Unfortunately it is not possible to hide it in a typedef: the
>> "static" keyword inside the square brackets is a feature of
>> function parameter declarations only. Using it on a typedef
>> results in:
>>
>> a.c:3:16: error: static or type qualifiers in non-parameter array declarator
>> typedef Error *ErrorPtr[static 1];
>
> That's a shame; it's rather odd looking; still I think it's
> worth it if it simplifies the error code.
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 :-(
thanks
-- PMM
- [Qemu-devel] [RFC 10/15] test-qapi-util: Use ERR_IS_* macros, (continued)
- [Qemu-devel] [RFC 10/15] test-qapi-util: Use ERR_IS_* macros, Eduardo Habkost, 2017/06/13
- [Qemu-devel] [RFC 11/15] Manual changes to use ERR_IS_* macros, Eduardo Habkost, 2017/06/13
- [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 <=
- 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, 2017/06/27
- 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