Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking/lockdep: Change 'static const' variables to enum values

gcc warns about 'static const' variables even in headers when building
with -Wunused-const-variables enabled:

In file included from kernel/locking/lockdep_proc.c:25:
kernel/locking/lockdep_internals.h:69:28: error: 'LOCKF_USED_IN_IRQ_READ' defined but not used [-Werror=unused-const-variable=]
69 | static const unsigned long LOCKF_USED_IN_IRQ_READ =
| ^~~~~~~~~~~~~~~~~~~~~~
kernel/locking/lockdep_internals.h:63:28: error: 'LOCKF_ENABLED_IRQ_READ' defined but not used [-Werror=unused-const-variable=]
63 | static const unsigned long LOCKF_ENABLED_IRQ_READ =
| ^~~~~~~~~~~~~~~~~~~~~~
kernel/locking/lockdep_internals.h:57:28: error: 'LOCKF_USED_IN_IRQ' defined but not used [-Werror=unused-const-variable=]
57 | static const unsigned long LOCKF_USED_IN_IRQ =
| ^~~~~~~~~~~~~~~~~
kernel/locking/lockdep_internals.h:51:28: error: 'LOCKF_ENABLED_IRQ' defined but not used [-Werror=unused-const-variable=]
51 | static const unsigned long LOCKF_ENABLED_IRQ =
| ^~~~~~~~~~~~~~~~~

This one is easy to avoid by changing the generated constant definition
into an equivalent enum.

Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20250409122314.2848028-6-arnd@kernel.org

authored by

Arnd Bergmann and committed by
Boqun Feng
bd27cfb5 d7c36d63

+10 -8
+10 -8
kernel/locking/lockdep_internals.h
··· 47 47 __LOCKF(USED_READ) 48 48 }; 49 49 50 + enum { 50 51 #define LOCKDEP_STATE(__STATE) LOCKF_ENABLED_##__STATE | 51 - static const unsigned long LOCKF_ENABLED_IRQ = 52 + LOCKF_ENABLED_IRQ = 52 53 #include "lockdep_states.h" 53 - 0; 54 + 0, 54 55 #undef LOCKDEP_STATE 55 56 56 57 #define LOCKDEP_STATE(__STATE) LOCKF_USED_IN_##__STATE | 57 - static const unsigned long LOCKF_USED_IN_IRQ = 58 + LOCKF_USED_IN_IRQ = 58 59 #include "lockdep_states.h" 59 - 0; 60 + 0, 60 61 #undef LOCKDEP_STATE 61 62 62 63 #define LOCKDEP_STATE(__STATE) LOCKF_ENABLED_##__STATE##_READ | 63 - static const unsigned long LOCKF_ENABLED_IRQ_READ = 64 + LOCKF_ENABLED_IRQ_READ = 64 65 #include "lockdep_states.h" 65 - 0; 66 + 0, 66 67 #undef LOCKDEP_STATE 67 68 68 69 #define LOCKDEP_STATE(__STATE) LOCKF_USED_IN_##__STATE##_READ | 69 - static const unsigned long LOCKF_USED_IN_IRQ_READ = 70 + LOCKF_USED_IN_IRQ_READ = 70 71 #include "lockdep_states.h" 71 - 0; 72 + 0, 72 73 #undef LOCKDEP_STATE 74 + }; 73 75 74 76 #define LOCKF_ENABLED_IRQ_ALL (LOCKF_ENABLED_IRQ | LOCKF_ENABLED_IRQ_READ) 75 77 #define LOCKF_USED_IN_IRQ_ALL (LOCKF_USED_IN_IRQ | LOCKF_USED_IN_IRQ_READ)