Skip to content

Conversation

tpambor
Copy link
Contributor

@tpambor tpambor commented Oct 4, 2025

Use %zu format specifier for size_t type to ensure compatibility with both 32-bit and 64-bit platforms.

This fixes warnings when using zassert string validation, e.g.

/home/user/west_workspace/zephyr/tests/subsys/logging/log_backend_uart/src/main.c: In function 'log_backend_uart_test_log_backend_uart_multi_instance':
/home/user/west_workspace/zephyr/tests/subsys/logging/log_backend_uart/src/main.c:71:31: error: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
   71 |                               "%d: TX buffer length does not match. Expected %d, got %d",
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                               i, strlen(TEST_DATA), tx_len);
      |                               ~
      |                               |
      |                               size_t {aka long unsigned int}

Part of #96968

Use %zu format specifier for size_t type to ensure compatibility with both
32-bit and 64-bit platforms.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
@zephyrbot zephyrbot added area: Logging area: Tests Issues related to a particular existing or missing test labels Oct 4, 2025
Copy link

sonarqubecloud bot commented Oct 4, 2025

@cfriedt cfriedt merged commit cc90cfe into zephyrproject-rtos:main Oct 8, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Logging area: Tests Issues related to a particular existing or missing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants