Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Feb 2002 18:36:50 +0000
From:      Mark Murray <mark@grondar.za>
To:        arch@freebsd.org
Subject:   Warning and lint(1) fixes. Review please.
Message-ID:  <200202281836.g1SIaog4051908@grimreaper.grondar.org>

next in thread | raw e-mail | index | archive | help
Hi

Please review the enclosed fixes. I've been running most of them
for more than a month, and they are heavily useful in fixing up
lint moanings.

(There are a smattering of __P() removals in there - they will be
a separate commit).

M
-- 
o       Mark Murray
\_
O.\_    Warning: this .sig is umop ap!sdn
Index: i386/include/atomic.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/atomic.h,v
retrieving revision 1.26
diff -u -d -r1.26 atomic.h
--- i386/include/atomic.h	28 Feb 2002 06:17:05 -0000	1.26
+++ i386/include/atomic.h	28 Feb 2002 09:43:25 -0000
@@ -89,6 +89,7 @@
  * The assembly is volatilized to demark potential before-and-after side
  * effects if an interrupt or SMP collision were to occur.
  */
+#ifdef __GNUC__
 #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V)		\
 static __inline void					\
 atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
@@ -97,6 +98,9 @@
 			 : "+m" (*p)			\
 			 : CONS (V));			\
 }
+#else
+#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V)
+#endif
 
 /*
  * Atomic compare and set, used by the mutex functions
@@ -112,6 +116,7 @@
 {
 	int res = exp;
 
+#ifdef __GNUC__
 	__asm __volatile(
 	"	pushfl ;		"
 	"	cli ;			"
@@ -127,6 +132,7 @@
 	: "r" (src),			/* 1 */
 	  "m" (*(dst))			/* 2 */
 	: "memory");
+#endif
 
 	return (res);
 }
@@ -136,6 +142,7 @@
 {
 	int res = exp;
 
+#ifdef __GNUC__
 	__asm __volatile (
 	"	" __XSTRING(MPLOCKED) "	"
 	"	cmpxchgl %1,%2 ;	"
@@ -147,6 +154,7 @@
 	: "r" (src),			/* 1 */
 	  "m" (*(dst))			/* 2 */
 	: "memory");				 
+#endif
 
 	return (res);
 }
@@ -375,12 +383,14 @@
 {
 	u_int result;
 
+#ifdef __GNUC__
 	__asm __volatile (
 	"	xorl	%0,%0 ;		"
 	"	xchgl	%1,%0 ;		"
 	"# atomic_readandclear_int"
 	: "=&r" (result)		/* 0 (result) */
 	: "m" (*addr));			/* 1 (addr) */
+#endif
 
 	return (result);
 }
@@ -390,12 +400,14 @@
 {
 	u_long result;
 
+#ifdef __GNUC__
 	__asm __volatile (
 	"	xorl	%0,%0 ;		"
 	"	xchgl	%1,%0 ;		"
 	"# atomic_readandclear_int"
 	: "=&r" (result)		/* 0 (result) */
 	: "m" (*addr));			/* 1 (addr) */
+#endif
 
 	return (result);
 }
Index: i386/include/bus_at386.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/bus_at386.h,v
retrieving revision 1.18
diff -u -d -r1.18 bus_at386.h
--- i386/include/bus_at386.h	18 Feb 2002 13:43:19 -0000	1.18
+++ i386/include/bus_at386.h	24 Feb 2002 21:28:54 -0000
@@ -274,6 +274,7 @@
 	else
 #endif
 	{
+#ifdef __GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	movb (%2),%%al				\n\
@@ -282,6 +283,7 @@
 		    "=D" (addr), "=c" (count)			:
 		    "r" (bsh + offset), "0" (addr), "1" (count)	:
 		    "%eax", "memory");
+#endif
 	}
 #endif
 }
@@ -301,6 +303,7 @@
 	else
 #endif
 	{
+#ifdef __GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	movw (%2),%%ax				\n\
@@ -309,6 +312,7 @@
 		    "=D" (addr), "=c" (count)			:
 		    "r" (bsh + offset), "0" (addr), "1" (count)	:
 		    "%eax", "memory");
+#endif
 	}
 #endif
 }
@@ -328,6 +332,7 @@
 	else
 #endif
 	{
+#ifdef __GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	movl (%2),%%eax				\n\
@@ -336,6 +341,7 @@
 		    "=D" (addr), "=c" (count)			:
 		    "r" (bsh + offset), "0" (addr), "1" (count)	:
 		    "%eax", "memory");
+#endif
 	}
 #endif
 }
@@ -374,7 +380,8 @@
 	if (tag == I386_BUS_SPACE_IO)
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef __GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	inb %w2,%%al				\n\
@@ -384,6 +391,7 @@
 		    "=D" (addr), "=c" (count), "=d" (_port_)	:
 		    "0" (addr), "1" (count), "2" (_port_)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -391,7 +399,8 @@
 	else
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef __GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 			repne					\n\
@@ -399,6 +408,7 @@
 		    "=D" (addr), "=c" (count), "=S" (_port_)	:
 		    "0" (addr), "1" (count), "2" (_port_)	:
 		    "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -412,7 +422,8 @@
 	if (tag == I386_BUS_SPACE_IO)
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	inw %w2,%%ax				\n\
@@ -422,6 +433,7 @@
 		    "=D" (addr), "=c" (count), "=d" (_port_)	:
 		    "0" (addr), "1" (count), "2" (_port_)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -429,7 +441,8 @@
 	else
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 			repne					\n\
@@ -437,6 +450,7 @@
 		    "=D" (addr), "=c" (count), "=S" (_port_)	:
 		    "0" (addr), "1" (count), "2" (_port_)	:
 		    "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -450,7 +464,8 @@
 	if (tag == I386_BUS_SPACE_IO)
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	inl %w2,%%eax				\n\
@@ -460,6 +475,7 @@
 		    "=D" (addr), "=c" (count), "=d" (_port_)	:
 		    "0" (addr), "1" (count), "2" (_port_)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -467,7 +483,8 @@
 	else
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 			repne					\n\
@@ -475,6 +492,7 @@
 		    "=D" (addr), "=c" (count), "=S" (_port_)	:
 		    "0" (addr), "1" (count), "2" (_port_)	:
 		    "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -595,6 +613,7 @@
 	else
 #endif
 	{
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	lodsb					\n\
@@ -603,6 +622,7 @@
 		    "=S" (addr), "=c" (count)			:
 		    "r" (bsh + offset), "0" (addr), "1" (count)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -622,6 +642,7 @@
 	else
 #endif
 	{
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	lodsw					\n\
@@ -630,6 +651,7 @@
 		    "=S" (addr), "=c" (count)			:
 		    "r" (bsh + offset), "0" (addr), "1" (count)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -649,6 +671,7 @@
 	else
 #endif
 	{
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	lodsl					\n\
@@ -657,6 +680,7 @@
 		    "=S" (addr), "=c" (count)			:
 		    "r" (bsh + offset), "0" (addr), "1" (count)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -696,7 +720,8 @@
 	if (tag == I386_BUS_SPACE_IO)
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	lodsb					\n\
@@ -706,6 +731,7 @@
 		    "=d" (_port_), "=S" (addr), "=c" (count)	:
 		    "0" (_port_), "1" (addr), "2" (count)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -713,7 +739,8 @@
 	else
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 			repne					\n\
@@ -721,6 +748,7 @@
 		    "=D" (_port_), "=S" (addr), "=c" (count)	:
 		    "0" (_port_), "1" (addr), "2" (count)	:
 		    "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -734,7 +762,8 @@
 	if (tag == I386_BUS_SPACE_IO)
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	lodsw					\n\
@@ -744,6 +773,7 @@
 		    "=d" (_port_), "=S" (addr), "=c" (count)	:
 		    "0" (_port_), "1" (addr), "2" (count)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -751,7 +781,8 @@
 	else
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 			repne					\n\
@@ -759,6 +790,7 @@
 		    "=D" (_port_), "=S" (addr), "=c" (count)	:
 		    "0" (_port_), "1" (addr), "2" (count)	:
 		    "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -772,7 +804,8 @@
 	if (tag == I386_BUS_SPACE_IO)
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 		1:	lodsl					\n\
@@ -782,6 +815,7 @@
 		    "=d" (_port_), "=S" (addr), "=c" (count)	:
 		    "0" (_port_), "1" (addr), "2" (count)	:
 		    "%eax", "memory", "cc");
+#endif
 	}
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -789,7 +823,8 @@
 	else
 #endif
 	{
-		int _port_ = bsh + offset;			\
+		int _port_ = bsh + offset;
+#ifdef	__GNUC__
 		__asm __volatile("				\n\
 			cld					\n\
 			repne					\n\
@@ -797,6 +832,7 @@
 		    "=D" (_port_), "=S" (addr), "=c" (count)	:
 		    "0" (_port_), "1" (addr), "2" (count)	:
 		    "memory", "cc");
+#endif
 	}
 #endif
 }
@@ -1167,10 +1203,12 @@
 bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,
 		  bus_size_t offset, bus_size_t len, int flags)
 {
+#ifdef	__GNUC__
 	if (flags & BUS_SPACE_BARRIER_READ)
 		__asm __volatile("lock; addl $0,0(%%esp)" : : : "memory");
 	else
 		__asm __volatile("" : : : "memory");
+#endif
 }
 
 #endif /* _I386_BUS_AT386_H_ */
Index: i386/include/pcpu.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/pcpu.h,v
retrieving revision 1.32
diff -u -d -r1.32 pcpu.h
--- i386/include/pcpu.h	11 Dec 2001 23:33:40 -0000	1.32
+++ i386/include/pcpu.h	28 Feb 2002 10:44:43 -0000
@@ -32,8 +32,22 @@
 #ifdef _KERNEL
 
 #ifndef	__GNUC__
-#error	gcc is required to use this file
-#endif
+
+#ifndef	lint
+#error	gcc or lint is required to use this file
+#else /* lint */
+#define	__PCPU_PTR(name)
+#define	__PCPU_GET(name)
+#define	__PCPU_SET(name, val)
+#define	PCPU_GET(member)	__PCPU_GET(pc_ ## member)
+#define	PCPU_PTR(member)	__PCPU_PTR(pc_ ## member)
+#define	PCPU_SET(member, val)	__PCPU_SET(pc_ ## member, val)
+#define	PCPU_MD_FIELDS		\
+	int foo;		\
+	char bar
+#endif /* lint */
+
+#else	/* __GNUC__ */
 
 #include <machine/segments.h>
 #include <machine/tss.h>
@@ -141,6 +155,8 @@
 #define	PCPU_GET(member)	__PCPU_GET(pc_ ## member)
 #define	PCPU_PTR(member)	__PCPU_PTR(pc_ ## member)
 #define	PCPU_SET(member, val)	__PCPU_SET(pc_ ## member, val)
+
+#endif	/* __GNUC__ */
 
 #endif	/* _KERNEL */
 
Index: i386/include/profile.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/profile.h,v
retrieving revision 1.26
diff -u -d -r1.26 profile.h
--- i386/include/profile.h	31 Jan 2002 13:49:55 -0000	1.26
+++ i386/include/profile.h	19 Feb 2002 16:56:31 -0000
@@ -82,28 +82,35 @@
 
 #define	_MCOUNT_DECL static __inline void _mcount
 
-#define	MCOUNT \
-void \
-mcount() \
-{ \
-	uintfptr_t selfpc, frompc; \
-	/* \
-	 * Find the return address for mcount, \
-	 * and the return address for mcount's caller. \
-	 * \
-	 * selfpc = pc pushed by call to mcount \
-	 */ \
-	asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \
-	/* \
-	 * frompc = pc pushed by call to mcount's caller. \
-	 * The caller's stack frame has already been built, so %ebp is \
-	 * the caller's frame pointer.  The caller's raddr is in the \
-	 * caller's frame following the caller's caller's frame pointer. \
-	 */ \
-	asm("movl (%%ebp),%0" : "=r" (frompc)); \
-	frompc = ((uintfptr_t *)frompc)[1]; \
-	_mcount(frompc, selfpc); \
+#ifdef	__GNUC__
+#define	MCOUNT								\
+void									\
+mcount()								\
+{									\
+	uintfptr_t selfpc, frompc;					\
+	/*								\
+	 * Find the return address for mcount,				\
+	 * and the return address for mcount's caller.			\
+	 *								\
+	 * selfpc = pc pushed by call to mcount				\
+	 */								\
+	asm("movl 4(%%ebp),%0" : "=r" (selfpc));			\
+	/*								\
+	 * frompc = pc pushed by call to mcount's caller.		\
+	 * The caller's stack frame has already been built, so %ebp is	\
+	 * the caller's frame pointer.  The caller's raddr is in the	\
+	 * caller's frame following the caller's caller's frame pointer.\
+	 */								\
+	asm("movl (%%ebp),%0" : "=r" (frompc));				\
+	frompc = ((uintfptr_t *)frompc)[1];				\
+	_mcount(frompc, selfpc);					\
+}
+#else	/* __GNUC__ */
+void			\
+mcount()		\
+{			\
 }
+#endif	/* __GNUC__ */
 
 typedef	unsigned int	uintfptr_t;
 
@@ -117,16 +124,16 @@
 
 #ifdef _KERNEL
 
-void	mcount __P((uintfptr_t frompc, uintfptr_t selfpc));
-void	kmupetext __P((uintfptr_t nhighpc));
+void	mcount(uintfptr_t frompc, uintfptr_t selfpc);
+void	kmupetext(uintfptr_t nhighpc);
 
 #ifdef GUPROF
 struct gmonparam;
 
-void	nullfunc_loop_profiled __P((void));
-void	nullfunc_profiled __P((void));
-void	startguprof __P((struct gmonparam *p));
-void	stopguprof __P((struct gmonparam *p));
+void	nullfunc_loop_profiled(void);
+void	nullfunc_profiled(void);
+void	startguprof(struct gmonparam *p);
+void	stopguprof(struct gmonparam *p);
 #else
 #define	startguprof(p)
 #define	stopguprof(p)
@@ -139,12 +146,12 @@
 __BEGIN_DECLS
 #ifdef __GNUC__
 #ifdef __ELF__
-void	mcount __P((void)) __asm(".mcount");
+void	mcount(void) __asm(".mcount");
 #else
-void	mcount __P((void)) __asm("mcount");
+void	mcount(void) __asm("mcount");
 #endif
 #endif
-static void	_mcount __P((uintfptr_t frompc, uintfptr_t selfpc));
+static void	_mcount(uintfptr_t frompc, uintfptr_t selfpc);
 __END_DECLS
 
 #endif /* _KERNEL */
@@ -154,11 +161,11 @@
 extern int	cputime_bias;
 
 __BEGIN_DECLS
-int	cputime __P((void));
-void	empty_loop __P((void));
-void	mexitcount __P((uintfptr_t selfpc));
-void	nullfunc __P((void));
-void	nullfunc_loop __P((void));
+int	cputime(void);
+void	empty_loop(void);
+void	mexitcount(uintfptr_t selfpc);
+void	nullfunc(void);
+void	nullfunc_loop(void);
 __END_DECLS
 #endif
 
Index: sys/cdefs.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/cdefs.h,v
retrieving revision 1.49
diff -u -d -r1.49 cdefs.h
--- sys/cdefs.h	4 Dec 2001 01:29:54 -0000	1.49
+++ sys/cdefs.h	19 Feb 2002 15:32:10 -0000
@@ -112,6 +112,7 @@
  * properly (old versions of gcc-2 supported the dead and pure features
  * in a different (wrong) way).
  */
+#ifdef __GNUC__
 #if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
 #define	__dead2
 #define	__pure2
@@ -176,7 +177,6 @@
 #define	__printf0like(fmtarg, firstvararg)
 #endif
 
-#ifdef __GNUC__
 #define	__strong_reference(sym,aliassym)	\
 	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
 #ifdef __ELF__
@@ -244,7 +244,7 @@
 #if !defined(lint) && !defined(STRIP_FBSDID)
 #define	__FBSDID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
 #else
-#define	__FBSDID(s)	struct __hack
+#define	__FBSDID(s)
 #endif
 #endif
 
Index: sys/eventhandler.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/eventhandler.h,v
retrieving revision 1.17
diff -u -d -r1.17 eventhandler.h
--- sys/eventhandler.h	12 Sep 2001 08:38:05 -0000	1.17
+++ sys/eventhandler.h	19 Feb 2002 22:17:52 -0000
@@ -75,31 +75,33 @@
     struct eventhandler_entry	ee;				\
     type		eh_func;				\
 };								\
-struct __hack
+struct __hack_ ## name
 
 #define EVENTHANDLER_FAST_DEFINE(name, type)				\
 struct eventhandler_list Xeventhandler_list_ ## name = { #name };	\
-struct __hack
+struct __hack_ ## name
 
-#define EVENTHANDLER_FAST_INVOKE(name, args...)					\
-do {										\
-    struct eventhandler_list *_el = &Xeventhandler_list_ ## name ;		\
-    struct eventhandler_entry *_ep, *_en;					\
-										\
-    if (_el->el_flags & EHE_INITTED) {						\
-	lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread);			\
-	_ep = TAILQ_FIRST(&(_el->el_entries));					\
-	while (_ep != NULL) {							\
-	    _en = TAILQ_NEXT(_ep, ee_link);					\
-	    ((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , 	\
-								 ## args); 	\
-	    _ep = _en;								\
-	}									\
-	lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread);			\
-    }										\
+#define EVENTHANDLER_FAST_INVOKE(name, args...)				\
+do {									\
+    struct eventhandler_list *_el = &Xeventhandler_list_ ## name ;	\
+    struct eventhandler_entry *_ep, *_en;				\
+									\
+    if (_el->el_flags & EHE_INITTED) {					\
+	lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread);		\
+	_ep = TAILQ_FIRST(&(_el->el_entries));				\
+	while (_ep != NULL) {						\
+	    _en = TAILQ_NEXT(_ep, ee_link);				\
+	    ((struct eventhandler_entry_ ## name *)_ep)->eh_func(	\
+		_ep->ee_arg ,						\
+		## args							\
+	    );								\
+	    _ep = _en;							\
+	}								\
+	lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread);		\
+    }									\
 } while (0)
 
-#define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority) \
+#define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority)	\
     eventhandler_register(&Xeventhandler_list_ ## name, #name, func, arg, priority)
 
 #define EVENTHANDLER_FAST_DEREGISTER(name, tag) \
@@ -118,25 +120,27 @@
     struct eventhandler_entry	ee;		\
     type		eh_func;		\
 };						\
-struct __hack
+struct __hack_ ## name
 
