Skip to content

Commit 771c035

Browse files
committed
deprecate the '__deprecated' attribute warnings entirely and for good
We haven't had lots of deprecation warnings lately, but the rdma use of it made them flare up again. They are not useful. They annoy everybody, and nobody ever does anything about them, because it's always "somebody elses problem". And when people start thinking that warnings are normal, they stop looking at them, and the real warnings that mean something go unnoticed. If you want to get rid of a function, just get rid of it. Convert every user to the new world order. And if you can't do that, then don't annoy everybody else with your marking that says "I couldn't be bothered to fix this, so I'll just spam everybody elses build logs with warnings about my laziness". Make a kernelnewbies wiki page about things that could be cleaned up, write a blog post about it, or talk to people on the mailing lists. But don't add warnings to the kernel build about cleanup that you think should happen but you aren't doing yourself. Don't. Just don't. Signed-off-by: Linus Torvalds <[email protected]>
1 parent a18d783 commit 771c035

File tree

3 files changed

+2
-28
lines changed

3 files changed

+2
-28
lines changed

include/linux/compiler-gcc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
#define __always_inline inline __attribute__((always_inline))
104104
#define noinline __attribute__((noinline))
105105

106-
#define __deprecated __attribute__((deprecated))
107106
#define __packed __attribute__((packed))
108107
#define __weak __attribute__((weak))
109108
#define __alias(symbol) __attribute__((alias(#symbol)))

include/linux/compiler_types.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,10 @@ struct ftrace_likely_data {
111111
#endif /* __ASSEMBLY__ */
112112

113113
#ifdef __KERNEL__
114-
/*
115-
* Allow us to mark functions as 'deprecated' and have gcc emit a nice
116-
* warning for each use, in hopes of speeding the functions removal.
117-
* Usage is:
118-
* int __deprecated foo(void)
119-
*/
120-
#ifndef __deprecated
121-
# define __deprecated /* unimplemented */
122-
#endif
123114

124-
#ifdef MODULE
125-
#define __deprecated_for_modules __deprecated
126-
#else
115+
/* Don't. Just don't. */
116+
#define __deprecated
127117
#define __deprecated_for_modules
128-
#endif
129118

130119
#ifndef __must_check
131120
#define __must_check
@@ -135,12 +124,6 @@ struct ftrace_likely_data {
135124
#undef __must_check
136125
#define __must_check
137126
#endif
138-
#ifndef CONFIG_ENABLE_WARN_DEPRECATED
139-
#undef __deprecated
140-
#undef __deprecated_for_modules
141-
#define __deprecated
142-
#define __deprecated_for_modules
143-
#endif
144127

145128
#ifndef __malloc
146129
#define __malloc

lib/Kconfig.debug

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,6 @@ config GDB_SCRIPTS
211211
instance. See Documentation/dev-tools/gdb-kernel-debugging.rst
212212
for further details.
213213

214-
config ENABLE_WARN_DEPRECATED
215-
bool "Enable __deprecated logic"
216-
default y
217-
help
218-
Enable the __deprecated logic in the kernel build.
219-
Disable this to suppress the "warning: 'foo' is deprecated
220-
(declared at kernel/power/somefile.c:1234)" messages.
221-
222214
config ENABLE_MUST_CHECK
223215
bool "Enable __must_check logic"
224216
default y

0 commit comments

Comments
 (0)