liblockdep: Fix 'unused value' warnings
authorBen Hutchings <ben@decadent.org.uk>
Tue, 14 Jun 2016 19:13:23 +0000 (20:13 +0100)
committerAurelien Jarno <aurel32@debian.org>
Fri, 2 Mar 2018 07:52:22 +0000 (07:52 +0000)
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>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name liblockdep-fix-unused-value-warnings.patch

tools/lib/lockdep/uinclude/linux/debug_locks.h
tools/lib/lockdep/uinclude/linux/kernel.h
tools/lib/lockdep/uinclude/linux/lockdep.h

index f38eb64df79447535fdcb71d62e0f43deec4bc0c..1d4fbec5c64938b3dc7e8333151ad37657220453 100644 (file)
@@ -4,7 +4,7 @@
 #include <stddef.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_silent;
index da87bd9ad2c1848100987ba415cfae90792eb4b3..021cff4f4e3d34cad16b4fd2dc4119401b99b2c0 100644 (file)
        _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
index d30214221920d6c03ab5691ee869a908c780e911..d1079034a14d7f70de5b8faa64d1f4617cf279d2 100644 (file)
@@ -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