linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings
@ 2016-12-20 13:59 Stafford Horne
  2016-12-20 20:22 ` kbuild test robot
  2016-12-21  4:06 ` kbuild test robot
  0 siblings, 2 replies; 7+ messages in thread
From: Stafford Horne @ 2016-12-20 13:59 UTC (permalink / raw)
  To: Stefan Kristiansson; +Cc: openrisc, linux-kernel, Stafford Horne

The current build throws numerous warnings like:

  mm/percpu.c:1442:9: warning: format '%zu' expects argument of type
  'size_t', but argument 3 has type 'unsigned int' [-Wformat=]
         ai->unit_size, ai->alloc_size / ai->atom_size, ai->atom_size);
         ^
  mm/percpu.c:1442:9: warning: format '%zu' expects argument of type
  'size_t', but argument 4 has type 'unsigned int' [-Wformat=]

This change defines size_t as unsigned long, after this change there are
no warnings.

Signed-off-by: Stafford Horne <shorne@gmail.com>
---
 arch/openrisc/include/asm/Kbuild             |  1 -
 arch/openrisc/include/uapi/asm/Kbuild        |  1 +
 arch/openrisc/include/uapi/asm/posix_types.h | 24 ++++++++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 arch/openrisc/include/uapi/asm/posix_types.h

diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index a669c14..98d69c5 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -40,7 +40,6 @@ generic-y += msgbuf.h
 generic-y += pci.h
 generic-y += percpu.h
 generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
 generic-y += resource.h
 generic-y += sections.h
diff --git a/arch/openrisc/include/uapi/asm/Kbuild b/arch/openrisc/include/uapi/asm/Kbuild
index 80761eb..c09b436 100644
--- a/arch/openrisc/include/uapi/asm/Kbuild
+++ b/arch/openrisc/include/uapi/asm/Kbuild
@@ -5,6 +5,7 @@ header-y += byteorder.h
 header-y += elf.h
 header-y += kvm_para.h
 header-y += param.h
+header-y += posix_types.h
 header-y += ptrace.h
 header-y += sigcontext.h
 header-y += unistd.h
