From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751515AbdFEJIJ (ORCPT ); Mon, 5 Jun 2017 05:08:09 -0400 Received: from terminus.zytor.com ([65.50.211.136]:53487 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751272AbdFEJIF (ORCPT ); Mon, 5 Jun 2017 05:08:05 -0400 Date: Mon, 5 Jun 2017 02:03:29 -0700 From: tip-bot for Ben Hutchings Message-ID: Cc: torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, ben@decadent.org.uk, hpa@zytor.com, mingo@kernel.org, sasha.levin@oracle.com Reply-To: peterz@infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, sasha.levin@oracle.com, mingo@kernel.org, hpa@zytor.com, ben@decadent.org.uk In-Reply-To: <20170525130005.5947-6-alexander.levin@verizon.com> References: <20170525130005.5947-6-alexander.levin@verizon.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] tools/lib/lockdep: Fix 'unused value' warnings Git-Commit-ID: bb7ea2a9af4c98ed70adf7627a2ba5d1ff1725e0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: bb7ea2a9af4c98ed70adf7627a2ba5d1ff1725e0 Gitweb: http://git.kernel.org/tip/bb7ea2a9af4c98ed70adf7627a2ba5d1ff1725e0 Author: Ben Hutchings AuthorDate: Thu, 25 May 2017 12:58:37 +0000 Committer: Ingo Molnar CommitDate: Mon, 5 Jun 2017 09:28:05 +0200 tools/lib/lockdep: Fix 'unused value' warnings liblockdep defines various macros that may expand to an expression with no effect, while the in-kernel definition does have an effect. This results in warnings from gcc when -Wunused-value is enabled, and is is enabled by -Wall. Fix this by introducing trivial functions, as function return values are generally allowed to be ignored. Signed-off-by: Ben Hutchings Signed-off-by: Sasha Levin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a.p.zijlstra@chello.nl Link: http://lkml.kernel.org/r/20170525130005.5947-6-alexander.levin@verizon.com Signed-off-by: Ingo Molnar --- tools/lib/lockdep/uinclude/linux/debug_locks.h | 2 +- tools/lib/lockdep/uinclude/linux/kernel.h | 12 +++++++++--- tools/lib/lockdep/uinclude/linux/lockdep.h | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/lib/lockdep/uinclude/linux/debug_locks.h b/tools/lib/lockdep/uinclude/linux/debug_locks.h index f38eb64..1d4fbec 100644 --- a/tools/lib/lockdep/uinclude/linux/debug_locks.h +++ b/tools/lib/lockdep/uinclude/linux/debug_locks.h @@ -4,7 +4,7 @@ #include #include -#define DEBUG_LOCKS_WARN_ON(x) (x) +#define DEBUG_LOCKS_WARN_ON(x) WARN_ON(x) extern bool debug_locks; extern bool debug_locks_silent; diff --git a/tools/lib/lockdep/uinclude/linux/kernel.h b/tools/lib/lockdep/uinclude/linux/kernel.h index da87bd9..021cff4 100644 --- a/tools/lib/lockdep/uinclude/linux/kernel.h +++ b/tools/lib/lockdep/uinclude/linux/kernel.h @@ -22,10 +22,16 @@ _max1 > _max2 ? _max1 : _max2; }) #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) -#define WARN_ON(x) (x) -#define WARN_ON_ONCE(x) (x) + +static inline int lockdep_warn(int condition) +{ + return condition; +} +#define WARN_ON(x) lockdep_warn(x) +#define WARN_ON_ONCE(x) WARN_ON(x) +#define WARN(x, y...) WARN_ON(x) + #define likely(x) (x) -#define WARN(x, y...) (x) #define uninitialized_var(x) x #define __init #define noinline diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep/uinclude/linux/lockdep.h index d302142..d107903 100644 --- a/tools/lib/lockdep/uinclude/linux/lockdep.h +++ b/tools/lib/lockdep/uinclude/linux/lockdep.h @@ -29,7 +29,11 @@ extern struct task_struct *__curr(void); #define current (__curr()) -#define debug_locks_off() 1 +static inline int debug_locks_off(void) +{ + return 1; +} + #define task_pid_nr(tsk) ((tsk)->pid) #define KSYM_NAME_LEN 128