kern/113369: Wrong #endif breaks code compilation

Ivo Vachkov ivo.vachkov at gmail.com
Tue Jun 5 15:10:03 UTC 2007


>Number:         113369
>Category:       kern
>Synopsis:       Wrong #endif breaks code compilation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 05 15:10:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Ivo Vachkov
>Release:        FreeBSD 7-CURRENT
>Organization:
InfoWeapons Corp
>Environment:
ivo-void64:~> uname -a
FreeBSD void64.unilans.net 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Tue Jun  5 16:44:30 EEST 2007     ivo at void64.unilans.net:/usr/obj/usr/src/sys/64  amd64
ivo-void64:~>                                                                 
>Description:
make buildkernel KERNCONF=$KERNEL_FILE ends with the following error:

cc -c -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000  -mcmodel=kernel -mno-red-zone  -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow  -msoft-float -fno-asynchronous-unwind-tables -ffreestanding   /usr/src/sys/kern/kern_mutex.c
/usr/src/sys/kern/kern_mutex.c: In function '_mtx_lock_spin_failed':
/usr/src/sys/kern/kern_mutex.c:496: warning: no previous prototype for '_thread_lock_flags'
/usr/src/sys/kern/kern_mutex.c:539: warning: no previous prototype for 'thread_lock_block'
/usr/src/sys/kern/kern_mutex.c:553: warning: no previous prototype for 'thread_lock_unblock'
/usr/src/sys/kern/kern_mutex.c:562: warning: no previous prototype for 'thread_lock_set'
/usr/src/sys/kern/kern_mutex.c:580: warning: no previous prototype for '_mtx_unlock_sleep'
/usr/src/sys/kern/kern_mutex.c:759: warning: no previous prototype for 'mtx_sysinit'
/usr/src/sys/kern/kern_mutex.c:773: warning: no previous prototype for 'mtx_init'
/usr/src/sys/kern/kern_mutex.c:817: warning: no previous prototype for 'mtx_destroy'
/usr/src/sys/kern/kern_mutex.c:846: warning: no previous prototype for 'mutex_init'
/usr/src/sys/kern/kern_mutex.c:864: error: expected declaration or statement at end of input
*** Error code 1

>How-To-Repeat:
try to build without 'options SMP' and /usr/src/sys/kern/kern_mutex.c with following version:

#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.191 2007/06/04 23:51:43 jeff Exp $");

>Fix:
proposed fix is attached as patch

Patch attached with submission follows:

--- /usr/src/sys/kern/kern_mutex.c	Tue Jun  5 02:51:43 2007
+++ kern_mutex.c	Tue Jun  5 17:03:19 2007
@@ -439,12 +439,14 @@
 	/* If the mutex is unlocked, try again. */
 	if (td == NULL)
 		return;
+
 #ifdef SMP
 	printf( "spin lock %p (%s) held by %p (tid %d) too long\n",
 	    m, m->lock_object.lo_name, td, td->td_tid);
 #ifdef WITNESS
 	witness_display_spinlock(&m->lock_object, td);
 #endif
+#endif
 	panic("spin lock held too long");
 }
 
@@ -489,7 +491,6 @@
 	lock_profile_obtain_lock_success(&m->lock_object, contested,	
 	    waittime, (file), (line));
 }
-#endif /* SMP */
 
 void
 _thread_lock_flags(struct thread *td, int opts, const char *file, int line)


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list