public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] eliminate warnings in generated module files
@ 2003-02-19  2:43 Richard Henderson
  2003-02-19  3:29 ` Linus Torvalds
  2003-02-25  4:32 ` Rusty Russell
  0 siblings, 2 replies; 23+ messages in thread
From: Richard Henderson @ 2003-02-19  2:43 UTC (permalink / raw)
  To: torvalds, rusty; +Cc: linux-kernel

The compiler.h fragment should describe the problem well enough.



r~



===== include/linux/compiler.h 1.10 vs edited =====
--- 1.10/include/linux/compiler.h	Tue Dec 31 15:10:18 2002
+++ edited/include/linux/compiler.h	Tue Feb 18 17:39:38 2003
@@ -25,6 +25,23 @@
 #define __deprecated
 #endif
 
+/*
+ * Allow us to avoid 'defined but not used' warnings on functions and data,
+ * as well as force them to be emitted to the assembly file.
+ *
+ * As of gcc 3.3, static functions that are not marked with attribute((used))
+ * may be elided from the assembly file.  As of gcc 3.3, static data not so
+ * marked will not be elided, but this may change in a future gcc version.
+ *
+ * In prior versions of gcc, such functions and data would be emitted, but
+ * would be warned about except with attribute((unused)).
+ */
+#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3
+#define __attribute_used__	__attribute__((__used__))
+#else
+#define __attribute_used__	__attribute__((__unused__))
+#endif
+
 /* This macro obfuscates arithmetic on a variable address so that gcc
    shouldn't recognize the original var, and make assumptions about it */
 #define RELOC_HIDE(ptr, off)					\
===== scripts/modpost.c 1.7 vs edited =====
--- 1.7/scripts/modpost.c	Sun Feb 16 17:42:07 2003
+++ edited/scripts/modpost.c	Tue Feb 18 17:41:54 2003
@@ -384,6 +384,7 @@
 {
 	buf_printf(b, "#include <linux/module.h>\n");
 	buf_printf(b, "#include <linux/vermagic.h>\n");
+	buf_printf(b, "#include <linux/compiler.h>\n");
 	buf_printf(b, "\n");
 	buf_printf(b, "const char vermagic[]\n");
 	buf_printf(b, "__attribute__((section(\"__vermagic\"))) =\n");
@@ -449,6 +450,7 @@
 
 	buf_printf(b, "\n");
 	buf_printf(b, "static const char __module_depends[]\n");
+	buf_printf(b, "__attribute_used__\n");
 	buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
 	buf_printf(b, "\"depends=");
 	for (s = mod->unres; s; s = s->next) {

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] eliminate warnings in generated module files
@ 2003-02-26  2:23 Milton D. Miller II
  0 siblings, 0 replies; 23+ messages in thread
From: Milton D. Miller II @ 2003-02-26  2:23 UTC (permalink / raw)
  To: linux-kernel


On Tue, 25 Feb 2003, Rusty Russell wrote:
>
> __optional should always be __attribute__((__unused__)), and
> __required should be your __attribute_used__. 

How about __keep or __needed  ?

milton

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2003-02-26 16:54 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-19  2:43 [PATCH] eliminate warnings in generated module files Richard Henderson
2003-02-19  3:29 ` Linus Torvalds
2003-02-19  3:43   ` Richard Henderson
2003-02-19  5:16     ` Linus Torvalds
2003-02-19  6:16       ` Richard Henderson
2003-02-19 20:11         ` Kai Germaschewski
2003-02-19 21:05           ` Richard Henderson
2003-02-20  0:01         ` Rusty Russell
2003-02-19 23:41       ` Chris Wedgwood
2003-02-25  4:32 ` Rusty Russell
2003-02-25  7:58   ` Richard Henderson
2003-02-25 11:39     ` Rusty Russell
2003-02-25 23:47       ` Linus Torvalds
2003-02-26  1:22         ` Rusty Russell
2003-02-26  1:36           ` Kai Germaschewski
2003-02-26  4:13             ` Rusty Russell
2003-02-26 17:02               ` Horst von Brand
2003-02-26 17:04               ` Richard Henderson
2003-02-26  3:35           ` Randy.Dunlap
2003-02-26  4:08             ` Rusty Russell
2003-02-26 13:45               ` Werner Almesberger
2003-02-25 21:42     ` Chris Wedgwood
  -- strict thread matches above, loose matches on Subject: below --
2003-02-26  2:23 Milton D. Miller II

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox