[libvirt] [PATCH 6/6] Remove unused macros and enable -Wunused-macros
Daniel P. Berrange
berrange at redhat.com
Tue Apr 5 10:36:36 UTC 2011
On Mon, Apr 04, 2011 at 02:54:28PM -0600, Eric Blake wrote:
> On 04/04/2011 10:20 AM, Daniel P. Berrange wrote:
> > * m4/virt-compile-warnings.m4: Enable -Wunused-macros
> > * daemon/libvirtd.c: Remove MAX_LISTEN
> > * daemon/remote.c: Remote VIR_FROM_THIS
>
> s/Remote/Remove/
>
> > 33 files changed, 38 insertions(+), 108 deletions(-)
>
> Nice ratio!
>
> > +++ b/src/esx/esx_vi_methods.c
> > @@ -1,4 +1,3 @@
> > -
> > /*
> > * esx_vi_methods.c: client for the VMware VI API 2.5 to manage ESX hosts
> > *
> > @@ -52,8 +51,10 @@
> >
> >
> >
> > +#if 0
> > #define ESX_VI__METHOD__CHECK_OUTPUT__RequiredList \
>
> Won't this cause 'make syntax-check' grief during cppi checks? (Multiple
> instances)
>
> > +++ b/tools/virsh.c
> > @@ -409,15 +409,6 @@ _vshStrdup(vshControl *ctl, const char *s, const char *filename, int line)
> > exit(EXIT_FAILURE);
> > }
> >
> > -/* Poison the raw allocating identifiers in favor of our vsh variants. */
> > -#undef malloc
> > -#undef calloc
> > -#undef realloc
> > -#undef strdup
> > -#define malloc use_vshMalloc_instead_of_malloc
> > -#define calloc use_vshCalloc_instead_of_calloc
> > -#define realloc use_vshRealloc_instead_of_realloc
> > -#define strdup use_vshStrdup_instead_of_strdup
>
> Hmm, I don't want to completely lose this. Can we instead include
> "warn-on-use.h" (already provided by gnulib) and do:
>
> _GL_WARN_ON_USE(malloc, "use vshMalloc instead of malloc");
>
> to get the same poisoning effects but via magic attributes rather than
> unused macros?
That doesn't work either:
cc1: warnings being treated as errors
virsh.c:366:1: error: redundant redeclaration of 'malloc' [-Wredundant-decls]
virsh.c:367:1: error: redundant redeclaration of 'calloc' [-Wredundant-decls]
virsh.c:368:1: error: redundant redeclaration of 'realloc' [-Wredundant-decls]
virsh.c:369:1: error: redundant redeclaration of 'strdup' [-Wredundant-decls]
What we really want is a syntax-check rule for these i reckon
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list