From: Alan Stern <stern@rowland.harvard.edu>
To: dmg <dmg@turingmachine.org>
Cc: linux-usb@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [usb:usb-testing 46/46] drivers/usb//misc/adutux.c:375:4: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}'
Date: Thu, 20 Jun 2019 11:45:20 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44L0.1906201142040.1512-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <87wohgs3lh.fsf@mn.cs.uvic.ca>
On Thu, 20 Jun 2019, dmg wrote:
>
> kbuild test robot <lkp@intel.com> writes:
>
> [...]
> >
> > All warnings (new ones prefixed by >>):
> >
> > In file included from include/linux/printk.h:332:0,
> > from include/linux/kernel.h:15,
> > from drivers/usb//misc/adutux.c:19:
> > drivers/usb//misc/adutux.c: In function 'adu_read':
> >>> drivers/usb//misc/adutux.c:375:4: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Wformat=]
> > "%s : while, data_in_secondary=%lu, status=%d\n",
>
> I am not sure what is the best way to address this warning.
>
> size_t seems to be architecture dependent. On my computer (intel64)
> size_t is long unsigned int, but in this test it is int unsigned.
>
> Are there any suggestions on what is the best way to deal with this?
Use the %zu format specifier instead of %lu. This is explained in
Documentation/core-api/printk-formats.rst.
Alan Stern
> casting size_t to long unsigned int will work, but it sounds kind of
> ugly.
>
>
> thank you,
>
>
> --daniel
>
>
> --
> Daniel M. German "We die. That may be the meaning of life.
> But we do language. That may be
> Toni Morrison -> the measure of our lives."
> http://turingmachine.org/
> http://silvernegative.com/
> dmg (at) uvic (dot) ca
> replace (at) with @ and (dot) with .
>
>
next prev parent reply other threads:[~2019-06-20 15:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 14:45 [usb:usb-testing 46/46] drivers/usb//misc/adutux.c:375:4: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' kbuild test robot
2019-06-20 15:01 ` dmg
2019-06-20 15:40 ` Johan Hovold
2019-06-20 15:45 ` Alan Stern [this message]
2019-06-21 6:16 ` Greg Kroah-Hartman
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=Pine.LNX.4.44L0.1906201142040.1512-100000@iolanthe.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=dmg@turingmachine.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.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).