[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170827075442.108534-6-davidcc@google.com>
Date: Sun, 27 Aug 2017 00:54:41 -0700
From: David Carrillo-Cisneros <davidcc@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Stephane Eranian <eranian@...gle.com>,
Paul Turner <pjt@...gle.com>,
David Carrillo-Cisneros <davidcc@...gle.com>
Subject: [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions
When compiling with LLVM, errors like this are shown:
builtin-lock.c:46:10: error: implicit conversion turns string literal into bool: 'const char [39]' to 'bool'
Due to error message implicit conversion into bool. Fix it by defining a
BUG macro without a boolean argument and use it instead.
Signed-off-by: David Carrillo-Cisneros <davidcc@...gle.com>
---
tools/include/linux/kernel.h | 2 ++
tools/perf/builtin-lock.c | 15 ++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index 77d2e94ca5df..0951c96205c4 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -70,6 +70,8 @@
#endif
#endif
+#define BUG() abort()
+
#if __BYTE_ORDER == __BIG_ENDIAN
#define cpu_to_le16 bswap_16
#define cpu_to_le32 bswap_32
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ff98652484a7..7d1e42cccc89 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -152,7 +152,8 @@ static void thread_stat_insert(struct thread_stat *new)
else if (new->tid > p->tid)
rb = &(*rb)->rb_right;
else
- BUG_ON("inserting invalid thread_stat\n");
+ pr_err("inserting invalid thread_stat\n");
+ BUG();
}
rb_link_node(&new->rb, parent, rb);
@@ -457,7 +458,8 @@ static int report_lock_acquire_event(struct perf_evsel *evsel,
free(seq);
goto end;
default:
- BUG_ON("Unknown state of lock sequence found!\n");
+ pr_err("Unknown state of lock sequence found!\n");
+ BUG();
break;
}
@@ -518,7 +520,8 @@ static int report_lock_acquired_event(struct perf_evsel *evsel,
free(seq);
goto end;
default:
- BUG_ON("Unknown state of lock sequence found!\n");
+ pr_err("Unknown state of lock sequence found!\n");
+ BUG();
break;
}
@@ -573,7 +576,8 @@ static int report_lock_contended_event(struct perf_evsel *evsel,
free(seq);
goto end;
default:
- BUG_ON("Unknown state of lock sequence found!\n");
+ pr_err("Unknown state of lock sequence found!\n");
+ BUG();
break;
}
@@ -632,7 +636,8 @@ static int report_lock_release_event(struct perf_evsel *evsel,
bad_hist[BROKEN_RELEASE]++;
goto free_seq;
default:
- BUG_ON("Unknown state of lock sequence found!\n");
+ pr_err("Unknown state of lock sequence found!\n");
+ BUG();
break;
}
--
2.14.1.342.g6490525c54-goog
Powered by blists - more mailing lists