qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dov Murik <dovmurik@linux.vnet.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-trivial@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
	Laurent Vivier <laurent@vivier.eu>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string
Date: Mon, 14 Sep 2020 09:40:21 +0300	[thread overview]
Message-ID: <00747ce4-c714-cfca-464c-6999edfede3a@linux.vnet.ibm.com> (raw)
In-Reply-To: <3dbac311-dc90-0eda-10c2-13ab28407a6a@redhat.com>



On 13/09/2020 14:40, Philippe Mathieu-Daudé wrote:
> On 9/12/20 7:40 PM, Dov Murik wrote:
>> Hi Phil,
>>
>> On 10/09/2020 16:58, Philippe Mathieu-Daudé wrote:
>>> Fix building with HPET_DEBUG enabled:
>>>
>>>     hw/timer/hpet.c:512:73: error: format specifies type 'unsigned int'
>>> but the argument has type 'uint64_t' (aka 'unsigned long')
>>> [-Werror,-Wformat]
>>>         DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n",
>>> addr, value);
>>>                                                              
>>> ~~~           ^~~~~
>>>                                                               %#lx
>>>     hw/timer/hpet.c:655:21: error: format specifies type 'unsigned int'
>>> but the argument has type 'uint64_t' (aka 'unsigned long')
>>> [-Werror,-Wformat]
>>>                         value, s->hpet_counter);
>>>                         ^~~~~
>>>
>>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>>    hw/timer/hpet.c | 9 ++++++---
>>>    1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
>>> index b683f64f1d3..20bd0388740 100644
>>> --- a/hw/timer/hpet.c
>>> +++ b/hw/timer/hpet.c
>>> @@ -495,7 +495,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>>>        HPETState *s = opaque;
>>>        uint64_t old_val, new_val, val, index;
>>>
>>> -    DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n",
>>> addr, value);
>>> +    DPRINTF("qemu: Enter hpet_ram_writel at %#" HWADDR_PRIx " =
>>> %#"PRIx64"\n",
>>> +            addr, value);
>>
>> You still use "#" in the format string; but qemu's CODING_STYLE.rst says:
>>
>> //////////////
>>
>> '#' printf flag
>> ---------------
>>
>> Do not use printf flag '#', like '%#x'.
>>
>> Rationale: there are two ways to add a '0x' prefix to printed number:
>> '0x%...'
>> and '%#...'. For consistency the only one way should be used. Arguments for
>> '0x%' are:
>>
>> * it is more popular
>> * '%#' omits the 0x for the value 0 which makes output inconsistent
> 
> Yes you are right, I missed that.
> 
> Do you mind adding that check to ./checkpatch?

Fix to checkpatch sent in another patch:

https://www.mail-archive.com/qemu-devel@nongnu.org/msg740065.html

-Dov


  reply	other threads:[~2020-09-14  6:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 13:58 [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé
2020-09-10 13:58 ` [PATCH v2 1/2] hw/timer/hpet: Remove dead code Philippe Mathieu-Daudé
2020-09-10 14:46   ` Li Qiang
2020-09-10 14:50     ` Philippe Mathieu-Daudé
2020-09-10 13:58 ` [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string Philippe Mathieu-Daudé
2020-09-12 17:40   ` Dov Murik
2020-09-13 11:40     ` Philippe Mathieu-Daudé
2020-09-14  6:40       ` Dov Murik [this message]
2020-09-10 14:08 ` [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé

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=00747ce4-c714-cfca-464c-6999edfede3a@linux.vnet.ibm.com \
    --to=dovmurik@linux.vnet.ibm.com \
    --cc=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=thuth@redhat.com \
    /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).