From: "Vincent Stehlé" <vincent.stehle@intel.com>
To: linux-kernel@vger.kernel.org
Cc: "Vincent Stehlé" <vincent.stehle@intel.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Jiri Olsa" <jolsa@redhat.com>,
"Adrian Hunter" <adrian.hunter@intel.com>
Subject: [PATCH 1/2] perf: cast some printf() arguments to fix x32 build
Date: Thu, 6 Oct 2016 16:34:44 +0200 [thread overview]
Message-ID: <20161006143445.8523-1-vincent.stehle@intel.com> (raw)
Fix a few printf() format warnings regarding struct timeval fields on x32
(a.k.a AMD64 ILP32). As those warnings are treated as errors, they break
the build.
This fixes this kind of build warning:
bench/sched-pipe.c:160:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type '__time_t {aka long long int}' [-Werror=format=]
printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
^
Signed-off-by: Vincent Stehlé <vincent.stehle@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/bench/sched-messaging.c | 4 ++--
tools/perf/bench/sched-pipe.c | 4 ++--
tools/perf/builtin-kvm.c | 2 +-
tools/perf/builtin-stat.c | 3 ++-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index 6a111e77..7ad91c1 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -312,11 +312,11 @@ int bench_sched_messaging(int argc, const char **argv,
num_groups, num_groups * 2 * num_fds,
thread_mode ? "threads" : "processes");
printf(" %14s: %lu.%03lu [sec]\n", "Total time",
- diff.tv_sec,
+ (unsigned long) diff.tv_sec,
(unsigned long) (diff.tv_usec / USEC_PER_MSEC));
break;
case BENCH_FORMAT_SIMPLE:
- printf("%lu.%03lu\n", diff.tv_sec,
+ printf("%lu.%03lu\n", (unsigned long) diff.tv_sec,
(unsigned long) (diff.tv_usec / USEC_PER_MSEC));
break;
default:
diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 2243f01..62277fb 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -158,7 +158,7 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
result_usec += diff.tv_usec;
printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
- diff.tv_sec,
+ (unsigned long) diff.tv_sec,
(unsigned long) (diff.tv_usec / USEC_PER_MSEC));
printf(" %14lf usecs/op\n",
@@ -170,7 +170,7 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
case BENCH_FORMAT_SIMPLE:
printf("%lu.%03lu\n",
- diff.tv_sec,
+ (unsigned long) diff.tv_sec,
(unsigned long) (diff.tv_usec / USEC_PER_MSEC));
break;
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 08fa88f..9a6489f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -566,7 +566,7 @@ static void show_timeofday(void)
gettimeofday(&tv, NULL);
if (localtime_r(&tv.tv_sec, <ime)) {
strftime(date, sizeof(date), "%H:%M:%S", <ime);
- pr_info("%s.%06ld", date, tv.tv_usec);
+ pr_info("%s.%06ld", date, (long) tv.tv_usec);
} else
pr_info("00:00:00.000000");
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 688dea7..ab86bc6 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1393,7 +1393,8 @@ static void print_interval(char *prefix, struct timespec *ts)
FILE *output = stat_config.output;
static int num_print_interval;
- sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep);
+ sprintf(prefix, "%6lu.%09lu%s", (unsigned long) ts->tv_sec,
+ (unsigned long) ts->tv_nsec, csv_sep);
if (num_print_interval == 0 && !csv_output) {
switch (stat_config.aggr_mode) {
--
2.9.3
next reply other threads:[~2016-10-06 14:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-06 14:34 Vincent Stehlé [this message]
2016-10-06 14:34 ` [PATCH 2/2] perf x86: fix compilation of push/pop for x32 Vincent Stehlé
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=20161006143445.8523-1-vincent.stehle@intel.com \
--to=vincent.stehle@intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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
Powered by JetHome