diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2017-05-25 08:58:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-06-05 03:28:05 -0400 |
commit | bb7ea2a9af4c98ed70adf7627a2ba5d1ff1725e0 (patch) | |
tree | c464ae9e67e00ade2291537a42488b997e3b6ff8 | |
parent | db8f7796c491a7b0a220a89a4abd9134f3906f43 (diff) |
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 <ben@decadent.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: a.p.zijlstra@chello.nl
Link: http://lkml.kernel.org/r/20170525130005.5947-6-alexander.levin@verizon.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/lib/lockdep/uinclude/linux/debug_locks.h | 2 | ||||
-rw-r--r-- | tools/lib/lockdep/uinclude/linux/kernel.h | 12 | ||||
-rw-r--r-- | 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 f38eb64df794..1d4fbec5c649 100644 --- a/tools/lib/lockdep/uinclude/linux/debug_locks.h +++ b/tools/lib/lockdep/uinclude/linux/debug_locks.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <stddef.h> | 4 | #include <stddef.h> |
5 | #include <linux/compiler.h> | 5 | #include <linux/compiler.h> |
6 | 6 | ||
7 | #define DEBUG_LOCKS_WARN_ON(x) (x) | 7 | #define DEBUG_LOCKS_WARN_ON(x) WARN_ON(x) |
8 | 8 | ||
9 | extern bool debug_locks; | 9 | extern bool debug_locks; |
10 | extern bool debug_locks_silent; | 10 | extern bool debug_locks_silent; |
diff --git a/tools/lib/lockdep/uinclude/linux/kernel.h b/tools/lib/lockdep/uinclude/linux/kernel.h index da87bd9ad2c1..021cff4f4e3d 100644 --- a/tools/lib/lockdep/uinclude/linux/kernel.h +++ b/tools/lib/lockdep/uinclude/linux/kernel.h | |||
@@ -22,10 +22,16 @@ | |||
22 | _max1 > _max2 ? _max1 : _max2; }) | 22 | _max1 > _max2 ? _max1 : _max2; }) |
23 | 23 | ||
24 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | 24 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
25 | #define WARN_ON(x) (x) | 25 | |
26 | #define WARN_ON_ONCE(x) (x) | 26 | static inline int lockdep_warn(int condition) |
27 | { | ||
28 | return condition; | ||
29 | } | ||
30 | #define WARN_ON(x) lockdep_warn(x) | ||
31 | #define WARN_ON_ONCE(x) WARN_ON(x) | ||
32 | #define WARN(x, y...) WARN_ON(x) | ||
33 | |||
27 | #define likely(x) (x) | 34 | #define likely(x) (x) |
28 | #define WARN(x, y...) (x) | ||
29 | #define uninitialized_var(x) x | 35 | #define uninitialized_var(x) x |
30 | #define __init | 36 | #define __init |
31 | #define noinline | 37 | #define noinline |
diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep/uinclude/linux/lockdep.h index d30214221920..d1079034a14d 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); | |||
29 | 29 | ||
30 | #define current (__curr()) | 30 | #define current (__curr()) |
31 | 31 | ||
32 | #define debug_locks_off() 1 | 32 | static inline int debug_locks_off(void) |
33 | { | ||
34 | return 1; | ||
35 | } | ||
36 | |||
33 | #define task_pid_nr(tsk) ((tsk)->pid) | 37 | #define task_pid_nr(tsk) ((tsk)->pid) |
34 | 38 | ||
35 | #define KSYM_NAME_LEN 128 | 39 | #define KSYM_NAME_LEN 128 |