[libvirt] [PATCH 2/4] Build fix for 'bridge.c' if 'IFF_VNET_HDR' is disabled.

Jim Meyering jim at meyering.net
Mon Feb 16 11:28:31 UTC 2009


Maximilian Wilhelm <max at rfc2324.org> wrote:
>   The function 'brProbeVnetHdr()' added in commit
>     b14bf853b4b0c3479d13c4842cea6faa3414c834
>   does not use the 'tapfd' parameter.
>   gcc does not like that. Make it happy.
>
> Signed-off-by: Maximilian Wilhelm <max at rfc2324.org>
> ---
>  src/bridge.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/bridge.c b/src/bridge.c
> index 990a567..960db91 100644
> --- a/src/bridge.c
> +++ b/src/bridge.c
> @@ -423,7 +423,7 @@ static int brSetInterfaceMtu(brControl *ctl,
>   * Returns 0 in case of success or an errno code in case of failure.
>   */
>  static int
> -brProbeVnetHdr(int tapfd)
> +brProbeVnetHdr(int tapfd ATTRIBUTE_UNUSED)
>  {
>  #if defined(IFF_VNET_HDR) && defined(TUNGETFEATURES) && defined(TUNGETIFF)
>      unsigned int features;

Thanks.  While it is unused in the #else block, it *is* used in the
#if-block, so marking it unused like that is misleading and might even
provoke its own warning some day.  I'll fix it like this instead:

>From 569c419001111a28772f4db75e5f086cdd08c70e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 16 Feb 2009 12:23:27 +0100
Subject: [PATCH] avoid compiler warning about unused parameter

* src/bridge.c (brProbeVnetHdr)
[IFF_VNET_HDR && TUNGETFEATURES && TUNGETIFF]: Use a "(void)" case
to mark the parameter as unused.  Reported by Maximilian Wilhelm in
http://thread.gmane.org/gmane.comp.emulators.libvirt/11918/focus=11917
---
 src/bridge.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/bridge.c b/src/bridge.c
index fc11429..668dcf0 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -454,6 +454,7 @@ brProbeVnetHdr(int tapfd)

     return 1;
 #else
+    (void) tapfd;
     VIR_INFO0(_("Not enabling IFF_VNET_HDR; disabled at build time"));
     return 0;
 #endif
--
1.6.2.rc0.264.g60787




More information about the libvir-list mailing list