From: Jérémie Galarneau Date: Wed, 27 May 2020 15:27:26 +0000 (-0400) Subject: Fix: incorrect specifier %lu used with size_t argument X-Git-Tag: v2.12.2~37 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=63bacd795cb760288469e104e90052e3b84f482f;p=lttng-tools.git Fix: incorrect specifier %lu used with size_t argument Fixes the following warning on 32-bit targets: libtool: compile: gcc -DHAVE_CONFIG_H -I../../../include -I../../../include -I../../../src -include config.h -I/build/include -I/home/jenkins/workspace/lttng-tools_master_portbuild/arch/armhf/babeltrace_version/stable-1.5/build/std/conf/std/liburcu_version/master/test_type/base/deps/build/include -Wall -Wno-incomplete-setjmp-declaration -Wdiscarded-qualifiers -Wmissing-declarations -Wmissing-prototypes -Wmissing-parameter-type -fno-strict-aliasing -pthread -g -O2 -MT consumer-stream.lo -MD -MP -MF .deps/consumer-stream.Tpo -c consumer-stream.c -fPIC -DPIC -o .libs/consumer-stream.o In file included from ../../../src/common/common.h:12:0, from consumer.c:25: consumer.c: In function ‘lttng_consumer_on_read_subbuffer_mmap’: ../../../src/common/error.h:161:35: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘size_t {aka unsigned int}’ [-Wformat=] #define DBG(fmt, args...) _ERRMSG("DEBUG1", PRINT_DBG, fmt, ## args) ^ ../../../src/common/error.h:136:51: note: in definition of macro ‘__lttng_print’ fprintf((type) == PRINT_MSG ? stdout : stderr, fmt, ## args); \ ^~~ ../../../src/common/error.h:161:27: note: in expansion of macro ‘_ERRMSG’ #define DBG(fmt, args...) _ERRMSG("DEBUG1", PRINT_DBG, fmt, ## args) ^~~~~~~ consumer.c:1688:2: note: in expansion of macro ‘DBG’ DBG("Consumer mmap write() ret %zd (len %lu)", ret, write_len); ^~~ Signed-off-by: Jérémie Galarneau Change-Id: Id9a571d8e94105428833baa053c6463b91484a03 --- diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 52b15867b..50951fd28 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -1685,7 +1685,7 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( * receive a ret value that is bigger than len. */ ret = lttng_write(outfd, buffer->data, write_len); - DBG("Consumer mmap write() ret %zd (len %lu)", ret, write_len); + DBG("Consumer mmap write() ret %zd (len %zu)", ret, write_len); if (ret < 0 || ((size_t) ret != write_len)) { /* * Report error to caller if nothing was written else at least send the