[libvirt] [PATCH] build: fix build --without-network

Eric Blake eblake at redhat.com
Wed Nov 21 14:28:37 UTC 2012


On 11/21/2012 06:59 AM, Ján Tomko wrote:
> bridge_driver.h: silence gcc warnings:
> statement with no effect [-Wunused-value]
> unused variable 'net' [-Wunused-variable]
> 
> virdrivermoduletest.c: don't require network driver module
> if it hasn't been built.
> ---
>  src/network/bridge_driver.h |    4 ++--
>  tests/virdrivermoduletest.c |    8 ++++++++
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
> index 0fae275..1c42d81 100644
> --- a/src/network/bridge_driver.h
> +++ b/src/network/bridge_driver.h
> @@ -53,8 +53,8 @@ int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network,
>  # else
>  /* Define no-op replacements that don't drag in any link dependencies.  */
>  #  define networkAllocateActualDevice(iface) 0
> -#  define networkNotifyActualDevice(iface) 0
> -#  define networkReleaseActualDevice(iface) 0
> +#  define networkNotifyActualDevice(iface) (iface=iface,0)
> +#  define networkReleaseActualDevice(iface) (iface=iface,0)

I would write this as (iface = iface, 0) for consistent operator spacing
with the rest of our code.

> +++ b/tests/virdrivermoduletest.c
> @@ -83,10 +83,18 @@ mymain(void)
>      TEST("interface", NULL);
>  #endif
>  #ifdef WITH_QEMU
> +# ifdef WITH_NETWORK
>      TEST("qemu", "network");
> +# else
> +    TEST("qemu", NULL);
> +# endif
>  #endif
>  #ifdef WITH_LXC
> +# ifdef WITH_NETWORK
>      TEST("lxc", "network");
> +# else
> +    TEST("lxc", NULL);
> +# endif
>  #endif
>  #ifdef WITH_UML
>      TEST("uml", NULL);

Is it any easier to do:

#ifdef WITH_NETWORK
# define USE_NETWORK "network"
#else
# define USE_NETWORK NULL
#endif

rather than repeated nested #ifdef?  But that's cosmetic, so I don't
care if you don't change it.

ACK with the formatting nit fixed.

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

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


More information about the libvir-list mailing list