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

Re: [libvirt] [PATCH] build: avoid shadowing devname() on BSD systems



On 12/03/2010 10:08 AM, Justin Clift wrote:
> Thanks Eric.  Captured the complete make log this time, to ensure it's fixed.
> 
> The same warning also appears in a few other places. :/
> 
>   libvirt.c: In function 'virDomainOpenConsole':
>   libvirt.c:13169: warning: declaration of 'devname' shadows a global declaration [-Wshadow]
>   /usr/include/stdlib.h:290: warning: shadowed declaration is here [-Wshadow]

Yuck.  'devname' is just too handy to be penalized by BSD's namespace
pollution.  What if we instead do this in internal.h:

#include <stdlib.h>
/* Silence -Wshadow on BSD systems, which declare a devname() that we
 * don't care about */
#define devname vir_devname

then all other shadowing warnings should just go away, without us having
to worry about the problem cropping up again.

(I've seen this trick used in gnulib, where we got rid of shadowing
warnings for the poorly-named and now-obsolete index().)

> While looking for those, a few more warnings also showed up:
> 
>   ../daemon/event.c: In function 'virEventInterruptLocked':
>   ../daemon/event.c:656: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
>   virsh.c: In function 'vshReadlineInit':
>   virsh.c:11575: warning: assignment discards qualifiers from pointer target type
> 
>   event.c: In function 'virEventInterruptLocked':
>   event.c:656: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

I agree with Diego - these are real bugs and need fixing.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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