perf symbols: dso->name is an array, no need to check it against NULL
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Feb 2017 20:11:03 +0000 (17:11 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Feb 2017 20:22:35 +0000 (17:22 -0300)
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 <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-x8cu007cly40kfp8xnpi9kya@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/map.c
tools/perf/util/scripting-engines/trace-event-perl.c

index 4f9a71c63026d185e48807895f0bee39570e8598..0a943e7b1ea7fc745485f016875395e91feca8c8 100644 (file)
@@ -387,10 +387,10 @@ size_t map__fprintf_dsoname(struct map *map, FILE *fp)
 {
        const char *dsoname = "[unknown]";
 
-       if (map && map->dso && (map->dso->name || map->dso->long_name)) {
+       if (map && map->dso) {
                if (symbol_conf.show_kernel_path && map->dso->long_name)
                        dsoname = map->dso->long_name;
-               else if (map->dso->name)
+               else
                        dsoname = map->dso->name;
        }
 
index 014ecd6f67c439141839ce7c967c1d2e1e1d09e0..c1555fd0035a0f01632312be2488710afe6b7556 100644 (file)
@@ -309,10 +309,10 @@ static SV *perl_process_callchain(struct perf_sample *sample,
                if (node->map) {
                        struct map *map = node->map;
                        const char *dsoname = "[unknown]";
-                       if (map && map->dso && (map->dso->name || map->dso->long_name)) {
+                       if (map && map->dso) {
                                if (symbol_conf.show_kernel_path && map->dso->long_name)
                                        dsoname = map->dso->long_name;
-                               else if (map->dso->name)
+                               else
                                        dsoname = map->dso->name;
                        }
                        if (!hv_stores(elem, "dso", newSVpv(dsoname,0))) {