From: Mike Frysinger <vapier@gentoo.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jan Kara <jack@suse.cz>,
linux-kernel@vger.kernel.org,
Linux-Arch <linux-arch@vger.kernel.org>,
linux-cris-kernel@axis.com
Subject: Re: size_t/ssize_t warnings (was: Re: Build regressions/improvements in v3.5-rc5)
Date: Wed, 4 Jul 2012 21:25:13 -0400 [thread overview]
Message-ID: <201207042125.14680.vapier@gentoo.org> (raw)
In-Reply-To: <CAMuHMdVJTUF3r=MKzpkvj6y_xdVdw=zEgAy2_wm_hG94jdrhBA@mail.gmail.com>
[-- Attachment #1: Type: Text/Plain, Size: 2305 bytes --]
On Wednesday 04 July 2012 16:17:28 Geert Uytterhoeven wrote:
> On Wed, Jul 4, 2012 at 3:34 PM, Jan Kara <jack@suse.cz> wrote:
> >> + fs/quota/quota_tree.c: warning: format '%zd' expects argument of
> >> type 'signed size_t', but argument 4 has type 'ssize_t' [-Wformat]:
> >> => 372:4 + fs/quota/quota_v2.c: warning: format '%zd' expects
> >> argument of type 'signed size_t', but argument 5 has type 'ssize_t'
> >> [-Wformat]: => 66:92
> >
> > These really look like false positives (there are quite a few of this
> >
> > kind). Can we possibly silence them?
>
> These 2 warnings happen on cris only, because size_t is unsigned int and
> ssize_t is (signed) long. They go away if I make ssize_t int.
>
> I had a look at the various definitions of size_t and ssize_t:
>
> __kernel_size_t
> __kernel_ssize_t --------------- ----------------
>
> generic 32-bit: unsigned int int
> generic 64-bit: __kernel_ulong_t (unsigned long)
> __kernel_long_t (long)
>
> Exceptions:
>
> avr32: unsigned long long
> blackfin: unsigned long long
> cris: __SIZE_TYPE__ (unsigned int) long
> mn10300/__GNUC__ == 4: unsigned int signed int
> mn10300/__GNUC__ != 4: unsigned long signed long
> s390 (32-bit): unsigned long int
> x32: __kernel_ulong_t (unsigned long long)
> __kernel_long_t (long long)
>
> On cris, I get the warning if ssize_t != int.
> Whether size_t is unsigned int or unsigned long doesn't matter.
> So it's not just a mismatch between int and long.
>
> I also tried blackfin, which has matching unsigned long/long, and it
> doesn't give the warning. Presumably the toolchain has size_t hardcoded to
> long for printf-style format checking?
well, every gcc arch has to declare a type for size_t. on Blackfin, we picked:
gcc/config/bfin/bfin.h:/* what is the 'type' of size_t */
gcc/config/bfin/bfin.h-#define SIZE_TYPE "long unsigned int"
grep shows that many other arches do the same
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-07-05 1:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-04 20:17 size_t/ssize_t warnings (was: Re: Build regressions/improvements in v3.5-rc5) Geert Uytterhoeven
2012-07-05 1:25 ` Mike Frysinger [this message]
2012-07-06 1:12 ` Hans-Peter Nilsson
2012-07-06 7:18 ` Geert Uytterhoeven
2012-07-06 13:45 ` Hans-Peter Nilsson
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=201207042125.14680.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=geert@linux-m68k.org \
--cc=jack@suse.cz \
--cc=linux-arch@vger.kernel.org \
--cc=linux-cris-kernel@axis.com \
--cc=linux-kernel@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