NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-xen/44083: Compiling domU kernel with PCI bus enabled fails on a compiler warning of unused variable "mode"

>Number:         44083
>Category:       port-xen
>Synopsis:       Compiling domU kernel with PCI bus enabled fails on a compiler 
>warning of unused variable "mode"
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-xen-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 11 23:20:00 +0000 2010
>Originator:     Juho Salminen
>Release:        5.99.39
NetBSD 5.99.39 NetBSD 5.99.39 (XEN3_DOMU_HK1) #1: Thu 
Nov 11 23:37:33 EET 2010

Building the i386 Xen domU kernel with PCI bus enabled fails
on a compiler warning when compiling mainbus.c. The warning
states that variable "mode" is declared but not used.

The variable "mode" is declared in mainbus_attach() inside a #if
NPCI > 0. It is only used afterwards if DOM0OPS is also
defined. Thus, if DOM0OPS is not defined when NPCI is non-zero,
the variable is declared but not used, causing a compiler warning
that breaks the build.

The kernel configuration I used is the following:
include         "arch/i386/conf/XEN3_DOMU"

# Add support for PCI busses to the XEN3_DOMU kernel
xpci* at xenbus?
pci* at xpci ?

# Now add PCI and related devices to be used by this domain
# USB Controller and Devices

# PCI USB controllers
ehci*   at pci? dev ? function ?        # Enhanced Host Controller
uhci*   at pci? dev ? function ?        # Universal Host Controller

# USB bus support
usb*    at ehci?
usb*    at uhci?

# USB Hubs
uhub*   at usb?
uhub*   at uhub? port ? configuration ? interface ?

# USB Mass Storage
umass*  at uhub? port ? configuration ? interface ?
wd*     at umass?

# SCSI bus support (for both ahc and umass)
scsibus* at scsi?

# SCSI devices
sd*     at scsibus? target ? lun ?      # SCSI disk drives

The compiler error is the following:
#   compile  XEN3_DOMU_HK1/mainbus.o
/usr/netbsd-current/src/../tools/bin/i486--netbsdelf-gcc -ffreestanding 
-fno-zero-initialized-in-bss -O2 -std=gnu99 -fstack-protector -Wstack-protector 
--param ssp-buffer-size=1 -fno-strict-aliasing -fstack-protector 
-Wstack-protector --param ssp-buffer-size=1 -Werror -Wall -Wno-main 
-Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes 
-Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings 
-Wno-unreachable-code -Wno-sign-compare -Wno-pointer-sign -Wno-attributes 
-Werror -march=i686 -Di386 -I. 
-I/usr/netbsd-current/src/sys/arch -I/usr/netbsd-current/src/sys -nostdinc 
 b/libc/arch/i386/string -I/usr/netbsd-current/src/sys/dist/ipf -c 
cc1: warnings being treated as errors
/usr/netbsd-current/src/sys/arch/xen/x86/mainbus.c: In function 
/usr/netbsd-current/src/sys/arch/xen/x86/mainbus.c:137: warning: unused 
variable 'mode'

*** Failed target:  mainbus.o

With the configuration file shown above, attempt to compile the

Wrapping the variable declaration in #ifdef DOM0OPS fixes this:

Index: mainbus.c
RCS file: /cvsroot/src/sys/arch/xen/x86/mainbus.c,v
retrieving revision 1.12
diff -u -r1.12 mainbus.c
--- mainbus.c   7 Aug 2010 21:59:11 -0000       1.12
+++ mainbus.c   11 Nov 2010 22:44:40 -0000
@@ -133,9 +133,11 @@
 mainbus_attach(device_t parent, device_t self, void *aux)
+#ifdef DOM0OPS
 #if NPCI > 0
        int mode;
        union mainbus_attach_args mba;
 #if defined(DOM0OPS)
        int numcpus = 0;

Home | Main Index | Thread Index | Old Index