From: David Carrillo-Cisneros <davidcc@google.com>
To: linux-kernel@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>,
Stephane Eranian <eranian@google.com>,
Paul Turner <pjt@google.com>,
David Carrillo-Cisneros <davidcc@google.com>
Subject: [PATCH] perf tools: Remove BUG_ON char[] to bool implicit conversions
Date: Mon, 28 Aug 2017 11:30:06 -0700 [thread overview]
Message-ID: <20170828183006.104367-1-davidcc@google.com> (raw)
In-Reply-To: <20170828093341.GA15692@krava>
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 printing
the error message and returning an error when possible.
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
tools/perf/builtin-lock.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ff98652484a7..55d3997ce194 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -3,6 +3,7 @@
#include "builtin.h"
#include "perf.h"
+#include "asm/bug.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/util.h"
@@ -147,12 +148,11 @@ static void thread_stat_insert(struct thread_stat *new)
p = container_of(*rb, struct thread_stat, rb);
parent = *rb;
+ WARN(new->tid == p->tid, "inserting invalid thread_stat\n");
if (new->tid < p->tid)
rb = &(*rb)->rb_left;
- else if (new->tid > p->tid)
- rb = &(*rb)->rb_right;
else
- BUG_ON("inserting invalid thread_stat\n");
+ rb = &(*rb)->rb_right;
}
rb_link_node(&new->rb, parent, rb);
@@ -457,8 +457,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");
- break;
+ pr_err("Unknown state of lock sequence found!\n");
+ return -1;
}
ls->nr_acquire++;
@@ -518,8 +518,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");
- break;
+ pr_err("Unknown state of lock sequence found!\n");
+ return -1;
}
seq->state = SEQ_STATE_ACQUIRED;
@@ -573,8 +573,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");
- break;
+ pr_err("Unknown state of lock sequence found!\n");
+ return -1;
}
seq->state = SEQ_STATE_CONTENDED;
@@ -632,8 +632,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");
- break;
+ pr_err("Unknown state of lock sequence found!\n");
+ return -1;
}
ls->nr_release++;
--
2.14.1.342.g6490525c54-goog
next prev parent reply other threads:[~2017-08-28 18:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-27 7:54 [PATCH 0/6] perf tools: Minor build fixes David Carrillo-Cisneros
2017-08-27 7:54 ` [PATCH 1/6] tools build tests: Don't hardcode gcc name David Carrillo-Cisneros
2017-08-29 21:22 ` [tip:perf/core] " tip-bot for David Carrillo-Cisneros
2017-08-27 7:54 ` [PATCH 2/6] perf tools: Allow external definition of flex and bison binary names David Carrillo-Cisneros
2017-08-29 21:23 ` [tip:perf/core] " tip-bot for David Carrillo-Cisneros
2017-08-27 7:54 ` [PATCH 3/6] tools lib: Allow external definition of CC, AR and LD David Carrillo-Cisneros
2017-08-29 21:23 ` [tip:perf/core] " tip-bot for David Carrillo-Cisneros
2017-08-27 7:54 ` [PATCH 4/6] perf tools: Robustify detection of clang binary David Carrillo-Cisneros
2017-08-29 21:23 ` [tip:perf/core] " tip-bot for David Carrillo-Cisneros
2017-08-27 7:54 ` [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions David Carrillo-Cisneros
2017-08-28 9:33 ` Jiri Olsa
2017-08-28 18:30 ` David Carrillo-Cisneros [this message]
2017-08-27 7:54 ` [PATCH 6/6] perf tools: Pass full path of FEATURES_DUMP David Carrillo-Cisneros
2017-08-29 21:24 ` [tip:perf/core] " tip-bot for David Carrillo-Cisneros
2017-08-28 9:34 ` [PATCH 0/6] perf tools: Minor build fixes Jiri Olsa
2017-08-28 14:16 ` Arnaldo Carvalho de Melo
2017-08-28 18:31 ` David Carrillo-Cisneros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170828183006.104367-1-davidcc@google.com \
--to=davidcc@google.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pjt@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox