linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Cc: <peterz@infradead.org>, <mingo@redhat.com>,
	<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
	<jolsa@redhat.com>, <namhyung@kernel.org>
Subject: [PATCH] perf: fix compilation failure on i386
Date: Fri, 1 May 2020 16:15:27 +0800	[thread overview]
Message-ID: <20200501081527.4343-1-caoj.fnst@cn.fujitsu.com> (raw)

Compilation on i386 complains as following:

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);
           ^

util/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",
           ^

util/zstd.c: In function 'zstd_compress_stream_to_records':
util/zstd.c:77:11: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'long int' [-Werror=format=]
    pr_err("failed to compress %zd bytes: %s\n",
           ^

Fix them by pairing "%zd" to size_t.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 tools/perf/util/session.c | 2 +-
 tools/perf/util/zstd.c    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0b0bfe5bef17..50c2ffa388ad 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..877bfb79e4af 100644
--- a/tools/perf/util/zstd.c
+++ b/tools/perf/util/zstd.c
@@ -74,8 +74,8 @@ size_t zstd_compress_stream_to_records(struct zstd_data *data, void *dst, size_t
 		ret = ZSTD_compressStream(data->cstream, &output, &input);
 		ZSTD_flushStream(data->cstream, &output);
 		if (ZSTD_isError(ret)) {
-			pr_err("failed to compress %ld bytes: %s\n",
-				(long)src_size, ZSTD_getErrorName(ret));
+			pr_err("failed to compress %zd bytes: %s\n",
+				src_size, ZSTD_getErrorName(ret));
 			memcpy(dst, src, src_size);
 			return src_size;
 		}
@@ -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




             reply	other threads:[~2020-05-01  8:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  8:15 Cao jin [this message]
2020-05-01  8:24 ` [PATCH] perf: fix compilation failure on i386 Cao jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200501081527.4343-1-caoj.fnst@cn.fujitsu.com \
    --to=caoj.fnst@cn.fujitsu.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).