lkml.org 
[lkml]   [2017]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectperf pmu: clang points out: address of array 'alias->unit' will always evaluate to 'true'
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]$
\
 
 \ /
  Last update: 2017-02-14 19:25    [W:0.066 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site