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

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

 



On Fri, Feb 13, 2015 at 10:18:40PM +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.
> 
> Signed-off-by: Gary R Hook <gary.hook@xxxxxxxxxxx>
> 
> ---
>  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;
> +*/

Actually if you look few lines further in this function you will see that the
hostarch is used. It's strange that you have a "warn-unused" for this one.

>  
>      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 * /
>      char buf[100];
>      size_t i;
>      int ret = -1;
> @@ -360,10 +361,12 @@ static int testSocketCommandNormal(const void *data ATTRIBUTE_UNUSED)
>      virObjectUnref(csock);
>      return ret;
>  }
> +*/
>  
> +/*
>  static int testSocketCommandFail(const void *data ATTRIBUTE_UNUSED)
>  {
> -    virNetSocketPtr csock = NULL; /* Client socket */
> +    virNetSocketPtr csock = NULL; / * Client socket * /
>      char buf[100];
>      int ret = -1;
>      virCommandPtr cmd = virCommandNewArgList("/bin/cat", "/dev/does-not-exist", NULL);
> @@ -383,6 +386,7 @@ static int testSocketCommandFail(const void *data ATTRIBUTE_UNUSED)
>      virObjectUnref(csock);
>      return ret;
>  }
> +*/

Those two functions are used later in the file so again it's strange that you're
getting the "warn-unused" during build.

>  
>  struct testSSHData {
>      const char *nodename;
> -- 
> 1.9.1
> 

NACK to this patch. Please try again to build the code on your machine and check
the files it it's really unused. And also try to git-clone the repository again.

Pavel

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

--
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]