All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/perf/util/*.c: Use "%zd" output format for size_t type
@ 2020-02-25  6:39 Xiao Yang
  2020-02-25 23:02 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Xiao Yang @ 2020-02-25  6:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: peterz, mingo, acme, Xiao Yang

Avoid the following errors when building perf:
-----------------------------------------------
util/session.c: In function 'perf_session__process_compressed_event':
util/session.c:91:11: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t {aka unsigned int}' [-Werror=format=]
  pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
...
til/zstd.c: In function 'zstd_decompress_stream':
util/zstd.c:102:11: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t {aka unsigned int}' [-Werror=format=]
    pr_err("failed to decompress (B): %ld -> %ld, dst_size %ld : %s\n",
...
-----------------------------------------------

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 tools/perf/util/session.c | 2 +-
 tools/perf/util/zstd.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index d0d7d25b23e3..5b74d606b4b7 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -88,7 +88,7 @@ static int perf_session__process_compressed_event(struct perf_session *session,
 		session->decomp_last = decomp;
 	}
 
-	pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
+	pr_debug("decomp (B): %zd to %zd\n", src_size, decomp_size);
 
 	return 0;
 }
diff --git a/tools/perf/util/zstd.c b/tools/perf/util/zstd.c
index d2202392ffdb..48dd2b018c47 100644
--- a/tools/perf/util/zstd.c
+++ b/tools/perf/util/zstd.c
@@ -99,7 +99,7 @@ size_t zstd_decompress_stream(struct zstd_data *data, void *src, size_t src_size
 	while (input.pos < input.size) {
 		ret = ZSTD_decompressStream(data->dstream, &output, &input);
 		if (ZSTD_isError(ret)) {
-			pr_err("failed to decompress (B): %ld -> %ld, dst_size %ld : %s\n",
+			pr_err("failed to decompress (B): %zd -> %zd, dst_size %zd : %s\n",
 			       src_size, output.size, dst_size, ZSTD_getErrorName(ret));
 			break;
 		}
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/perf/util/*.c: Use "%zd" output format for size_t type
  2020-02-25  6:39 [PATCH] tools/perf/util/*.c: Use "%zd" output format for size_t type Xiao Yang
@ 2020-02-25 23:02 ` Joe Perches
  2020-02-26  1:01   ` Xiao Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2020-02-25 23:02 UTC (permalink / raw)
  To: Xiao Yang, linux-kernel; +Cc: peterz, mingo, acme

On Tue, 2020-02-25 at 14:39 +0800, Xiao Yang wrote:
> Avoid the following errors when building perf:
> -----------------------------------------------
> util/session.c: In function 'perf_session__process_compressed_event':
> util/session.c:91:11: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t {aka unsigned int}' [-Werror=format=]
>   pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
[]
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
[]
> @@ -88,7 +88,7 @@ static int perf_session__process_compressed_event(struct perf_session *session,
>  		session->decomp_last = decomp;
>  	}
>  
> -	pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
> +	pr_debug("decomp (B): %zd to %zd\n", src_size, decomp_size);

likely better as %zu, etc...



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/perf/util/*.c: Use "%zd" output format for size_t type
  2020-02-25 23:02 ` Joe Perches
@ 2020-02-26  1:01   ` Xiao Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Xiao Yang @ 2020-02-26  1:01 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, peterz, mingo, acme

On 2020/2/26 7:02, Joe Perches wrote:
> On Tue, 2020-02-25 at 14:39 +0800, Xiao Yang wrote:
>> Avoid the following errors when building perf:
>> -----------------------------------------------
>> util/session.c: In function 'perf_session__process_compressed_event':
>> util/session.c:91:11: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t {aka unsigned int}' [-Werror=format=]
>>    pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
> []
>> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> []
>> @@ -88,7 +88,7 @@ static int perf_session__process_compressed_event(struct perf_session *session,
>>   		session->decomp_last = decomp;
>>   	}
>>
>> -	pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
>> +	pr_debug("decomp (B): %zd to %zd\n", src_size, decomp_size);
> likely better as %zu, etc...
Hi,

Sorry,  %zu is obvious better.
I will send v2 patch shortly.

Thanks,
Xiao Yang
>
>
>
> .
>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-26  1:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25  6:39 [PATCH] tools/perf/util/*.c: Use "%zd" output format for size_t type Xiao Yang
2020-02-25 23:02 ` Joe Perches
2020-02-26  1:01   ` Xiao Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.