[PATCH] perf tools: Initialize perf_data_file fd field

From: JÃrÃmie Galarneau
Date: Wed Aug 29 2018 - 16:23:29 EST


Building the perf CTF converter fails with gcc 4.8.4
on Ubuntu 14.04 with the following error:

error: missing initializer for field âfdâ of âstruct perf_data_fileâ
[-Werror=missing-field-initializers]

Per 4b838b0d and the ensuing discussion on the mailing
list, it appears that this affects other distributions
and gcc versions.

Signed-off-by: JÃrÃmie Galarneau <jeremie.galarneau@xxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
---
tools/perf/util/data-convert-bt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index abd38abf1d91..f75d4aa612c5 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -1578,7 +1578,7 @@ int bt_convert__perf2ctf(const char *input, const char *path,
{
struct perf_session *session;
struct perf_data data = {
- .file.path = input,
+ .file = { .path = input, .fd = -1 },
.mode = PERF_DATA_MODE_READ,
.force = opts->force,
};
--
2.18.0