nathanchance wrote:
For what it’s worth, it looks like this introduces a series of `-Wformat`
warnings when building the Linux kernel for 32-bit targets, which `typedef
size_t` as `unsigned int` in
[`include/linux/types.h`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/types.h?h=v6.16-rc6#n61)
and
[`include/uapi/asm-generic/posix_types.h`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/posix_types.h?h=v6.16-rc6#n62).
```
net/netfilter/nf_log_syslog.c:102:11: error: format specifies type 'size_t'
(aka '__size_t') but the argument has type 'unsigned int' [-Werror,-Wformat]
101 | nf_log_buf_add(m, " INCOMPLETE [%zu bytes]",
| ~~~
| %u
102 | skb->len - sizeof(_arph));
| ^~~~~~~~~~~~~~~~~~~~~~~~
```
```c
#ifndef _SIZE_T
#define _SIZE_T
typedef __kernel_size_t size_t;
#endif
```
```c
/*
* Most 32 bit architectures use "unsigned int" size_t,
* and all 64 bit architectures use "unsigned long" size_t.
*/
#ifndef __kernel_size_t
#if __BITS_PER_LONG != 64
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
#else
typedef __kernel_ulong_t __kernel_size_t;
typedef __kernel_long_t __kernel_ssize_t;
typedef __kernel_long_t __kernel_ptrdiff_t;
#endif
#endif
```
Is this expected?
https://github.com/llvm/llvm-project/pull/143653
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits