[PATCH 2/2] perf, tools: Remove use of BUILD_BUG_ON
From: Andi Kleen
Date: Mon Nov 17 2014 - 20:59:09 EST
From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
BUILD_BUG_ON relies on the gcc optimizer, so it breaks
the build with DEBUG=1 which doesn't use -O2.
Turn the BUILD_BUG_ON into a runtime check again.
Also fix the check to check for 255, not 127.
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
tools/perf/util/machine.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 5c4d7f8..a24909b 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1446,8 +1446,7 @@ static int remove_loops(struct branch_entry *l, int nr)
memset(chash, NO_ENTRY, sizeof(chash));
- BUILD_BUG_ON_MSG(PERF_MAX_BRANCH_DEPTH > 127,
- "Please upgrade the type of the hash table from unsigned char");
+ BUG_ON(PERF_MAX_BRANCH_DEPTH > 255);
for (i = 0; i < nr; i++) {
int h = hash_64(l[i].from, CHASHBITS) % CHASHSZ;
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/