qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL v2 16/20] qapi: Consistent generated code: prefer


From: Eric Blake
Subject: Re: [Qemu-devel] [PULL v2 16/20] qapi: Consistent generated code: prefer common indentation
Date: Wed, 14 Oct 2015 10:24:15 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/14/2015 10:01 AM, Marc-André Lureau wrote:
> Hi,
> 
> This patch introduces a regression:
> 
> $ x86_64-softmmu/qemu-system-x86_64 -netdev ?
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000555555a0bc0f in visit_type_NetClientOptions (v=0x5555564e19e0,
> obj=0x555556510438, name=0x555555af7041 "opts", errp=0x7fffffffd450)
> at qapi-visit.c:6906
> 6906        visit_end_union(v, !!(*obj)->data, &err);
> (gdb) print *obj
> $1 = (NetClientOptions *) 0x0

visit_end_union() is pointless (it is a no-op). I plan on properly
deleting visit_begin_union/visit_end_union later in my series.

But in the meantime, I see the source of the problem:

>> @@ -264,16 +264,18 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s 
>> **obj, const char *name, Error
>>      if (err) {
>>          goto out;
>>      }
>> -    if (*obj) {
>> +    if (!*obj) {
>> +        goto out_obj;
>> +    }
>>  ''',
>>                   c_name=c_name(name), name=name)

>>      ret += mcgen('''
>> -        default:
>> -            abort();
>> -        }
>> -out_obj:
>> -        error_propagate(errp, err);
>> -        err = NULL;
>> -        visit_end_union(v, !!(*obj)->data, &err);
>> -        error_propagate(errp, err);
>> -        err = NULL;
>> +    default:
>> +        abort();
>>      }
>> +out_obj:
>> +    error_propagate(errp, err);
>> +    err = NULL;
>> +    visit_end_union(v, !!(*obj)->data, &err);

The call to visit_end_union() used to be conditional on whether *obj was
non-NULL.  So I'll post the quick and obvious fix.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]