Skip to content

Commit 5eae7d8

Browse files
committed
perf symbols: dso->name is an array, no need to check it against NULL
As it will always evaluate to 'true', as reported by clang: util/map.c:390:36: error: address of array 'map->dso->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if (map && map->dso && (map->dso->name || map->dso->long_name)) { ~~~~~~~~~~^~~~ ~~ util/map.c:393:22: error: address of array 'map->dso->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] else if (map->dso->name) ~~ ~~~~~~~~~~^~~~ Cc: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 9ef6839 commit 5eae7d8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tools/perf/util/map.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,10 @@ size_t map__fprintf_dsoname(struct map *map, FILE *fp)
387387
{
388388
const char *dsoname = "[unknown]";
389389

390-
if (map && map->dso && (map->dso->name || map->dso->long_name)) {
390+
if (map && map->dso) {
391391
if (symbol_conf.show_kernel_path && map->dso->long_name)
392392
dsoname = map->dso->long_name;
393-
else if (map->dso->name)
393+
else
394394
dsoname = map->dso->name;
395395
}
396396

tools/perf/util/scripting-engines/trace-event-perl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ static SV *perl_process_callchain(struct perf_sample *sample,
309309
if (node->map) {
310310
struct map *map = node->map;
311311
const char *dsoname = "[unknown]";
312-
if (map && map->dso && (map->dso->name || map->dso->long_name)) {
312+
if (map && map->dso) {
313313
if (symbol_conf.show_kernel_path && map->dso->long_name)
314314
dsoname = map->dso->long_name;
315-
else if (map->dso->name)
315+
else
316316
dsoname = map->dso->name;
317317
}
318318
if (!hv_stores(elem, "dso", newSVpv(dsoname,0))) {

0 commit comments

Comments
 (0)