From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751422AbdH0Hzi (ORCPT ); Sun, 27 Aug 2017 03:55:38 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:38443 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751385AbdH0Hzd (ORCPT ); Sun, 27 Aug 2017 03:55:33 -0400 X-Google-Smtp-Source: ADKCNb74uJJTdlnMuZ/lT7TsGV5D3AaPg+Mm3IZAauNviIcqGEwQ/jemj1MIZQxNUrFmASy+q0l3Uw== From: David Carrillo-Cisneros To: linux-kernel@vger.kernel.org Cc: Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Stephane Eranian , Paul Turner , David Carrillo-Cisneros Subject: [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions Date: Sun, 27 Aug 2017 00:54:41 -0700 Message-Id: <20170827075442.108534-6-davidcc@google.com> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170827075442.108534-1-davidcc@google.com> References: <20170827075442.108534-1-davidcc@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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