Skip to contentSkip to conversation

include/linux/module.h - compile warning cleanup

PATCH In review [email protected] 2 participants 2 messages Mar 5, 2005 – Mar 7, 2005 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 9/12 include/linux/module.h - compile warning cleanup

, extinguish warning for module structure that is still live when module is compiled into the kernel; do this in one central place so all such type warnings are automatically taken care of

---

 kj-domen/include/linux/module.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)
include/linux/module.h renamed from include/linux/module.h~extinguish_warnings-include_linux_module.h +4 -1
diff -puN include/linux/module.h~extinguish_warnings-include_linux_module.h include/linux/module.h
@@ -93,7 +93,10 @@ extern struct module __this_module;
 
 #else  /* !MODULE */
 
-#define MODULE_GENERIC_TABLE(gtype,name)
+#define MODULE_GENERIC_TABLE(gtype,name)			\
+extern const struct gtype##_id __not_mod_##name##_unused	\
+  __attribute__ ((unused, weak, alias(__stringify(name))))
+
 #define __MODULE_INFO(tag, name, info)
 #define THIS_MODULE ((struct module *)0)
 #endif

_

#1 lore raw
Quoted 17 lines · [email protected] wrote:

, extinguish warning for module structure that is still live when module is compiled into the kernel; do this in one central place so all such type warnings are automatically taken care of

---

 kj-domen/include/linux/module.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN include/linux/module.h~extinguish_warnings-include_linux_module.h include/linux/module.h

include/linux/module.h extern struct module __this_module; · line 99

Quoted 8 lines
include/linux/module.h renamed from include/linux/module.h~extinguish_warnings-include_linux_module.h +4 -1
@@ -93,7 +93,10 @@ extern struct module __this_module;
 
 #else  /* !MODULE */
 
-#define MODULE_GENERIC_TABLE(gtype,name)
+#define MODULE_GENERIC_TABLE(gtype,name)			\
+extern const struct gtype##_id __not_mod_##name##_unused	\
+  __attribute__ ((unused, weak, alias(__stringify(name))))
+

There's already a patch similar to this in Sam's bk-kbuild tree.