Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print: Missing size_t print format specifiers #20249

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/atwinc15x0/atwinc15x0_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
auth_type = M2M_WIFI_SEC_802_1X;
#else /* defined(WIFI_USER) && defined(WIFI_PASS) */
#error WIFI_EAP_USER and WIFI_EAP_PASS have to define the user name \
and the password for EAP phase 2 authentication in wifi_enterprise

Check warning on line 254 in drivers/atwinc15x0/atwinc15x0_netdev.c

View workflow job for this annotation

GitHub Actions / static-tests

keyword 'for' not followed by a single space
#endif /* defined(WIFI_USER) && defined(WIFI_PASS) */

#endif /* defined(MODULE_WIFI_ENTERPRISE) */
Expand Down Expand Up @@ -454,11 +454,11 @@
conn.credentials.wep = *((const wifi_security_wep_psk_t *)
_atwinc15x0_connect_req.conn_req.cred);
}
else if (*_atwinc15x0_connect_req.conn_req.cred == WIFI_SECURITY_MODE_WPA2_PERSONAL) {

Check warning on line 457 in drivers/atwinc15x0/atwinc15x0_netdev.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
conn.credentials.wpa_psk = *((const wifi_security_wpa_psk_t *)
_atwinc15x0_connect_req.conn_req.cred);
}
else if (*_atwinc15x0_connect_req.conn_req.cred == WIFI_SECURITY_MODE_WPA2_ENTERPRISE) {

Check warning on line 461 in drivers/atwinc15x0/atwinc15x0_netdev.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
conn.credentials.wpa_enterprise = *((const wifi_security_wpa_enterprise_t *)
_atwinc15x0_connect_req.conn_req.cred);
}
Expand Down Expand Up @@ -645,7 +645,7 @@
assert(dev);
assert(dev == atwinc15x0);

