qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test
Date: Fri, 30 Mar 2012 14:07:51 -0500	[thread overview]
Message-ID: <4F760487.7020205@codemonkey.ws> (raw)
In-Reply-To: <CAAu8pHvnGYtR3TEY6WXD+xaNT=hE0KCUujoqOjUwv_gQNe=JGA@mail.gmail.com>

On 03/30/2012 01:59 PM, Blue Swirl wrote:
> Avoid this warning on OpenBSD:
>    CC    tests/rtc-test.o
> /src/qemu/tests/rtc-test.c: In function 'check_time':
> /src/qemu/tests/rtc-test.c:171: warning: format '%ld' expects type
> 'long int', but argument 2 has type 'time_t'
> /src/qemu/tests/rtc-test.c:173: warning: format '%ld' expects type
> 'long int', but argument 2 has type 'time_t'
>
> Signed-off-by: Blue Swirl<blauwirbel@gmail.com>

I'd prefer to make t and s longs so that the casts weren't needed.  It will make 
the issue less likely to come up later.

Regards,

Anthony Liguori

> ---
>   tests/rtc-test.c |    6 ++++--
>   1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/rtc-test.c b/tests/rtc-test.c
> index c32b36a..a5d4519 100644
> --- a/tests/rtc-test.c
> +++ b/tests/rtc-test.c
> @@ -168,9 +168,11 @@ static void check_time(int wiggle)
>           t = mktime(datep);
>           s = mktime(&start);
>           if (t<  s) {
> -            g_test_message("RTC is %ld second(s) behind
> wall-clock\n", (s - t));
> +            g_test_message("RTC is %ld second(s) behind wall-clock\n",
> +                           (long)(s - t));
>           } else {
> -            g_test_message("RTC is %ld second(s) ahead of
> wall-clock\n", (t - s));
> +            g_test_message("RTC is %ld second(s) ahead of wall-clock\n",
> +                           (long)(t - s));
>           }
>
>           g_assert_cmpint(ABS(t - s),<=, wiggle);

      reply	other threads:[~2012-03-30 19:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30 18:59 [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test Blue Swirl
2012-03-30 19:07 ` Anthony Liguori [this message]

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=4F760487.7020205@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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).