Skip to content

Commit bd27cfb

Browse files
arndbfbq
authored andcommitted
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 <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Boqun Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d7c36d6 commit bd27cfb

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

kernel/locking/lockdep_internals.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,31 @@ enum {
4747
__LOCKF(USED_READ)
4848
};
4949

50+
enum {
5051
#define LOCKDEP_STATE(__STATE) LOCKF_ENABLED_##__STATE |
51-
static const unsigned long LOCKF_ENABLED_IRQ =
52+
LOCKF_ENABLED_IRQ =
5253
#include "lockdep_states.h"
53-
0;
54+
0,
5455
#undef LOCKDEP_STATE
5556

5657
#define LOCKDEP_STATE(__STATE) LOCKF_USED_IN_##__STATE |
57-
static const unsigned long LOCKF_USED_IN_IRQ =
58+
LOCKF_USED_IN_IRQ =
5859
#include "lockdep_states.h"
59-
0;
60+
0,
6061
#undef LOCKDEP_STATE
6162

6263
#define LOCKDEP_STATE(__STATE) LOCKF_ENABLED_##__STATE##_READ |
63-
static const unsigned long LOCKF_ENABLED_IRQ_READ =
64+
LOCKF_ENABLED_IRQ_READ =
6465
#include "lockdep_states.h"
65-
0;
66+
0,
6667
#undef LOCKDEP_STATE
6768

6869
#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 =
7071
#include "lockdep_states.h"
71-
0;
72+
0,
7273
#undef LOCKDEP_STATE
74+
};
7375

7476
#define LOCKF_ENABLED_IRQ_ALL (LOCKF_ENABLED_IRQ | LOCKF_ENABLED_IRQ_READ)
7577
#define LOCKF_USED_IN_IRQ_ALL (LOCKF_USED_IN_IRQ | LOCKF_USED_IN_IRQ_READ)

0 commit comments

Comments
 (0)