lkml.org 
[lkml]   [2017]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions
Date
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@google.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
\
 
 \ /
  Last update: 2017-08-27 09:55    [W:0.167 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site