Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Apr 2002 21:54:27 +0100
From:      Mark Murray <mark@grondar.za>
To:        audit@freebsd.org
Subject:   Some kernel lint(1) cleanups.
Message-ID:  <200204142054.g3EKsR0N001233@grimreaper.grondar.org>

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

I've put these up for review before, but I have no recollection
how far I got, so here they go in the form that I am currently
running them.

Reviews/comments/cash please :-)

M

Index: crypto/rijndael/rijndael-api-fst.h
===================================================================
RCS file: /home/ncvs/src/sys/crypto/rijndael/rijndael-api-fst.h,v
retrieving revision 1.2
diff -u -d -r1.2 rijndael-api-fst.h
--- crypto/rijndael/rijndael-api-fst.h	11 Jun 2001 12:38:55 -0000	1.2
+++ crypto/rijndael/rijndael-api-fst.h	16 Feb 2002 00:42:29 -0000
@@ -23,8 +23,6 @@
 #define     MODE_ECB              1 /*  Are we ciphering in ECB mode?   */
 #define     MODE_CBC              2 /*  Are we ciphering in CBC mode?   */
 #define     MODE_CFB1             3 /*  Are we ciphering in 1-bit CFB mode? */
-#define     TRUE                  1
-#define     FALSE                 0
 #define     BITSPERBLOCK        128 /* Default number of bits in a cipher block */
 
 /*  Error Codes - CHANGE POSSIBLE: inclusion of additional error codes  */
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	6 Mar 2002 11:55:00 -0000
@@ -64,13 +64,13 @@
  * This allows kernel modules to be portable between UP and SMP systems.
  */
 #if defined(KLD_MODULE)
-#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V)			\
-void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
+#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V)				\
+void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
 
 int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src);
 
-#define	ATOMIC_STORE_LOAD(TYPE, LOP, SOP)			\
-u_##TYPE	atomic_load_acq_##TYPE(volatile u_##TYPE *p);	\
+#define	ATOMIC_STORE_LOAD(TYPE, LOP, SOP)				\
+u_##TYPE	atomic_load_acq_##TYPE(volatile u_##TYPE *p);		\
 void		atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
 
 #else /* !KLD_MODULE */
@@ -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,13 @@
 			 : "+m" (*p)			\
 			 : CONS (V));			\
 }
+#else /* !__GNUC__ */
+#ifndef lint
+#error "This file must be compiled with GCC or lint"
+#endif /* lint */
+#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V)		\
+void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
+#endif /* __GNUC__ */
 
 /*
  * Atomic compare and set, used by the mutex functions
@@ -106,6 +114,7 @@
  * Returns 0 on failure, non-zero on success
  */
 
+#if defined(__GNUC__)
 #if defined(I386_CPU)
 static __inline int
 atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
@@ -151,7 +160,15 @@
 	return (res);
 }
 #endif /* defined(I386_CPU) */
+#else /* !defined(__GNUC__) */
+static __inline int
+atomic_cmpset_int(volatile u_int *dst __unused, u_int exp __unused,
+    u_int src __unused)
+{
+}
+#endif /* defined(__GNUC__) */
 
+#if defined(__GNUC__)
 #if defined(I386_CPU)
 /*
  * We assume that a = b will do atomic loads and stores.
@@ -172,7 +189,7 @@
 	*p = v;						\
 	__asm __volatile("" : : : "memory");		\
 }
-#else
+#else /* !defined(I386_CPU) */
 
 #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP)		\
 static __inline u_##TYPE				\
@@ -200,32 +217,43 @@
 	: : "memory");				 	\
 }
 #endif	/* defined(I386_CPU) */
+#else /* !defined(__GNUC__) */
+
+/*
+ * XXXX: Dummy functions!!
+ */
+#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP)			\
+u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p __unused);	\
+void atomic_store_rel_##TYPE(volatile u_##TYPE *p __unused,	\
+    u_##TYPE v __unused)
+
+#endif /* defined(__GNUC__) */
 #endif /* KLD_MODULE */
 
