Re: [PATCH] Comment out variables/functions that are unused.

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

 



On 2/16/15 3:16 AM, Martin Kletzander wrote:
On Fri, Feb 13, 2015 at 08:18:53PM +0000, Gary R Hook wrote:
   Avoids complaints when the compiler is configured to "warn-unused".

   A few files contain unnecessary code that results in the compiler
   erroring out when -Wunused* options are used. Comment out the code
   until such time as it is needed.


---
src/libxl/libxl_conf.c   | 2 ++
tests/virnetsockettest.c | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 0555b91..f8db4d2 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -305,7 +305,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
    regmatch_t subs[4];
    char *saveptr = NULL;
    size_t i;
+/*
    virArch hostarch = caps->host.arch;
+*/


How come you see this unused?  It is used about 100 lines later being
compared to VIR_ARCH_X86_64.

Ugh. You are right, and I can't believe I overlooked this. The problem is a bad Ubuntu patch that removes the reference to the variable, precipitating the compiler complaint. My apologies. I shall have to fix this in our build environment.


    struct guest_arch guest_archs[32];
    int nr_guest_archs = 0;
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 5d91f26..988ab43 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -333,9 +333,10 @@ static int testSocketUNIXAddrs(const void *data
ATTRIBUTE_UNUSED)
    return ret;
}

+/*
static int testSocketCommandNormal(const void *data ATTRIBUTE_UNUSED)
{
-    virNetSocketPtr csock = NULL; /* Client socket */
+    virNetSocketPtr csock = NULL; / * Client socket * /

Ugly, guess what happens if someone was about uncomment the function.
If you used #if 0 around the function it'd be way easier, or I might
even consider removing that function, BUT...

Now I'm really annoyed. Same problem here: a badly implemented patch from Ubuntu (or Debian, but I don't really care which).


Let's leave this at: thank you for making me look just a bit further (as I should have to begin with) and thank you very much for your time. I am sorry to have wasted it.


--
Gary R Hook
Senior Kernel Engineer
NIMBOXX, Inc

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]