[virt-tools-list] [virt-viewer] Don't include libvirt.h in virt-viewer-auth.h

Daniel P. Berrange berrange at redhat.com
Wed Mar 9 16:15:59 UTC 2016


On Wed, Mar 09, 2016 at 05:12:19PM +0100, Fabiano Fidêncio wrote:
> On Wed, Mar 9, 2016 at 5:02 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> > virt-viewer-auth.h does not use any libvirt types, so the #include is
> > not needed, and virt-viewer-auth.h is used while building remote-viewer,
> > which do not use libvirt compilation flags. This caused failures on
> > a freshly installed box without libvirt headers.
> > ---
> >  src/virt-viewer-auth.h | 4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/src/virt-viewer-auth.h b/src/virt-viewer-auth.h
> > index 85e3bbc..cdabd00 100644
> > --- a/src/virt-viewer-auth.h
> > +++ b/src/virt-viewer-auth.h
> > @@ -25,10 +25,6 @@
> >
> >  #include "config.h"
> >
> > -#ifdef HAVE_LIBVIRT
> > -#include <libvirt/libvirt.h>
> > -#endif
> > -
> >  #include "virt-viewer-session.h"
> >  #include "virt-viewer-util.h"
> >
> > --
> > 2.5.0
> >
> > _______________________________________________
> > virt-tools-list mailing list
> > virt-tools-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/virt-tools-list
> 
> Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
> 
> Btw, do you know some automated way to check for not needed includes? ;-)

The typical approach is to just try deleting includes until the build
fails. The results of this still need to be vetted though, because a
header file my be not-needed on one OS, but needed on a different OS
depending on how they've structured their system header files :-( So
it is best to be wary of removing headers unless its obvious they are
clearly not-needed to a human eye.

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 virt-tools-list mailing list