-ATOMIC_ASM(set,	     char,  "orb %b1,%0",  "iq",  v)
-ATOMIC_ASM(clear,    char,  "andb %b1,%0", "iq", ~v)
-ATOMIC_ASM(add,	     char,  "addb %b1,%0", "iq",  v)
-ATOMIC_ASM(subtract, char,  "subb %b1,%0", "iq",  v)
+ATOMIC_ASM(set,	     char,  "orb %b1,%0",  "iq",  v);
+ATOMIC_ASM(clear,    char,  "andb %b1,%0", "iq", ~v);
+ATOMIC_ASM(add,	     char,  "addb %b1,%0", "iq",  v);
+ATOMIC_ASM(subtract, char,  "subb %b1,%0", "iq",  v);
 
-ATOMIC_ASM(set,	     short, "orw %w1,%0",  "ir",  v)
-ATOMIC_ASM(clear,    short, "andw %w1,%0", "ir", ~v)
-ATOMIC_ASM(add,	     short, "addw %w1,%0", "ir",  v)
-ATOMIC_ASM(subtract, short, "subw %w1,%0", "ir",  v)
+ATOMIC_ASM(set,	     short, "orw %w1,%0",  "ir",  v);
+ATOMIC_ASM(clear,    short, "andw %w1,%0", "ir", ~v);
+ATOMIC_ASM(add,	     short, "addw %w1,%0", "ir",  v);
+ATOMIC_ASM(subtract, short, "subw %w1,%0", "ir",  v);
 
-ATOMIC_ASM(set,	     int,   "orl %1,%0",   "ir",  v)
-ATOMIC_ASM(clear,    int,   "andl %1,%0",  "ir", ~v)
-ATOMIC_ASM(add,	     int,   "addl %1,%0",  "ir",  v)
-ATOMIC_ASM(subtract, int,   "subl %1,%0",  "ir",  v)
+ATOMIC_ASM(set,	     int,   "orl %1,%0",   "ir",  v);
+ATOMIC_ASM(clear,    int,   "andl %1,%0",  "ir", ~v);
+ATOMIC_ASM(add,	     int,   "addl %1,%0",  "ir",  v);
+ATOMIC_ASM(subtract, int,   "subl %1,%0",  "ir",  v);
 
-ATOMIC_ASM(set,	     long,  "orl %1,%0",   "ir",  v)
-ATOMIC_ASM(clear,    long,  "andl %1,%0",  "ir", ~v)
-ATOMIC_ASM(add,	     long,  "addl %1,%0",  "ir",  v)
-ATOMIC_ASM(subtract, long,  "subl %1,%0",  "ir",  v)
+ATOMIC_ASM(set,	     long,  "orl %1,%0",   "ir",  v);
+ATOMIC_ASM(clear,    long,  "andl %1,%0",  "ir", ~v);
+ATOMIC_ASM(add,	     long,  "addl %1,%0",  "ir",  v);
+ATOMIC_ASM(subtract, long,  "subl %1,%0",  "ir",  v);
 
-ATOMIC_STORE_LOAD(char,	"cmpxchgb %b0,%1", "xchgb %b1,%0")
-ATOMIC_STORE_LOAD(short,"cmpxchgw %w0,%1", "xchgw %w1,%0")
-ATOMIC_STORE_LOAD(int,	"cmpxchgl %0,%1",  "xchgl %1,%0")
-ATOMIC_STORE_LOAD(long,	"cmpxchgl %0,%1",  "xchgl %1,%0")
+ATOMIC_STORE_LOAD(char,	"cmpxchgb %b0,%1", "xchgb %b1,%0");
+ATOMIC_STORE_LOAD(short,"cmpxchgw %w0,%1", "xchgw %w1,%0");
+ATOMIC_STORE_LOAD(int,	"cmpxchgl %0,%1",  "xchgl %1,%0");
+ATOMIC_STORE_LOAD(long,	"cmpxchgl %0,%1",  "xchgl %1,%0");
 
 #undef ATOMIC_ASM
 #undef ATOMIC_STORE_LOAD
@@ -370,6 +398,7 @@
 
 #undef ATOMIC_PTR
 
+#if defined(__GNUC__)
 static __inline u_int
 atomic_readandclear_int(volatile u_int *addr)
 {
@@ -384,7 +413,17 @@
 
 	return (result);
 }
+#else /* !defined(__GNUC__) */
+/*
+ * XXXX: Dummy!
+ */
+static __inline u_int
+atomic_readandclear_int(volatile u_int *addr __unused)
+{
+}
+#endif /* defined(__GNUC__) */
 
+#if defined(__GNUC__)
 static __inline u_long
 atomic_readandclear_long(volatile u_long *addr)
 {
@@ -399,5 +438,14 @@
 
 	return (result);
 }
+#else /* !defined(__GNUC__) */
+/*
+ * XXXX: Dummy!
+ */
+static __inline u_long
+atomic_readandclear_long(volatile u_long *addr __unused)
+{
+}
+#endif /* defined(__GNUC__) */
 #endif	/* !defined(WANT_FUNCTIONS) */
 #endif /* ! _MACHINE_ATOMIC_H_ */
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.33
diff -u -d -r1.33 pcpu.h
--- i386/include/pcpu.h	27 Mar 2002 05:39:19 -0000	1.33
+++ i386/include/pcpu.h	27 Mar 2002 21:04:41 -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>
@@ -145,6 +159,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.27
diff -u -d -r1.27 profile.h
--- i386/include/profile.h	20 Mar 2002 05:48:58 -0000	1.27
+++ i386/include/profile.h	20 Mar 2002 12:24:21 -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;
 
Index: kern/bus_if.m
===================================================================
RCS file: /home/ncvs/src/sys/kern/bus_if.m,v
retrieving revision 1.20
diff -u -d -r1.20 bus_if.m
--- kern/bus_if.m	27 Mar 2002 04:04:17 -0000	1.20
+++ kern/bus_if.m	27 Mar 2002 21:24:18 -0000
@@ -82,20 +82,20 @@
 # Read an instance variable.  Return 0 on success.
 #
 METHOD int read_ivar {
-	device_t dev;
-	device_t child;
-	int indx;
-	uintptr_t *result;
+	device_t _dev;
+	device_t _child;
+	int _indx;
+	uintptr_t *_result;
 };
 
 #
 # Write an instance variable.  Return 0 on success.
 #
 METHOD int write_ivar {
-	device_t dev;
-	device_t child;
-	int indx;
-	uintptr_t value;
+	device_t _dev;
+	device_t _child;
+	int _indx;
+	uintptr_t _value;
 };
 
 #
@@ -103,8 +103,8 @@
 # to reclaim any resources allocated on behalf of the child.
 #
 METHOD void child_detached {
-	device_t dev;
-	device_t child;
+	device_t _dev;
+	device_t _child;
 };
 
 #
@@ -113,8 +113,8 @@
 # attach any un-matched children of the bus.
 #
 METHOD void driver_added {
-	device_t dev;
-	driver_t *driver;
+	device_t _dev;
+	driver_t *_driver;
 } DEFAULT bus_generic_driver_added;
 
 #
@@ -124,10 +124,10 @@
 # added after the last existing child with the same order.
 #
 METHOD device_t add_child {
-	device_t dev;
-	int order;
-	const char *name;
-	int unit;
+	device_t _dev;
+	int _order;
+	const char *_name;
+	int _unit;
 };
 
 #
@@ -145,30 +145,30 @@
 # uses the resource.
 #
 METHOD struct resource * alloc_resource {
-	device_t	dev;
-	device_t	child;
-	int		type;
-	int	       *rid;
-	u_long		start;
-	u_long		end;
-	u_long		count;
-	u_int		flags;
+	device_t	_dev;
+	device_t	_child;
+	int		_type;
+	int	       *_rid;
+	u_long		_start;
+	u_long		_end;
+	u_long		_count;
+	u_int		_flags;
 } DEFAULT null_alloc_resource;
 
 METHOD int activate_resource {
-	device_t	dev;
-	device_t	child;
-	int		type;
-	int		rid;
-	struct resource *r;
+	device_t	_dev;
+	device_t	_child;
+	int		_type;
+	int		_rid;
+	struct resource *_r;
 };
 
 METHOD int deactivate_resource {
-	device_t	dev;
-	device_t	child;
-	int		type;
-	int		rid;
-	struct resource *r;
+	device_t	_dev;
+	device_t	_child;
+	int		_type;
+	int		_rid;
+	struct resource *_r;
 };
 
 #
