You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Incorrect format specifiers cause warnings (escalated to errors in twister), breaking build.
To Reproduce
Steps to reproduce the behavior:
enable logging, debug logging
use twister to build something involving tcp
See error
Expected behavior
Successfull build
Impact
Showstopper for build (of gsoc-2022-thrift project)
Logs and console output
FAILED: zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/tcp.c.obj
ccache /Users/cfriedt/zephyr-sdk-0.15.0/aarch64-zephyr-elf/bin/aarch64-zephyr-elf-gcc -DKERNEL -DMBEDTLS_CONFIG_FILE=\"config-tls-generic.h\" -DTC_RUNID=0c07d0be06c2c78439c63428eea8ea72 -D_FORTIFY_SOURCE-
In file included from /Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log.h:11,
from /Users/cfriedt/Desktop/zephyrproject/zephyr/subsys/net/ip/tcp.c:7:
/Users/cfriedt/Desktop/zephyrproject/zephyr/subsys/net/ip/tcp.c: In function 'tcp_queue_recv_data':
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/net/net_core.h:47:35: error: format '%i' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Werror=form
47 | #define NET_DBG(fmt, ...) LOG_DBG("(%s): " fmt, \
| ^~~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log_core.h:248:42: note: in definition of macro 'Z_LOG2'
248 | z_log_printf_arg_checker(__VA_ARGS__); \
| ^~~~~~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log.h:71:25: note: in expansion of macro 'Z_LOG'
71 | #define LOG_DBG(...) Z_LOG(LOG_LEVEL_DBG, __VA_ARGS__)
| ^~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/net/net_core.h:47:27: note: in expansion of macro 'LOG_DBG'
47 | #define NET_DBG(fmt, ...) LOG_DBG("(%s): " fmt, \
| ^~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/subsys/net/ip/tcp.c:1906:33: note: in expansion of macro 'NET_DBG'
1906 | NET_DBG("Adding at before queue, end_offset %i, pending_len %i",
| ^~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/net/net_core.h:47:35: error: format '%i' expects argument of type 'int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Werror=form
47 | #define NET_DBG(fmt, ...) LOG_DBG("(%s): " fmt, \
| ^~~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log_core.h:248:42: note: in definition of macro 'Z_LOG2'
248 | z_log_printf_arg_checker(__VA_ARGS__); \
| ^~~~~~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log.h:71:25: note: in expansion of macro 'Z_LOG'
71 | #define LOG_DBG(...) Z_LOG(LOG_LEVEL_DBG, __VA_ARGS__)
| ^~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/net/net_core.h:47:27: note: in expansion of macro 'LOG_DBG'
47 | #define NET_DBG(fmt, ...) LOG_DBG("(%s): " fmt, \
| ^~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/subsys/net/ip/tcp.c:1937:41: note: in expansion of macro 'NET_DBG'
1937 | NET_DBG("Adding at end of queue, start %i, end %i, len %i",
| ^~~~~~~
cc1: all warnings being treated as errors
ccache /Users/cfriedt/zephyr-sdk-0.15.0/aarch64-zephyr-elf/bin/aarch64-zephyr-elf-gcc -DKERNEL -DMBEDTLS_CONFIG_FILE=\"config-tls-generic.h\" -DTC_RUNID=40bf9f388de434f779657b8dbb125fc8 -D_FORTIFY_SOURCE/
In file included from /Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log.h:11,
from /Users/cfriedt/Desktop/zephyrproject/zephyr/subsys/net/ip/tcp.c:7:
/Users/cfriedt/Desktop/zephyrproject/zephyr/subsys/net/ip/tcp.c: In function 'tcp_queue_recv_data':
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/net/net_core.h:47:35: error: format '%i' expects argument of type 'int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Werror=form
47 | #define NET_DBG(fmt, ...) LOG_DBG("(%s): " fmt, \
| ^~~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log_core.h:248:42: note: in definition of macro 'Z_LOG2'
248 | z_log_printf_arg_checker(__VA_ARGS__); \
| ^~~~~~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/logging/log.h:71:25: note: in expansion of macro 'Z_LOG'
71 | #define LOG_DBG(...) Z_LOG(LOG_LEVEL_DBG, __VA_ARGS__)
| ^~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/include/zephyr/net/net_core.h:47:27: note: in expansion of macro 'LOG_DBG'
47 | #define NET_DBG(fmt, ...) LOG_DBG("(%s): " fmt, \
| ^~~~~~~
/Users/cfriedt/Desktop/zephyrproject/zephyr/subsys/net/ip/tcp.c:1937:41: note: in expansion of macro 'NET_DBG'
1937 | NET_DBG("Adding at end of queue, start %i, end %i, len %i",
| ^~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
Environment (please complete the following information):
The `%i` format specifier is for `int` and is equivalent to
`%d` for printf formatting.
However, for `size_t`, the correct format specifier is `%zu`.
Fixeszephyrproject-rtos#49825
Signed-off-by: Christopher Friedt <cfriedt@fb.com>
Describe the bug
Incorrect format specifiers cause warnings (escalated to errors in
twister
), breaking build.To Reproduce
Steps to reproduce the behavior:
twister
to build something involving tcpExpected behavior
Successfull build
Impact
Showstopper for build (of
gsoc-2022-thrift
project)Logs and console output
Environment (please complete the following information):
Additional context
https://github.com/zephyrproject-rtos/gsoc-2022-thrift
The text was updated successfully, but these errors were encountered: