From nobody@FreeBSD.org  Mon Jan 16 15:45:55 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0183A1065673
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Jan 2012 15:45:55 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id C9D078FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Jan 2012 15:45:54 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q0GFjsCL024087
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Jan 2012 15:45:54 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q0GFjshr024086;
	Mon, 16 Jan 2012 15:45:54 GMT
	(envelope-from nobody)
Message-Id: <201201161545.q0GFjshr024086@red.freebsd.org>
Date: Mon, 16 Jan 2012 15:45:54 GMT
From: Oliver <grimeton@gmx.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: usr/src/sys/sys/smp.h:124: warning: comparison between signed and unsigned
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         164203
>Category:       kern
>Synopsis:       [smp] usr/src/sys/sys/smp.h:124: warning: comparison between signed and unsigned
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 16 15:50:09 UTC 2012
>Closed-Date:    
>Last-Modified:  Thu Jan 19 16:57:03 UTC 2012
>Originator:     Oliver
>Release:        9.0-RELEASE
>Organization:
n/a
>Environment:
FreeBSD test 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
Hello,

I'm trying to build VirtualBox on 9.0-Release and get the following warning:

=======8<=====SNIP==========
In file included from /opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h:57,
                 from /opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c:35:
/usr/src/sys/sys/smp.h: In function 'cpu_next':
/usr/src/sys/sys/smp.h:124: warning: comparison between signed and unsigned
In file included from /opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h:57,
                 from /opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c:34:
/usr/src/sys/sys/smp.h: In function 'cpu_next':
/usr/src/sys/sys/smp.h:124: warning: comparison between signed and unsigned
/opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c: In function 'rtR0MemObjFreeBSDPhysPageInit':
/opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c:398: error: 'PG_UNMANAGED' undeclared (first use in this function)
/opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c:398: error: (Each undeclared identifier is reported only once
/opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c:398: error: for each function it appears in.)
In file included from /opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h:57,
                 from /opt/vbox/VirtualBox-4.1.8_OSE/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c:35:
/usr/src/sys/sys/smp.h: In function 'cpu_next':
/usr/src/sys/sys/smp.h:124: warning: comparison between signed and unsigned
kmk: *** [/opt/vbox/VirtualBox-4.1.8_OSE/out/freebsd.amd64/release/obj/RuntimeR0Drv/r0drv/freebsd/memobj-r0drv-freebsd.o] Error 1

=========>8=========SNAP=============

I checked /usr/src/sys/sys/smp.h and can see that mp_maxid is declared as extern u_int. But I'm not sure if this is a compiler problem or just a wrong declaration on line 124, for cpu_next(int i).

If it's changed to cpu_next(u_int i) it works, and virtualbox compiles and works too.

Thanks.

KR,

Grimeton

>How-To-Repeat:
- Install 9.0-RELEASE
- Install src.txz from your fav. server
- Get VirtualBox 4.1.8 sources from www.virtualbox.org
- configure and build virtualbox and see the error message from above

>Fix:
One can change the delaration of cpu_next() to cpu_next(u_int i).


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