@@ -177,28 +177,28 @@
 # is not necessarily the same as the one the client passed).
 #
 METHOD int release_resource {
-	device_t	dev;
-	device_t	child;
-	int		type;
-	int		rid;
-	struct resource *res;
+	device_t	_dev;
+	device_t	_child;
+	int		_type;
+	int		_rid;
+	struct resource *_res;
 };
 
 METHOD int setup_intr {
-	device_t	dev;
-	device_t	child;
-	struct resource *irq;
-	int		flags;
-	driver_intr_t	*intr;
-	void		*arg;
-	void		**cookiep;
+	device_t	_dev;
+	device_t	_child;
+	struct resource *_irq;
+	int		_flags;
+	driver_intr_t	*_intr;
+	void		*_arg;
+	void		**_cookiep;
 };
 
 METHOD int teardown_intr {
-	device_t	dev;
-	device_t	child;
-	struct resource	*irq;
-	void		*cookie;
+	device_t	_dev;
+	device_t	_child;
+	struct resource	*_irq;
+	void		*_cookie;
 };
 
 #
@@ -206,12 +206,12 @@
 # the type or rid are out of range.
 #
 METHOD int set_resource {
-	device_t	dev;
-	device_t	child;
-	int		type;
-	int		rid;
-	u_long		start;
-	u_long		count;
+	device_t	_dev;
+	device_t	_child;
+	int		_type;
+	int		_rid;
+	u_long		_start;
+	u_long		_count;
 };
 
 #
@@ -219,28 +219,28 @@
 # out of range or have not been set.
 #
 METHOD int get_resource {
-	device_t	dev;
-	device_t	child;
-	int		type;
-	int		rid;
-	u_long		*startp;
-	u_long		*countp;
+	device_t	_dev;
+	device_t	_child;
+	int		_type;
+	int		_rid;
+	u_long		*_startp;
+	u_long		*_countp;
 };
 
 #
 # Delete a resource.
 #
 METHOD void delete_resource {
-	device_t	dev;
-	device_t	child;
-	int		type;
-	int		rid;
+	device_t	_dev;
+	device_t	_child;
+	int		_type;
+	int		_rid;
 };
 
 #
 # Return a struct resource_list.
 #
 METHOD struct resource_list * get_resource_list {
-	device_t	dev;
-	device_t	child;
+	device_t	_dev;
+	device_t	_child;
 } DEFAULT bus_generic_get_resource_list;
Index: kern/kern_sysctl.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.125
diff -u -d -r1.125 kern_sysctl.c
--- kern/kern_sysctl.c	2 Apr 2002 05:50:07 -0000	1.125
+++ kern/kern_sysctl.c	2 Apr 2002 19:03:11 -0000
@@ -312,7 +312,7 @@
 		sysctl_unregister_oid(oidp);
 		if (del) {
 			if (oidp->descr)
-				free(oidp->descr, M_SYSCTLOID);
+				free((void *)(uintptr_t)(const void *)oidp->descr, M_SYSCTLOID);
 			free((void *)(uintptr_t)(const void *)oidp->oid_name,
 			     M_SYSCTLOID);
 			free(oidp, M_SYSCTLOID);
@@ -377,7 +377,7 @@
 		int len = strlen(descr) + 1;
 		oidp->descr = malloc(len, M_SYSCTLOID, M_WAITOK);
 		if (oidp->descr)
-			strcpy(oidp->descr, descr);
+			strcpy((char *)(uintptr_t)(const void *)oidp->descr, descr);
 	}
 	/* Update the context, if used */
 	if (clist != NULL)
Index: security/lomac/kernel_util.c
===================================================================
RCS file: /home/ncvs/src/sys/security/lomac/kernel_util.c,v
retrieving revision 1.5
diff -u -d -r1.5 kernel_util.c
--- security/lomac/kernel_util.c	1 Apr 2002 21:31:11 -0000	1.5
+++ security/lomac/kernel_util.c	2 Apr 2002 19:04:32 -0000
@@ -109,6 +109,7 @@
 	}
 }
 
