Commit bb7ea2a9 authored by Ben Hutchings's avatar Ben Hutchings Committed by Ingo Molnar

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: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarSasha 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.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent db8f7796
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <stddef.h> #include <stddef.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#define DEBUG_LOCKS_WARN_ON(x) (x) #define DEBUG_LOCKS_WARN_ON(x) WARN_ON(x)
extern bool debug_locks; extern bool debug_locks;
extern bool debug_locks_silent; extern bool debug_locks_silent;
......
...@@ -22,10 +22,16 @@ ...@@ -22,10 +22,16 @@
_max1 > _max2 ? _max1 : _max2; }) _max1 > _max2 ? _max1 : _max2; })
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #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 likely(x) (x)
#define WARN(x, y...) (x)
#define uninitialized_var(x) x #define uninitialized_var(x) x
#define __init #define __init
#define noinline #define noinline
......
...@@ -29,7 +29,11 @@ extern struct task_struct *__curr(void); ...@@ -29,7 +29,11 @@ extern struct task_struct *__curr(void);
#define current (__curr()) #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 task_pid_nr(tsk) ((tsk)->pid)
#define KSYM_NAME_LEN 128 #define KSYM_NAME_LEN 128
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment