diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-02-14 08:59:04 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-02-14 13:19:19 -0500 |
commit | 9d6aae725454beada044179f1005c8f8c206dd6a (patch) | |
tree | 8d5596ae4206303c62bae561d8410690f83469b0 /tools | |
parent | 423d856a4d6ab26a50309fd051f2bdf0e5d00fd6 (diff) |
perf record: Do not put a variable sized type not at the end of a struct
As this is a GNU extension and while harmless in this case, we can do
the same thing in a more clearer way by using an existing thread_map
constructor.
With this we avoid this while compiling with clang:
builtin-record.c:659:21: error: field 'map' with variable sized type 'struct thread_map' not at the end of a struct or class is a GNU extension
[-Werror,-Wgnu-variable-sized-type-not-at-end]
struct thread_map map;
^
1 error generated.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-c9drclo52ezxmwa7qxklin2y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 2ddf189968dc..6cd6776052e7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -655,22 +655,23 @@ record__finish_output(struct record *rec) | |||
655 | 655 | ||
656 | static int record__synthesize_workload(struct record *rec, bool tail) | 656 | static int record__synthesize_workload(struct record *rec, bool tail) |
657 | { | 657 | { |
658 | struct { | 658 | int err; |
659 | struct thread_map map; | 659 | struct thread_map *thread_map; |
660 | struct thread_map_data map_data; | ||
661 | } thread_map; | ||
662 | 660 | ||
663 | if (rec->opts.tail_synthesize != tail) | 661 | if (rec->opts.tail_synthesize != tail) |
664 | return 0; | 662 | return 0; |
665 | 663 | ||
666 | thread_map.map.nr = 1; | 664 | thread_map = thread_map__new_by_tid(rec->evlist->workload.pid); |
667 | thread_map.map.map[0].pid = rec->evlist->workload.pid; | 665 | if (thread_map == NULL) |
668 | thread_map.map.map[0].comm = NULL; | 666 | return -1; |
669 | return perf_event__synthesize_thread_map(&rec->tool, &thread_map.map, | 667 | |
668 | err = perf_event__synthesize_thread_map(&rec->tool, thread_map, | ||
670 | process_synthesized_event, | 669 | process_synthesized_event, |
671 | &rec->session->machines.host, | 670 | &rec->session->machines.host, |
672 | rec->opts.sample_address, | 671 | rec->opts.sample_address, |
673 | rec->opts.proc_map_timeout); | 672 | rec->opts.proc_map_timeout); |
673 | thread_map__put(thread_map); | ||
674 | return err; | ||
674 | } | 675 | } |
675 | 676 | ||
676 | static int record__synthesize(struct record *rec, bool tail); | 677 | static int record__synthesize(struct record *rec, bool tail); |