+#if 0
 static int
 lomac_proc_candebug(struct proc *p1, struct proc *p2) {
 	lattr_t lattr;
@@ -145,7 +146,7 @@
 	else
 		return (EPERM);
 }
-	
+#endif
 
 int
 lomac_initialize_procs(void) {
Index: sys/conf.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/conf.h,v
retrieving revision 1.145
diff -u -d -r1.145 conf.h
--- sys/conf.h	31 Mar 2002 22:36:59 -0000	1.145
+++ sys/conf.h	2 Apr 2002 19:04:44 -0000
@@ -311,28 +311,29 @@
 DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
 
 
-int	cdevsw_add(struct cdevsw *new);
-int	cdevsw_remove(struct cdevsw *old);
-int	count_dev(dev_t dev);
-void	destroy_dev(dev_t dev);
-void	revoke_and_destroy_dev(dev_t dev);
-struct cdevsw *devsw(dev_t dev);
-const char *devtoname(dev_t dev);
-int	dev_named(dev_t pdev, const char *name);
-void	dev_depends(dev_t pdev, dev_t cdev);
-void	freedev(dev_t dev);
-int	iszerodev(dev_t dev);
-dev_t	makebdev(int maj, int min);
-dev_t	make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, const char *fmt, ...) __printflike(6, 7);
-dev_t	make_dev_alias(dev_t pdev, const char *fmt, ...) __printflike(2, 3);
-int	dev2unit(dev_t dev);
-int	unit2minor(int unit);
+int	cdevsw_add(struct cdevsw *_new);
+int	cdevsw_remove(struct cdevsw *_old);
+int	count_dev(dev_t _dev);
+void	destroy_dev(dev_t _dev);
+void	revoke_and_destroy_dev(dev_t _dev);
+struct cdevsw *devsw(dev_t _dev);
+const char *devtoname(dev_t _dev);
+int	dev_named(dev_t _pdev, const char *_name);
+void	dev_depends(dev_t _pdev, dev_t _cdev);
+void	freedev(dev_t _dev);
+int	iszerodev(dev_t _dev);
+dev_t	makebdev(int _maj, int _min);
+dev_t	make_dev(struct cdevsw *_devsw, int _minor, uid_t _uid, gid_t _gid,
+		int _perms, const char *_fmt, ...) __printflike(6, 7);
+dev_t	make_dev_alias(dev_t _pdev, const char *_fmt, ...) __printflike(2, 3);
+int	dev2unit(dev_t _dev);
+int	unit2minor(int _unit);
 void	setconf(void);
-dev_t	getdiskbyname(char *name);
+dev_t	getdiskbyname(char *_name);
 
 /* This is type of the function DEVFS uses to hook into the kernel with */
-typedef void devfs_create_t(dev_t dev);
-typedef void devfs_destroy_t(dev_t dev);
+typedef void devfs_create_t(dev_t _dev);
+typedef void devfs_destroy_t(dev_t _dev);
 
 extern devfs_create_t *devfs_create_hook;
 extern devfs_destroy_t *devfs_destroy_hook;
@@ -349,7 +350,8 @@
 #define		GID_GAMES	13
 #define		GID_DIALER	68
 
-typedef void (*dev_clone_fn)(void *arg, char *name, int namelen, dev_t *result);
+typedef void (*dev_clone_fn)(void *_arg, char *_name, int _namelen,
+	dev_t *_result);
 
 int dev_stdclone(char *name, char **namep, const char *stem, int *unit);
 EVENTHANDLER_DECLARE(dev_clone, dev_clone_fn);
Index: sys/eventhandler.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/eventhandler.h,v
retrieving revision 1.19
diff -u -d -r1.19 eventhandler.h
--- sys/eventhandler.h	2 Apr 2002 04:18:54 -0000	1.19
+++ sys/eventhandler.h	13 Apr 2002 14:07:02 -0000
@@ -33,21 +33,19 @@
 #include <sys/sx.h>
 #include <sys/queue.h>
 