DEBUG("%s dev=%p opt=%u val=%p max_len=%u\n", __func__,
DEBUG("%s dev=%p opt=%u val=%p max_len=%" PRIuSIZE "\n", __func__,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like those macros are not known here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's missing #include "architecture.h".
The header is included in many places, so it tried to get away with not including it in every file that uses PRIuSIZE. I am currently building all examples/tests with the board to see if there are other problems with this board.

If it's ok, I'll add the missing includes and force push a version with the missing includes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All builds for lora-e5-dev should work. I also tried some other platforms, but didn't find any other problems.

(void *)netdev, opt, val, max_len);

switch (opt) {
Expand Down Expand Up @@ -755,7 +755,7 @@
{
atwinc15x0_t *dev = (atwinc15x0_t *)netdev;

DEBUG("%s dev=%p opt=%u val=%p max_len=%u\n", __func__,
DEBUG("%s dev=%p opt=%u val=%p max_len=%" PRIuSIZE "\n", __func__,
(void *)netdev, opt, val, max_len);

int ret;
Expand Down
4 changes: 2 additions & 2 deletions drivers/lcd/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void lcd_ll_release(lcd_t *dev)
void lcd_ll_write_cmd(lcd_t *dev, uint8_t cmd, const uint8_t *data,
size_t len)
{
DEBUG("[%s] command 0x%02x (%u) ", __func__, cmd, len);
DEBUG("[%s] command 0x%02x (%" PRIuSIZE ") ", __func__, cmd, len);
if (IS_USED(ENABLE_DEBUG) && len) {
for (uint8_t i = 0; i < len; i++) {
DEBUG("0x%02x ", data[i]);
Expand All @@ -310,7 +310,7 @@ void lcd_ll_read_cmd(lcd_t *dev, uint8_t cmd, uint8_t *data, size_t len)
{
assert(len);

DEBUG("[%s] command 0x%02x (%u) ", __func__, cmd, len);
DEBUG("[%s] command 0x%02x (%" PRIuSIZE ") ", __func__, cmd, len);

lcd_ll_cmd_start(dev, cmd, true);
lcd_ll_read_bytes(dev, false, data, len);
Expand Down
2 changes: 1 addition & 1 deletion drivers/nrf24l01p_ng/nrf24l01p_ng_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
DEBUG_PUTS("[nrf24l01p_ng] RX error, flush RX FIFO");
/* In some rare cases the RX payload width (R_RX_PL_WID) exceeds
the maximum of 32 bytes. In that case it must be flushed.
See https://devzone.nordicsemi.com/f/nordic-q-a/26489/nrf24l01-the-length-of-received-data-exceed-32

Check warning on line 313 in drivers/nrf24l01p_ng/nrf24l01p_ng_netdev.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
and https://www.mikrocontroller.net/articles/NRF24L01_Tutorial */
nrf24l01p_ng_flush_rx(dev);
return 0;
Expand All @@ -323,7 +323,7 @@
}
/* drop frame, content in buf becomes invalid and return -ENOBUFS */
if (len < frame_len) {
DEBUG("[nrf24l01p_ng] Buffer too small: %u < %u, dropping frame\n",
DEBUG("[nrf24l01p_ng] Buffer too small: %" PRIuSIZE " < %u, dropping frame\n",
len, frame_len);
uint8_t garbage[pl_width];
nrf24l01p_ng_read_rx_payload(dev, garbage, pl_width);
Expand Down
3 changes: 2 additions & 1 deletion drivers/sx126x/sx126x_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <string.h>
#include <errno.h>

#include "architecture.h"
#include "iolist.h"
#include "net/netopt.h"
#include "net/netdev.h"
Expand Down Expand Up @@ -78,7 +79,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
return 0;
}

DEBUG("[sx126x] netdev: sending packet now (size: %d).\n", pos);
DEBUG("[sx126x] netdev: sending packet now (size: %" PRIuSIZE ").\n", pos);
sx126x_set_lora_payload_length(dev, pos);

state = NETOPT_STATE_TX;
Expand Down
2 changes: 1 addition & 1 deletion drivers/sx1280/sx1280_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
return 0;
}

DEBUG("[sx1280] netdev: sending packet now (size: %d).\n", pos);
DEBUG("[sx1280] netdev: sending packet now (size: %" PRIuSIZE ").\n", pos);
sx1280_set_lora_payload_length(dev, pos);

state = NETOPT_STATE_TX;
Expand Down
2 changes: 1 addition & 1 deletion sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt)
#ifdef MODULE_OD
static inline void _print_chunk(void *chunk, size_t size, int num)
{
printf("=========== chunk %3" PRIuSIZE " (%-10p size: %4u) ===========\n", num, chunk,
printf("=========== chunk %3i (%-10p size: %4" PRIuSIZE ") ===========\n", num, chunk,
size);
od_hex_dump(chunk, size, OD_WIDTH_DEFAULT);
}
Expand Down
2 changes: 1 addition & 1 deletion sys/net/gnrc/pktdump/gnrc_pktdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void _dump(gnrc_pktsnip_t *pkt)
gnrc_pktsnip_t *snip = pkt;

while (snip != NULL) {
printf("~~ SNIP %2" PRIuSIZE " - size: %3u byte, type: ", snips,
printf("~~ SNIP %2i - size: %3" PRIuSIZE " byte, type: ", snips,
snip->size);
_dump_snip(snip);
++snips;
Expand Down
7 changes: 4 additions & 3 deletions tests/unittests/tests-uri_parser/tests-uri_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@
(strncmp(actual_str, expected_str, actual_len) == 0)) {
return 0;
}
printf(
"\nWith given input uri '%s', expected %s '%s' with length '%" PRIuSIZE "' but got '%.*s' with length '%d'\n",
input_uri, name, expected_str, strlen(expected_str), actual_len, actual_str, actual_len);
printf("\nWith given input uri '%s', expected %s '%s' with length '%"
PRIuSIZE "' but got '%.*s' with length '%" PRIuSIZE "'\n",
input_uri, name, expected_str, strlen(expected_str),
(unsigned) actual_len, actual_str, actual_len);
return -1;
}

Expand Down Expand Up @@ -318,7 +319,7 @@
* but the uri_parser provides the length separately*/
if (uri_res.scheme_len != strlen(test_vec[i]->scheme)) {
printf(
"With given input uri '%s', expected a scheme with the length '%" PRIuSIZE "' but got '%d'\n",

Check warning on line 322 in tests/unittests/tests-uri_parser/tests-uri_parser.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
test_vec[i]->input_uri, strlen(test_vec[i]->scheme), uri_res.scheme_len);
TEST_FAIL(failure_msg);
}
Expand Down Expand Up @@ -349,7 +350,7 @@
.scheme = "coap",
.userinfo = "", /* This is an empty string because no userinfo has been set in this uri */
.host = "example.org",
.ipv6addr = "", /* This is an empty string because a hostname was used instead in this uri */

Check warning on line 353 in tests/unittests/tests-uri_parser/tests-uri_parser.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
.zoneid = "", /* Not applicable without ipv6 */
.port_str = "", /* This is an empty string because no port has been set in this uri */
.port = 0, /* Remains zero when no port is given */
Expand Down Expand Up @@ -489,7 +490,7 @@
}
}


Check warning on line 493 in tests/unittests/tests-uri_parser/tests-uri_parser.c

View workflow job for this annotation

GitHub Actions / static-tests

too many consecutive empty lines
static void test_uri_parser__unterminated_string(void)
{
char *failure_msg =
Expand Down Expand Up @@ -549,7 +550,7 @@
}
}


Check warning on line 553 in tests/unittests/tests-uri_parser/tests-uri_parser.c

View workflow job for this annotation

GitHub Actions / static-tests

too many consecutive empty lines
Test *tests_uri_parser_tests(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
Expand Down
Loading