[libvirt] [PATCH] build: Fix build warning on libvirt-python

Ján Tomko jtomko at redhat.com
Tue Aug 19 10:43:50 UTC 2014


On 08/08/2014 11:55 AM, Wang Rui wrote:
> From: Mo Yuxiang <Moyuxiang at huawei.com>
> 
> On compiling libvirt-python, we get such a warning:
> 
> libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’:
> libvirt-qemu-override.c:304: warning: suggest explicit braces to avoid ambiguous ‘else’
> 
> Py_DECREF is a macro. The solution is to add brackets.

s/bracket/braces/

> 
> Signed-off-by: Mo Yuxiang <Moyuxiang at huawei.com>
> ---
>  libvirt-qemu-override.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

ACK. This fixes compilation with python 2.6 which doesn't have the macro
wrapped in a do { } while(0) block.

I've mentioned the python version in the commit message and pushed the patch.

Jan

> 
> diff --git a/libvirt-qemu-override.c b/libvirt-qemu-override.c
> index 05ead30..8be3755 100644
> --- a/libvirt-qemu-override.c
> +++ b/libvirt-qemu-override.c
> @@ -301,8 +301,9 @@ libvirt_qemu_virConnectDomainQemuMonitorEventRegister(PyObject *self ATTRIBUTE_U
>                                                     flags);
>      LIBVIRT_END_ALLOW_THREADS;
>  
> -    if (ret < 0)
> +    if (ret < 0) {
>          Py_DECREF(pyobj_cbData);
> +    }
>  
>      py_retval = libvirt_intWrap(ret);
>      return py_retval;
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140819/bb5a029b/attachment-0001.sig>


More information about the libvir-list mailing list