-struct eventhandler_entry 
-{
-    TAILQ_ENTRY(eventhandler_entry)	ee_link;
-    int					ee_priority;
-    void				*ee_arg;
+struct eventhandler_entry {
+	TAILQ_ENTRY(eventhandler_entry)	ee_link;
+	int				ee_priority;
+	void				*ee_arg;
 };
 
-struct eventhandler_list 
-{
-    char				*el_name;
-    int					el_flags;
+struct eventhandler_list {
+	char				*el_name;
+	int				el_flags;
 #define EHE_INITTED	(1<<0)
-    struct sx				el_lock;
-    TAILQ_ENTRY(eventhandler_list)	el_link;
-    TAILQ_HEAD(,eventhandler_entry)	el_entries;
+	struct sx			el_lock;
+	TAILQ_ENTRY(eventhandler_list)	el_link;
+	TAILQ_HEAD(,eventhandler_entry)	el_entries;
 };
 
 typedef struct eventhandler_entry	*eventhandler_tag;
@@ -67,10 +65,9 @@
  */
 #define EVENTHANDLER_FAST_DECLARE(name, type)			\
 extern struct eventhandler_list Xeventhandler_list_ ## name ;	\
-struct eventhandler_entry_ ## name 				\
-{								\
-    struct eventhandler_entry	ee;				\
-    type		eh_func;				\
+struct eventhandler_entry_ ## name {				\
+	struct eventhandler_entry	ee;			\
+	type		eh_func;				\
 };								\
 struct __hack
 
@@ -78,29 +75,30 @@
 struct eventhandler_list Xeventhandler_list_ ## name = { #name };	\
 struct __hack
 
-#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) {						\
-	EHE_LOCK(_el);								\
-	_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;								\
-	}									\
-	EHE_UNLOCK(_el);							\
-    }										\
+#define EVENTHANDLER_FAST_INVOKE(name, args...)				\
+do {									\
+	struct eventhandler_list *_el = &Xeventhandler_list_ ## name ;	\
+	struct eventhandler_entry *_ep, *_en;				\
+	struct eventhandler_entry_ ## name *_t;				\
+									\
+	if (_el->el_flags & EHE_INITTED) {				\
+		EHE_LOCK(_el);						\
+		_ep = TAILQ_FIRST(&(_el->el_entries));			\
+		while (_ep != NULL) {					\
+			_en = TAILQ_NEXT(_ep, ee_link);			\
+			_t = (struct eventhandler_entry_ ## name *)_ep; \
+			_t->eh_func(_ep->ee_arg , ## args);		\
+	    _ep = _en;							\
+	}								\
+	EHE_UNLOCK(_el);						\
+    }									\
 } while (0)
 
-#define EVENTHANDLER_FAST_REGISTER(name, func, arg, priority) \
-    eventhandler_register(&Xeventhandler_list_ ## name, #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) \
-    eventhandler_deregister(&Xeventhandler_list_ ## name, tag)
+	eventhandler_deregister(&Xeventhandler_list_ ## name, tag)
 
 /*
  * Slow handlers are entirely dynamic; lists are created
@@ -112,39 +110,40 @@
 #define EVENTHANDLER_DECLARE(name, type)	\
 struct eventhandler_entry_ ## name 		\
 {						\
-    struct eventhandler_entry	ee;		\
-    type		eh_func;		\
+	struct eventhandler_entry	ee;	\
+	type				eh_func;\
 };						\
 struct __hack
 
-#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)) {					\
-	EHE_LOCK(_el);								\
-	_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;								\
-	}									\
-	EHE_UNLOCK(_el);							\
-    }										\
+#define EVENTHANDLER_INVOKE(name, args...)				\
+do {									\
+	struct eventhandler_list *_el;					\
+	struct eventhandler_entry *_ep, *_en;				\
+	struct eventhandler_entry_ ## name *_t;				\
+									\
+	if (((_el = eventhandler_find_list(#name)) != NULL) && 		\
+		(_el->el_flags & EHE_INITTED)) {			\
+		EHE_LOCK(_el);						\
+		_ep = TAILQ_FIRST(&(_el->el_entries));			\
+		while (_ep != NULL) {					\
+			_en = TAILQ_NEXT(_ep, ee_link);			\
+			_t = (struct eventhandler_entry_ ## name *)_ep;	\
+			_t->eh_func(_ep->ee_arg , ## args); 		\
+			_ep = _en;					\
+		}							\
+		EHE_UNLOCK(_el);					\
+	}								\
 } while (0)
 
 #define EVENTHANDLER_REGISTER(name, func, arg, priority) \
-    eventhandler_register(NULL, #name, func, arg, priority)
+	eventhandler_register(NULL, #name, func, arg, priority)
 
-#define EVENTHANDLER_DEREGISTER(name, tag) 		\
-do {							\
-    struct eventhandler_list *_el;			\
-							\
-    if ((_el = eventhandler_find_list(#name)) != NULL)	\
-	eventhandler_deregister(_el, tag);		\
+#define EVENTHANDLER_DEREGISTER(name, tag) 			\
+do {								\
+	struct eventhandler_list *_el;				\
+								\
+	if ((_el = eventhandler_find_list(#name)) != NULL)	\
+		eventhandler_deregister(_el, tag);		\
 } while(0)
 	
 
Index: sys/kernel.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/kernel.h,v
retrieving revision 1.101
diff -u -d -r1.101 kernel.h
--- sys/kernel.h	19 Mar 2002 20:18:36 -0000	1.101
+++ sys/kernel.h	20 Mar 2002 12:26:11 -0000
@@ -231,13 +231,13 @@
 		subsystem,					\
 		order,						\
 		func,						\
-		ident						\
+		(ident)						\
 	};							\
 	DATA_SET(sysinit_set,uniquifier ## _sys_init);
 
 #define	SYSINIT(uniquifier, subsystem, order, func, ident)	\
 	C_SYSINIT(uniquifier, subsystem, order,			\
-	(sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident)
+	(sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident))
 
 /*
  * Called on module unload: no special processing
@@ -247,13 +247,13 @@
 		subsystem,					\
 		order,						\
 		func,						\
-		ident						\
+		(ident)						\
 	};							\
 	DATA_SET(sysuninit_set,uniquifier ## _sys_uninit)
 
 #define	SYSUNINIT(uniquifier, subsystem, order, func, ident)	\
 	C_SYSUNINIT(uniquifier, subsystem, order,		\
-	(sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident)
+	(sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident))
 
 void	sysinit_add(struct sysinit **set, struct sysinit **set_end);
 
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	2 Mar 2002 14:32:09 -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,12 @@
 	__GLOBL(__CONCAT(__stop_set_,set));				\
 	static void const * const __set_##set##_sym_##sym 		\
 	__attribute__((__section__("set_" #set),__unused__)) = &sym
+#else /* !__GNUC__ */
+#ifndef lint
+#error "This file needs to be compiled by GCC or lint"
+#endif /* lint */
+#define __MAKE_SET(set, sym)	extern void const * const (__set_##set##_sym_##sym)
+#endif /* __GNUC__ */
 
 /*
  * Public macros.
Index: sys/lock.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/lock.h,v
retrieving revision 1.43
diff -u -d -r1.43 lock.h
--- sys/lock.h	27 Mar 2002 09:23:40 -0000	1.43
+++ sys/lock.h	27 Mar 2002 21:05:43 -0000
@@ -246,8 +246,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.59
diff -u -d -r1.59 malloc.h
--- sys/malloc.h	8 Apr 2002 10:37:27 -0000	1.59
+++ sys/malloc.h	13 Apr 2002 12:43:38 -0000
@@ -89,7 +89,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/sysctl.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/sysctl.h,v
retrieving revision 1.104
diff -u -d -r1.104 sysctl.h
--- sys/sysctl.h	31 Mar 2002 22:37:00 -0000	1.104
+++ sys/sysctl.h	2 Apr 2002 19:04:49 -0000
@@ -133,14 +133,14 @@
 	struct sysctl_oid_list *oid_parent;
 	SLIST_ENTRY(sysctl_oid) oid_link;
 	int		oid_number;
-	int		oid_kind;
+	u_int		oid_kind;
 	void		*oid_arg1;
 	int		oid_arg2;
 	const char	*oid_name;
 	int 		(*oid_handler)(SYSCTL_HANDLER_ARGS);
 	const char	*oid_fmt;
 	int		oid_refcnt;
-	char		*descr;
+	const char	*descr;
 };
 
 #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)

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




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