Re: [PATCH] Permit silencing of __deprecated warnings.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeff Garzik <jeff@...>
Cc: LKML <linux-kernel@...>, <akpm@...>, <torvalds@...>, Arnd Bergmann <arnd@...>
Date: Thursday, October 25, 2007 - 7:02 am

On Thu, Oct 25, 2007 at 04:06:13AM -0400, Jeff Garzik wrote:

Reminded me of a patch I have had floating around for far too long time.

Snippet from the mail:
--------------------------
From: Arnd Bergmann <arnd@arndb.de>

On Sünndag 07 August 2005 20:26, Martin J. Bligh wrote:

We could in theory create a new EXPORT_SYMBOL variant that does not
reference the symbol directly. This does a little less compile-time
checks but helps reduce the noise. The big advantage of this
would be that we could once again build kernels with -Werror on
developer machines.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/include/linux/module.h b/include/linux/module.h
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -182,21 +182,26 @@ void *__symbol_get_gpl(const char *symbo
 #endif
 
 /* For every exported symbol, place a struct in the __ksymtab section */
-#define __EXPORT_SYMBOL(sym, sec)				\
-	__CRC_SYMBOL(sym, sec)					\
-	static const char __kstrtab_##sym[]			\
+#define __EXPORT_SYMBOL(name, sym, sec)				\
+	__CRC_SYMBOL(name, sec)					\
+	static const char __kstrtab_##name[]			\
 	__attribute__((section("__ksymtab_strings")))		\
-	= MODULE_SYMBOL_PREFIX #sym;                    	\
-	static const struct kernel_symbol __ksymtab_##sym	\
+	= MODULE_SYMBOL_PREFIX #name;                    	\
+	static const struct kernel_symbol __ksymtab_##name	\
 	__attribute_used__					\
 	__attribute__((section("__ksymtab" sec), unused))	\
-	= { (unsigned long)&sym, __kstrtab_##sym }
+	= { (unsigned long)&sym, __kstrtab_##name }
 
 #define EXPORT_SYMBOL(sym)					\
-	__EXPORT_SYMBOL(sym, "")
+	__EXPORT_SYMBOL(sym, sym, "")
 
 #define EXPORT_SYMBOL_GPL(sym)					\
-	__EXPORT_SYMBOL(sym, "_gpl")
+	__EXPORT_SYMBOL(sym, sym, "_gpl")
+
+#define EXPORT_DEPRECATED_SYMBOL(sym)				\
+	extern void __deprecated_ ## sym 			\
+			__attribute__((alias(#sym)));		\
+	__EXPORT_SYMBOL(sym, __deprecated_ ## sym, "_gpl")
 
 #endif
 
------------------------

Obviously it does not apply today but it does not make sense
to warn about the old API symbol being exported.
Do you see something wrong in the approach Arnd used?

I just never came around to look at it.

	Sam
-
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, 4:06 am)
[PATCH] ISDN/capidrv: fix casting warning, Jeff Garzik, (Thu Oct 25, 4:06 am)
Re: [PATCH] ISDN/capidrv: fix casting warning, Karsten Keil, (Thu Oct 25, 5:51 am)
Re: [PATCH] ISDN/capidrv: fix casting warning, Jeff Garzik, (Thu Oct 25, 8:53 pm)
[PATCH] Remove #warnings for longstanding conditions., Jeff Garzik, (Thu Oct 25, 4:06 am)
Re: [PATCH] Remove #warnings for longstanding conditions., Matthew Wilcox, (Thu Oct 25, 7:22 am)
Re: [PATCH] Remove #warnings for longstanding conditions., Matthew Wilcox, (Thu Oct 25, 10:14 pm)
[PATCH] Permit silencing of __deprecated warnings., Jeff Garzik, (Thu Oct 25, 4:06 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Arjan van de Ven, (Thu Oct 25, 11:07 pm)
Re: [PATCH] Permit silencing of __deprecated warnings., Sam Ravnborg, (Thu Oct 25, 7:02 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Andrew Morton, (Thu Oct 25, 4:15 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Linus Torvalds, (Thu Oct 25, 11:34 am)
Re: [PATCH] Permit silencing of __deprecated warnings., Jeff Garzik, (Thu Oct 25, 4:20 am)