diff options
author | Jakub Kicinski <kuba@kernel.org> | 2020-09-16 21:45:27 +0300 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2020-11-03 04:10:01 +0300 |
commit | cd539cff9470fe1dacf0bf5ab3f54f37b854d6fc (patch) | |
tree | 56726e0cb2c66c6a42956c9bc7e1ec1052172b1a /include/linux/rcupdate.h | |
parent | f505d4346f6129d4708338491cf23ca9cf1d8f2a (diff) | |
download | linux-cd539cff9470fe1dacf0bf5ab3f54f37b854d6fc.tar.xz |
lockdep: Provide dummy forward declaration of *_is_held() helpers
When CONFIG_LOCKDEP is not set, lock_is_held() and lockdep_is_held()
are not declared or defined. This forces all callers to use #ifdefs
around these checks.
Recent RCU changes added a lot of lockdep_is_held() calls inside
rcu_dereference_protected(). This macro hides its argument on !LOCKDEP
builds, which can lead to false-positive unused-variable warnings.
This commit therefore provides forward declarations of lock_is_held()
and lockdep_is_held() but without defining them. This way callers
(including those internal to RCU) can keep them visible to the compiler
on !LOCKDEP builds and instead depend on dead code elimination to remove
the references, which in turn prevents the linker from complaining about
the lack of the corresponding function definitions.
[ paulmck: Apply Peter Zijlstra feedback on "extern". ]
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--
CC: peterz@infradead.org
CC: mingo@redhat.com
CC: will@kernel.org
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'include/linux/rcupdate.h')
0 files changed, 0 insertions, 0 deletions