[PATCH] Permit silencing of __deprecated warnings.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeff Garzik
Date: Thursday, October 25, 2007 - 1:06 am

The __deprecated marker is quite useful in highlighting the remnants of
old APIs that want removing.

However, it is quite normal for one or more years to pass, before the
(usually ancient, bitrotten) code in question is either updated or
deleted.

Thus, like __must_check, add a Kconfig option that permits the silencing
of this compiler warning.

This change mimics the ifdef-ery and Kconfig defaults of MUST_CHECK as
closely as possible.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 include/linux/compiler.h |    6 ++++++
 lib/Kconfig.debug        |    8 ++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c811c8b..c68b67b 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -101,6 +101,12 @@ extern void __chk_io_ptr(const volatile void __iomem *);
 #undef __must_check
 #define __must_check
 #endif
+#ifndef CONFIG_ENABLE_WARN_DEPRECATED
+#undef __deprecated
+#undef __deprecated_for_modules
+#define __deprecated
+#define __deprecated_for_modules
+#endif
 
 /*
  * Allow us to avoid 'defined but not used' warnings on functions and data,
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 1faa508..1e5f207 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -9,6 +9,14 @@ config PRINTK_TIME
 	  operations.  This is useful for identifying long delays
 	  in kernel startup.
 
+config ENABLE_WARN_DEPRECATED
+	bool "Enable __deprecated logic"
+	default y
+	help
+	  Enable the __deprecated logic in the kernel build.
+	  Disable this to suppress the "warning: 'foo' is deprecated
+	  (declared at kernel/power/somefile.c:1234)" messages.
+
 config ENABLE_MUST_CHECK
 	bool "Enable __must_check logic"
 	default y
-- 
1.5.2.4

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] sound/oss/sb_common.c: fix casting warning, Jeff Garzik, (Thu Oct 25, 1:06 am)
[PATCH] Permit silencing of __deprecated warnings., Jeff Garzik, (Thu Oct 25, 1:06 am)
[PATCH] Remove #warnings for longstanding conditions., Jeff Garzik, (Thu Oct 25, 1:06 am)
[PATCH] ISDN/capidrv: fix casting warning, Jeff Garzik, (Thu Oct 25, 1:06 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Andrew Morton, (Thu Oct 25, 1:15 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Jeff Garzik, (Thu Oct 25, 1:20 am)
Re: [PATCH] ISDN/capidrv: fix casting warning, Karsten Keil, (Thu Oct 25, 2:51 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Sam Ravnborg, (Thu Oct 25, 4:02 am)
Re: [PATCH] Remove #warnings for longstanding conditions., Matthew Wilcox, (Thu Oct 25, 4:22 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Linus Torvalds, (Thu Oct 25, 8:34 am)
Re: [PATCH] ISDN/capidrv: fix casting warning, Jeff Garzik, (Thu Oct 25, 5:53 pm)
Re: [PATCH] Remove #warnings for longstanding conditions., Matthew Wilcox, (Thu Oct 25, 7:14 pm)
Re: [PATCH] Permit silencing of __deprecated warnings., Arjan van de Ven, (Thu Oct 25, 8:07 pm)