All of lore.kernel.org
 help / color / mirror / Atom feed
* perf pmu: clang points out: address of array 'alias->unit' will always evaluate to 'true'
@ 2017-02-14 18:24 Arnaldo Carvalho de Melo
  2017-02-15 10:50 ` Jiri Olsa
  2017-02-16 20:04 ` [tip:perf/core] perf pmu: Fix check for unset alias->unit array tip-bot for Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-02-14 18:24 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: Linux Kernel Mailing List

util/pmu.c:948:28: error: address of array 'alias->unit' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
        if ((info->unit && alias->unit) ||
                        ~~ ~~~~~~~^~~~
util/pmu.c:953:13: error: address of array 'alias->unit' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
        if (alias->unit)
        ~~  ~~~~~~~^~~~
2 errors generated.


So, is this test about having something on that alias->unit array? I.e.
should this suffice?

[acme@jouet linux]$ cat clang.patch 
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 82a654dec666..49bfee0e3d9e 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -945,12 +945,12 @@ static int check_info_data(struct perf_pmu_alias *alias,
 	 * define unit, scale and snapshot, fail
 	 * if there's more than one.
 	 */
-	if ((info->unit && alias->unit) ||
+	if ((info->unit && alias->unit[0]) ||
 	    (info->scale && alias->scale) ||
 	    (info->snapshot && alias->snapshot))
 		return -EINVAL;
 
-	if (alias->unit)
+	if (alias->unit[0])
 		info->unit = alias->unit;
 
 	if (alias->scale)
[acme@jouet linux]$ 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-16 20:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14 18:24 perf pmu: clang points out: address of array 'alias->unit' will always evaluate to 'true' Arnaldo Carvalho de Melo
2017-02-15 10:50 ` Jiri Olsa
2017-02-15 12:41   ` perf bison: clang points out: error: conflicting types for 'parse_events_error' " Arnaldo Carvalho de Melo
2017-02-15 12:52     ` Jiri Olsa
2017-02-15 13:06       ` perf build with clang, modulo libpython: " Arnaldo Carvalho de Melo
2017-02-15 13:21         ` Jiri Olsa
2017-02-16 20:05         ` [tip:perf/core] perf tools: Add missing parse_events_error() prototype tip-bot for Arnaldo Carvalho de Melo
2017-02-16 20:04 ` [tip:perf/core] perf pmu: Fix check for unset alias->unit array tip-bot for Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.