xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Marcin Cieslak <saper@saper.info>,
	xen-devel@lists.xenproject.org,
	Ian Campbell <Ian.Campbell@citrix.com>,
	"xen.org" <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH 3/4] libxl: shutdown_reason cannot be unsigned
Date: Tue, 16 Sep 2014 11:43:10 -0700	[thread overview]
Message-ID: <541884BE.1020509@linaro.org> (raw)
In-Reply-To: <1410642625-45876-3-git-send-email-saper@saper.info>

Hello Marcin,

On 13/09/14 14:10, Marcin Cieslak wrote:
> Shutdown reason may be negative, so don't
> cast it onto (unsigned int).

If you are looking the place where the variable is assigned, 
info[i].shutdown_reason is typed as an unsigned int.

So changing type doesn't look like the right solution. I've sent a few 
months ago a patch to drop "shutdown_reason >= 0" check [1].

It was acked, but I hadn't had time to resent this series properly. 
Mainly because I got other errors around with clang.

Regards,

[1] https://patches.linaro.org/27074/



> Clang complains:
>
> xl_cmdimpl.c:3313:34: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare]
>                  (shutdown_reason >= 0 &&
>                   ~~~~~~~~~~~~~~~ ^  ~
> ---
>   tools/libxl/xl_cmdimpl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 86daf8e..f9ca22a 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -3297,7 +3297,7 @@ static void list_domains(int verbose, int context, int claim, int numa,
>       printf("\n");
>       for (i = 0; i < nb_domain; i++) {
>           char *domname;
> -        unsigned shutdown_reason;
> +        int shutdown_reason;
>           domname = libxl_domid_to_name(ctx, info[i].domid);
>           shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0;
>           printf("%-40s %5d %5lu %5d     %c%c%c%c%c%c  %8.1f",
>

-- 
Julien Grall

  reply	other threads:[~2014-09-16 18:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13 21:10 [PATCH 1/4] Use proper header guard for <ufs/ufs.h> Marcin Cieslak
2014-09-13 21:10 ` [PATCH 2/4] libxl_get_scheduler() cannot return ERROR_FAIL Marcin Cieslak
2014-09-16 16:27   ` Ian Campbell
2014-09-13 21:10 ` [PATCH 3/4] libxl: shutdown_reason cannot be unsigned Marcin Cieslak
2014-09-16 18:43   ` Julien Grall [this message]
2014-09-13 21:10 ` [PATCH 4/4] libxl: Use yajl_gen_status_ok where appropriate Marcin Cieslak
2014-09-16 16:29   ` Ian Campbell
2014-09-16 16:23 ` [PATCH 1/4] Use proper header guard for <ufs/ufs.h> Ian Campbell
2014-09-16 16:28   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=541884BE.1020509@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=saper@saper.info \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).