Subject: lint vs. link sets
To: None <tech-toolchain@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: tech-toolchain
Date: 01/21/2006 03:11:55
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Lint is unimpressed with our current version of link set macros that
we supply for lint.  It still complains e.g:

    warning: static function sysctl_machdep_setup unused [236]

Does attached patch look correct?

Kernel is still too messy for lint to swallow, so I'm not sure about
the final effect.  Second pass might complain that the variable is not
used "globally" by any other file.  But with the current definion it
complains on the first pass already.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen

--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cdefs_elf.h-lint.diff"

Index: cdefs_elf.h
===================================================================
RCS file: /cvsroot/src/sys/sys/cdefs_elf.h,v
retrieving revision 1.26
diff -u --unified -r1.26 cdefs_elf.h
--- cdefs_elf.h	24 Dec 2005 23:29:06 -0000	1.26
+++ cdefs_elf.h	21 Jan 2006 00:04:49 -0000
@@ -125,9 +125,9 @@
 	    __section("link_set_" #set) __used = &sym[n]
 #else
 #define	__link_set_make_entry(set, sym)					\
-	extern void const * const __link_set_##set##_sym_##sym
+	void const * const __link_set_##set##_sym_##sym = &sym
 #define	__link_set_make_entry2(set, sym, n)				\
-	extern void const * const __link_set_##set##_sym_##sym##_##n
+	void const * const __link_set_##set##_sym_##sym##_##n = &sym[n]
 #endif /* __lint__ */
 
 #define	__link_set_add_text(set, sym)	__link_set_make_entry(set, sym)

--tThc/1wpZn/ma/RB--