public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions
Date: Sun, 27 Aug 2017 00:54:41 -0700	[thread overview]
Message-ID: <20170827075442.108534-6-davidcc@google.com> (raw)
In-Reply-To: <20170827075442.108534-1-davidcc@google.com>

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

  parent reply	other threads:[~2017-08-27  7:55 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 ` David Carrillo-Cisneros [this message]
2017-08-28  9:33   ` [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions Jiri Olsa
2017-08-28 18:30     ` [PATCH] " David Carrillo-Cisneros
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=20170827075442.108534-6-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