From 8899bce153ac7c5efc24d55ff69fe8ddab35463b Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 2 Mar 2022 10:36:11 -0500 Subject: [PATCH] Fix: event: format specifier for ssize_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Observed issue ============== In file included from event.cpp:15: event.cpp: In function ‘ssize_t lttng_event_create_from_payload(lttng_payload_view*, lttng_event**, lttng_event_exclusion**, char**, lttng_bytecode**)’: ../../src/common/error.h:191:28: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘ssize_t’ {aka ‘int’} [-Wformat=] 191 | __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ## args) | ^~~~~~~~~~~~~~~~~~~~ ../../src/common/error.h:139:51: note: in definition of macro ‘__lttng_print’ 139 | fprintf((type) == PRINT_MSG ? stdout : stderr, fmt, ## args); \ | ^~~ event.cpp:624:4: note: in expansion of macro ‘WARN’ 624 | WARN("Userspace probe location from the received buffer is not the advertised length: header length = %" PRIu32 ", payload length = %lu", event_comm->userspace_probe_location_len, ret); | ^~~~ Solution ======== Albeit there is no "canonical" way of printing ssize_t, use '%zd' since we already make use of it elsewhere. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Id41e6ccf07bd580813f169b65d281a4fa305fb48 --- src/common/event.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index 9525d7132..6dca04def 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -621,7 +621,7 @@ deserialize_event_type_payload: } if (ret != event_comm->userspace_probe_location_len) { - WARN("Userspace probe location from the received buffer is not the advertised length: header length = %" PRIu32 ", payload length = %lu", event_comm->userspace_probe_location_len, ret); + WARN("Userspace probe location from the received buffer is not the advertised length: header length = %" PRIu32 ", payload length = %zd", event_comm->userspace_probe_location_len, ret); ret = -1; goto end; } -- 2.34.1