-#define EVENTHANDLER_INVOKE(name, args...)					\
-do {										\
-    struct eventhandler_list *_el;						\
-    struct eventhandler_entry *_ep, *_en;					\
-										\
-    if (((_el = eventhandler_find_list(#name)) != NULL) && 			\
-	(_el->el_flags & EHE_INITTED)) {					\
-	lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread);			\
-	_ep = TAILQ_FIRST(&(_el->el_entries));					\
-	while (_ep != NULL) {							\
-	    _en = TAILQ_NEXT(_ep, ee_link);					\
-	    ((struct eventhandler_entry_ ## name *)_ep)->eh_func(_ep->ee_arg , 	\
-								 ## args); 	\
-	    _ep = _en;								\
-	}									\
-	lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread);			\
-    }										\
+#define EVENTHANDLER_INVOKE(name, args...)				\
+do {									\
+    struct eventhandler_list *_el;					\
+    struct eventhandler_entry *_ep, *_en;				\
+									\
+    if (((_el = eventhandler_find_list(#name)) != NULL) && 		\
+	(_el->el_flags & EHE_INITTED)) {				\
+	lockmgr(&_el->el_lock, LK_EXCLUSIVE, NULL, curthread);		\
+	_ep = TAILQ_FIRST(&(_el->el_entries));				\
+	while (_ep != NULL) {						\
+	    _en = TAILQ_NEXT(_ep, ee_link);				\
+	    ((struct eventhandler_entry_ ## name *)_ep)->eh_func(	\
+		_ep->ee_arg ,						\
+		## args							\
+	    );								\
+	    _ep = _en;							\
+	}								\
+	lockmgr(&_el->el_lock, LK_RELEASE, NULL, curthread);		\
+    }									\
 } while (0)
 
 #define EVENTHANDLER_REGISTER(name, func, arg, priority) \
@@ -165,7 +169,7 @@
  */
 
 /* Shutdown events */
-typedef void (*shutdown_fn) __P((void *, int));
+typedef void (*shutdown_fn)(void *, int);
 
 #define	SHUTDOWN_PRI_FIRST	0
 #define	SHUTDOWN_PRI_DEFAULT	10000
@@ -176,7 +180,7 @@
 EVENTHANDLER_DECLARE(shutdown_final, shutdown_fn);
 
 /* Idle process event */
-typedef void (*idle_eventhandler_t) __P((void *, int));
+typedef void (*idle_eventhandler_t)(void *, int);
 
 #define IDLE_PRI_FIRST		10000
 #define IDLE_PRI_LAST		20000
Index: sys/linker_set.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/linker_set.h,v
retrieving revision 1.9
diff -u -d -r1.9 linker_set.h
--- sys/linker_set.h	13 Jun 2001 10:58:39 -0000	1.9
+++ sys/linker_set.h	24 Feb 2002 21:50:30 -0000
@@ -42,6 +42,7 @@
  * Private macros, not to be used outside this header file.
  */
 /* this bit of h0h0magic brought to you by cpp */
+#ifdef __GNUC__
 #define	__GLOBL(sym)	__GLOBL2(sym)
 #define	__GLOBL2(sym)	__asm(".globl " #sym)
 
@@ -50,6 +51,11 @@
 	__GLOBL(__CONCAT(__stop_set_,set));				\
 	static void const * const __set_##set##_sym_##sym 		\
 	__attribute__((__section__("set_" #set),__unused__)) = &sym
+#else /* !__GNUC__ */
+#define	__GLOBL(sym)
+#define	__GLOBL2(sym)
+#define __MAKE_SET(set, sym)
+#endif /* __GNUC__ */
 
 /*
  * Public macros.
Index: sys/lock.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/lock.h,v
retrieving revision 1.42
diff -u -d -r1.42 lock.h
--- sys/lock.h	5 Jan 2002 08:47:13 -0000	1.42
+++ sys/lock.h	24 Feb 2002 21:41:04 -0000
@@ -245,8 +245,8 @@
 	witness_restore((lock), __CONCAT(n, __wf), __CONCAT(n, __wl))
 
 #else	/* WITNESS */
-#define	WITNESS_INIT(lock)	(lock)->lo_flags |= LO_INITIALIZED
-#define	WITNESS_DESTROY(lock)	(lock)->lo_flags &= ~LO_INITIALIZED
+#define	WITNESS_INIT(lock)	((lock)->lo_flags |= LO_INITIALIZED)
+#define	WITNESS_DESTROY(lock)	((lock)->lo_flags &= ~LO_INITIALIZED)
 #define	WITNESS_LOCK(lock, flags, file, line)
 #define	WITNESS_UPGRADE(lock, flags, file, line)
 #define	WITNESS_DOWNGRADE(lock, flags, file, line)
Index: sys/malloc.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/malloc.h,v
retrieving revision 1.54
diff -u -d -r1.54 malloc.h
--- sys/malloc.h	10 Aug 2001 06:37:04 -0000	1.54
+++ sys/malloc.h	28 Feb 2002 10:24:13 -0000
@@ -153,7 +153,7 @@
  * Deprecated macro versions of not-quite-malloc() and free().
  */
 #define	MALLOC(space, cast, size, type, flags) \
-	(space) = (cast)malloc((u_long)(size), (type), (flags))
+	((space) = (cast)malloc((u_long)(size), (type), (flags)))
 #define	FREE(addr, type) free((addr), (type))
 
 /*
Index: sys/random.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/random.h,v
retrieving revision 1.30
diff -u -d -r1.30 random.h
--- sys/random.h	18 Feb 2001 17:40:47 -0000	1.30
+++ sys/random.h	24 Feb 2002 22:45:18 -0000
@@ -33,8 +33,15 @@
 
 u_int read_random(void *, u_int);
 
-enum esource { RANDOM_WRITE, RANDOM_KEYBOARD, RANDOM_MOUSE, RANDOM_NET,
-		RANDOM_INTERRUPT, ENTROPYSOURCE };
+enum esource {
+	RANDOM_START = 0,
+	RANDOM_WRITE = 0,
+	RANDOM_KEYBOARD,
+	RANDOM_MOUSE,
+	RANDOM_NET,
+	RANDOM_INTERRUPT,
+	ENTROPYSOURCE
+};
 void random_harvest(void *, u_int, u_int, u_int, enum esource);
 
 /* Allow the sysadmin to select the broad category of

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202281836.g1SIaog4051908>