mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: ak@suse.de
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] module.h unused or used?
Date: Thu, 11 Mar 2004 10:37:22 +1100	[thread overview]
Message-ID: <1078961842.23891.94.camel@bach> (raw)

Name: EXPORT_SYMBOL declares something used and unused
Author: Rusty Russell
Status: Trival

Someone added __attribute_used__ throughout module.h, but didn't
remove the ", unused".  Looks like some arch/gcc combos still consider
it unused, and discard the fn.

Rant: GCC should have introduced "needed" and "unneeded" attributed,
rather than dick around with the established behaviour of "unused",
which could then be a (deprecated) synonym for "needed".  The user
then gets an unused warning and inserts attribute "needed" or
"unneeded": both suppress the warning, but say explicitly whether it
can be discarded or not.

But now we have "used" meaning it's unused (as the compiler will tell
you), BUT I need it anyway.  And every time I use them I have to check
which is which.  Even better, used defines to unused for backwards
compatibility.  Um, yeah.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .11285-linux-2.6.4-rc3-bk1/include/linux/module.h .11285-linux-2.6.4-rc3-bk1.updated/include/linux/module.h
--- .11285-linux-2.6.4-rc3-bk1/include/linux/module.h	2004-03-10 12:12:05.000000000 +1100
+++ .11285-linux-2.6.4-rc3-bk1.updated/include/linux/module.h	2004-03-11 10:32:50.000000000 +1100
@@ -64,11 +64,12 @@ void sort_main_extable(void);
 #define __MODULE_INFO(tag, name, info)					  \
 static const char __module_cat(name,__LINE__)[]				  \
   __attribute_used__							  \
-  __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
+  __attribute__((section(".modinfo"))) = __stringify(tag) "=" info
 
 #define MODULE_GENERIC_TABLE(gtype,name)			\
 extern const struct gtype##_id __mod_##gtype##_table		\
-  __attribute__ ((unused, alias(__stringify(name))))
+  __attribute_used__						\
+  __attribute__ ((alias(__stringify(name))))
 
 #define THIS_MODULE (&__this_module)
 
@@ -165,7 +166,7 @@ void *__symbol_get_gpl(const char *symbo
 	extern void *__crc_##sym __attribute__((weak));		\
 	static const unsigned long __kcrctab_##sym		\
 	__attribute_used__					\
-	__attribute__((section("__kcrctab" sec), unused))	\
+	__attribute__((section("__kcrctab" sec)))		\
 	= (unsigned long) &__crc_##sym;
 #else
 #define __CRC_SYMBOL(sym, sec)
@@ -179,7 +180,7 @@ void *__symbol_get_gpl(const char *symbo
 	= MODULE_SYMBOL_PREFIX #sym;                    	\
 	static const struct kernel_symbol __ksymtab_##sym	\
 	__attribute_used__					\
-	__attribute__((section("__ksymtab" sec), unused))	\
+	__attribute__((section("__ksymtab" sec)))		\
 	= { (unsigned long)&sym, __kstrtab_##sym }
 
 #define EXPORT_SYMBOL(sym)					\

-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell


                 reply	other threads:[~2004-03-10 23:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1078961842.23891.94.camel@bach \
    --to=rusty@rustcorp.com.au \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®