diff --git a/arch/openrisc/include/uapi/asm/posix_types.h b/arch/openrisc/include/uapi/asm/posix_types.h
new file mode 100644
index 0000000..9b71c3f
--- /dev/null
+++ b/arch/openrisc/include/uapi/asm/posix_types.h
@@ -0,0 +1,24 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2016 by Stafford Horne
+ */
+#ifndef _ASM_POSIX_TYPES_H
+#define _ASM_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.  Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned long	__kernel_size_t;
+typedef long		__kernel_ssize_t;
+typedef long		__kernel_ptrdiff_t;
+#define __kernel_size_t __kernel_size_t
+
+#include <asm-generic/posix_types.h>
+
+#endif /* _ASM_POSIX_TYPES_H */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings
  2016-12-20 13:59 [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings Stafford Horne
@ 2016-12-20 20:22 ` kbuild test robot
  2016-12-20 20:45   ` Geert Uytterhoeven
  2016-12-21  4:06 ` kbuild test robot
  1 sibling, 1 reply; 7+ messages in thread
From: kbuild test robot @ 2016-12-20 20:22 UTC (permalink / raw)
  To: Stafford Horne
  Cc: kbuild-all, Stefan Kristiansson, openrisc, linux-kernel, Stafford Horne

[-- Attachment #1: Type: text/plain, Size: 7880 bytes --]

Hi Stafford,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   crypto/drbg.c: In function 'drbg_seed':
>> crypto/drbg.c:1062:3: warning: format '%zu' expects type 'size_t', but argument 2 has type 'long unsigned int'
   crypto/drbg.c: In function 'drbg_generate':
   crypto/drbg.c:1275:3: warning: format '%zu' expects type 'size_t', but argument 2 has type 'long unsigned int'
--
   drivers/base/component.c: In function 'find_components':
>> drivers/base/component.c:101:3: warning: format '%zu' expects type 'size_t', but argument 4 has type 'long unsigned int'
--
   drivers/char/random.c: In function 'urandom_read':
>> drivers/char/random.c:1749:10: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'size_t'
   drivers/char/random.c: In function 'write_pool':
>> drivers/char/random.c:1783:11: warning: comparison of distinct pointer types lacks a cast
--
   drivers/tty/serial/earlycon.c: In function 'earlycon_init':
>> drivers/tty/serial/earlycon.c:74:32: warning: comparison of distinct pointer types lacks a cast
--
   fs/libfs.c: In function 'simple_attr_write':
>> fs/libfs.c:876:9: warning: comparison of distinct pointer types lacks a cast
--
   lib/iov_iter.c: In function 'sanity':
>> lib/iov_iter.c:319:2: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'size_t'
--
   lib/kstrtox.c: In function 'kstrtobool_from_user':
>> lib/kstrtox.c:376:10: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtoull_from_user':
   lib/kstrtox.c:398:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtoll_from_user':
   lib/kstrtox.c:399:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtoul_from_user':
   lib/kstrtox.c:400:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtol_from_user':
   lib/kstrtox.c:401:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtouint_from_user':
   lib/kstrtox.c:402:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtoint_from_user':
   lib/kstrtox.c:403:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtou16_from_user':
   lib/kstrtox.c:404:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtos16_from_user':
   lib/kstrtox.c:405:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtou8_from_user':
   lib/kstrtox.c:406:1: warning: comparison of distinct pointer types lacks a cast
   lib/kstrtox.c: In function 'kstrtos8_from_user':
   lib/kstrtox.c:407:1: warning: comparison of distinct pointer types lacks a cast
--
   In file included from mm/percpu.c:822:0:
   mm/percpu-km.c: In function 'pcpu_verify_alloc_info':
>> mm/percpu-km.c:106:3: warning: format '%zu' expects type 'size_t', but argument 2 has type 'long unsigned int'
   mm/percpu.c: In function 'pcpu_alloc':
>> mm/percpu.c:891:3: warning: format '%zu' expects type 'size_t', but argument 4 has type 'long unsigned int'
   mm/percpu.c:891:3: warning: format '%zu' expects type 'size_t', but argument 5 has type 'long unsigned int'
   mm/percpu.c:1032:3: warning: format '%zu' expects type 'size_t', but argument 2 has type 'long unsigned int'
   mm/percpu.c:1032:3: warning: format '%zu' expects type 'size_t', but argument 3 has type 'long unsigned int'
   mm/percpu.c: In function 'pcpu_dump_alloc_info':
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but argument 3 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but argument 4 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but argument 5 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but argument 6 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but argument 7 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but argument 8 has type 'long unsigned int'
--
   mm/dmapool.c: In function 'show_pools':
>> mm/dmapool.c:99:6: warning: format '%4Zu' expects type 'size_t', but argument 6 has type 'long unsigned int'
   mm/dmapool.c:99:6: warning: format '%4Zu' expects type 'size_t', but argument 7 has type 'long unsigned int'
--
   net/core/dev_ioctl.c: In function 'dev_ifsioc_locked':
>> net/core/dev_ioctl.c:149:11: warning: comparison of distinct pointer types lacks a cast
   net/core/dev_ioctl.c: In function 'dev_ifsioc':
   net/core/dev_ioctl.c:270:10: warning: comparison of distinct pointer types lacks a cast
--
   net/sunrpc/xprtsock.c: In function 'bc_malloc':
>> net/sunrpc/xprtsock.c:2553:3: warning: format '%zu' expects type 'size_t', but argument 4 has type 'long unsigned int'
..

vim +1062 crypto/drbg.c

541af946 Stephan Mueller 2014-05-31  1046   *
541af946 Stephan Mueller 2014-05-31  1047   * return:
541af946 Stephan Mueller 2014-05-31  1048   *	0 on success
541af946 Stephan Mueller 2014-05-31  1049   *	error value otherwise
541af946 Stephan Mueller 2014-05-31  1050   */
541af946 Stephan Mueller 2014-05-31  1051  static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers,
541af946 Stephan Mueller 2014-05-31  1052  		     bool reseed)
541af946 Stephan Mueller 2014-05-31  1053  {
57225e67 Stephan Mueller 2015-06-09  1054  	int ret;
57225e67 Stephan Mueller 2015-06-09  1055  	unsigned char entropy[((32 + 16) * 2)];
57225e67 Stephan Mueller 2015-06-09  1056  	unsigned int entropylen = drbg_sec_strength(drbg->core->flags);
541af946 Stephan Mueller 2014-05-31  1057  	struct drbg_string data1;
8c987166 Stephan Mueller 2014-06-28  1058  	LIST_HEAD(seedlist);
541af946 Stephan Mueller 2014-05-31  1059  
541af946 Stephan Mueller 2014-05-31  1060  	/* 9.1 / 9.2 / 9.3.1 step 3 */
541af946 Stephan Mueller 2014-05-31  1061  	if (pers && pers->len > (drbg_max_addtl(drbg))) {
a9089571 Stephan Mueller 2014-07-06 @1062  		pr_devel("DRBG: personalization string too long %zu\n",
541af946 Stephan Mueller 2014-05-31  1063  			 pers->len);
541af946 Stephan Mueller 2014-05-31  1064  		return -EINVAL;
541af946 Stephan Mueller 2014-05-31  1065  	}
541af946 Stephan Mueller 2014-05-31  1066  
8fded592 Herbert Xu      2015-04-21  1067  	if (list_empty(&drbg->test_data.list)) {
8fded592 Herbert Xu      2015-04-21  1068  		drbg_string_fill(&data1, drbg->test_data.buf,
8fded592 Herbert Xu      2015-04-21  1069  				 drbg->test_data.len);
541af946 Stephan Mueller 2014-05-31  1070  		pr_devel("DRBG: using test entropy\n");

:::::: The code at line 1062 was first introduced by commit
:::::: a9089571f2fc203c3ba6595a60f0045f048494da crypto: drbg - Fix format string for debugging statements

:::::: TO: Stephan Mueller <smueller@chronox.de>
:::::: CC: Herbert Xu <herbert@gondor.apana.org.au>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 7345 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings
  2016-12-20 20:22 ` kbuild test robot
@ 2016-12-20 20:45   ` Geert Uytterhoeven
  2016-12-20 22:44     ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-12-20 20:45 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Stafford Horne, kbuild-all, Stefan Kristiansson, openrisc, linux-kernel

Hi Stafford,

On Tue, Dec 20, 2016 at 9:22 PM, kbuild test robot <lkp@intel.com> wrote:
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.9 next-20161220]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
> config: openrisc-or1ksim_defconfig (attached as .config)
> compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=openrisc
>
> All warnings (new ones prefixed by >>):
>
>    crypto/drbg.c: In function 'drbg_seed':
>>> crypto/drbg.c:1062:3: warning: format '%zu' expects type 'size_t', but argument 2 has type 'long unsigned int'
>    crypto/drbg.c: In function 'drbg_generate':
>    crypto/drbg.c:1275:3: warning: format '%zu' expects type 'size_t', but argument 2 has type 'long unsigned int'

When I saw this patch, I was already a bit skeptical about it, but I noticed
other architectures (e.g. avr32) are doing the same, so I didn't reply.

In my experience, "format '%zu' expects argument of type 'size_t', but
argument 3 has type 'unsigned int'" happens when using a compiler that
was not configured to use the correct type (should be unsigned long) for
size_t. Typically this happens when using a compiler not configured for
a Linux target.

Given 0day uses a compiler configured for Linux (or32-linux-gcc), your
patch seems to break such (correct) setups.

What kind of compiler are you using?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings
  2016-12-20 20:45   ` Geert Uytterhoeven
@ 2016-12-20 22:44     ` Andreas Schwab
  2016-12-20 23:02       ` Stafford Horne
  2016-12-21  7:05       ` Geert Uytterhoeven
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Schwab @ 2016-12-20 22:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild test robot, Stafford Horne, kbuild-all,
	Stefan Kristiansson, openrisc, linux-kernel

On Dez 20 2016, Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> When I saw this patch, I was already a bit skeptical about it, but I noticed
> other architectures (e.g. avr32) are doing the same, so I didn't reply.
>
> In my experience, "format '%zu' expects argument of type 'size_t', but
> argument 3 has type 'unsigned int'" happens when using a compiler that
> was not configured to use the correct type (should be unsigned long) for
> size_t. Typically this happens when using a compiler not configured for
> a Linux target.

32-bit targets typically use unsigned int for size_t.  It is part of the
ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
gcc defaults to unsigned long for size_t, mismatches can happen if
people are using incomplete patches.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings
  2016-12-20 22:44     ` Andreas Schwab
@ 2016-12-20 23:02       ` Stafford Horne
  2016-12-21  7:05       ` Geert Uytterhoeven
  1 sibling, 0 replies; 7+ messages in thread
From: Stafford Horne @ 2016-12-20 23:02 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Geert Uytterhoeven, kbuild test robot, kbuild-all,
	Stefan Kristiansson, openrisc, linux-kernel

Hi,

On Tue, Dec 20, 2016 at 11:44:43PM +0100, Andreas Schwab wrote:
> On Dez 20 2016, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 
> > When I saw this patch, I was already a bit skeptical about it, but I noticed
> > other architectures (e.g. avr32) are doing the same, so I didn't reply.
> >
> > In my experience, "format '%zu' expects argument of type 'size_t', but
> > argument 3 has type 'unsigned int'" happens when using a compiler that
> > was not configured to use the correct type (should be unsigned long) for
> > size_t. Typically this happens when using a compiler not configured for
> > a Linux target.
> 
> 32-bit targets typically use unsigned int for size_t.  It is part of the
> ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
> gcc defaults to unsigned long for size_t, mismatches can happen if
> people are using incomplete patches.

Thanks,

To tell the truth I was skeptical of this patch as well.  But I figured I
could send out the patch and see what kind of feedback it would get.  I
was expecting compiler actually, but wasn't sure exactly where.

So this is the best feedback I could have expected.  Thanks.

I am using gcc with newlib 'or1k-elf-'.  I also have a musl, linux,
target compiler.  I will look into that.

-Stafford

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings
  2016-12-20 13:59 [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings Stafford Horne
  2016-12-20 20:22 ` kbuild test robot
@ 2016-12-21  4:06 ` kbuild test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2016-12-21  4:06 UTC (permalink / raw)
  To: Stafford Horne
  Cc: kbuild-all, Stefan Kristiansson, openrisc, linux-kernel, Stafford Horne

[-- Attachment #1: Type: text/plain, Size: 3169 bytes --]

Hi Stafford,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
config: openrisc-allnoconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   mm/slab_common.c: In function 'create_boot_cache':
>> mm/slab_common.c:816:6: warning: format '%zu' expects type 'size_t', but argument 3 has type 'long unsigned int'

vim +816 mm/slab_common.c

45530c44 Christoph Lameter 2012-11-28  800  /* Create a cache during boot when no slab services are available yet */
45530c44 Christoph Lameter 2012-11-28  801  void __init create_boot_cache(struct kmem_cache *s, const char *name, size_t size,
45530c44 Christoph Lameter 2012-11-28  802  		unsigned long flags)
45530c44 Christoph Lameter 2012-11-28  803  {
45530c44 Christoph Lameter 2012-11-28  804  	int err;
45530c44 Christoph Lameter 2012-11-28  805  
45530c44 Christoph Lameter 2012-11-28  806  	s->name = name;
45530c44 Christoph Lameter 2012-11-28  807  	s->size = s->object_size = size;
45906855 Christoph Lameter 2012-11-28  808  	s->align = calculate_alignment(flags, ARCH_KMALLOC_MINALIGN, size);
f7ce3190 Vladimir Davydov  2015-02-12  809  
f7ce3190 Vladimir Davydov  2015-02-12  810  	slab_init_memcg_params(s);
f7ce3190 Vladimir Davydov  2015-02-12  811  
45530c44 Christoph Lameter 2012-11-28  812  	err = __kmem_cache_create(s, flags);
45530c44 Christoph Lameter 2012-11-28  813  
45530c44 Christoph Lameter 2012-11-28  814  	if (err)
31ba7346 Christoph Lameter 2013-01-10  815  		panic("Creation of kmalloc slab %s size=%zu failed. Reason %d\n",
45530c44 Christoph Lameter 2012-11-28 @816  					name, size, err);
45530c44 Christoph Lameter 2012-11-28  817  
45530c44 Christoph Lameter 2012-11-28  818  	s->refcount = -1;	/* Exempt from merging for now */
45530c44 Christoph Lameter 2012-11-28  819  }
45530c44 Christoph Lameter 2012-11-28  820  
45530c44 Christoph Lameter 2012-11-28  821  struct kmem_cache *__init create_kmalloc_cache(const char *name, size_t size,
45530c44 Christoph Lameter 2012-11-28  822  				unsigned long flags)
45530c44 Christoph Lameter 2012-11-28  823  {
45530c44 Christoph Lameter 2012-11-28  824  	struct kmem_cache *s = kmem_cache_zalloc(kmem_cache, GFP_NOWAIT);

:::::: The code at line 816 was first introduced by commit
:::::: 45530c4474d258b822e2639c786606d8257aad8b mm, sl[au]b: create common functions for boot slab creation

:::::: TO: Christoph Lameter <cl@linux.com>
:::::: CC: Pekka Enberg <penberg@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 4315 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings
  2016-12-20 22:44     ` Andreas Schwab
  2016-12-20 23:02       ` Stafford Horne
@ 2016-12-21  7:05       ` Geert Uytterhoeven
  1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-12-21  7:05 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: kbuild test robot, Stafford Horne, kbuild-all,
	Stefan Kristiansson, openrisc, linux-kernel

On Tue, Dec 20, 2016 at 11:44 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> On Dez 20 2016, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> When I saw this patch, I was already a bit skeptical about it, but I noticed
>> other architectures (e.g. avr32) are doing the same, so I didn't reply.
>>
>> In my experience, "format '%zu' expects argument of type 'size_t', but
>> argument 3 has type 'unsigned int'" happens when using a compiler that
>> was not configured to use the correct type (should be unsigned long) for
>> size_t. Typically this happens when using a compiler not configured for
>> a Linux target.
>
> 32-bit targets typically use unsigned int for size_t.  It is part of the
> ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
> gcc defaults to unsigned long for size_t, mismatches can happen if
> people are using incomplete patches.

Right, thanks for correcting me!
It should indeed be unsigned int on 32-bit, and unsigned long on 64-bit.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-12-21  7:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20 13:59 [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings Stafford Horne
2016-12-20 20:22 ` kbuild test robot
2016-12-20 20:45   ` Geert Uytterhoeven
2016-12-20 22:44     ` Andreas Schwab
2016-12-20 23:02       ` Stafford Horne
2016-12-21  7:05       ` Geert Uytterhoeven
2016-12-21  4:06 ` kbuild test robot

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).