Subject: port-xen/35217: arch/xen/x86/consinit.c has syntax error when CONS_OVERRIDE is enabled
To: None <port-xen-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <h-masuda@ootani.nagata.kobe.jp>
List: netbsd-bugs
Date: 12/09/2006 05:35:00
>Number:         35217
>Category:       port-xen
>Synopsis:       arch/xen/x86/consinit.c has syntax error when CONS_OVERRIDE is enabled
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-xen-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 09 05:35:00 +0000 2006
>Originator:     Hideo Masuda
>Release:        NetBSD-4.0_BETA2 i386
>Organization:
MASUDA-NET
>Environment:
NetBSD dsmbase2 4.0_BETA2 NetBSD 4.0_BETA2 (DSM_XEN3_DOM0) #2: Wed Dec  6 10:02:26 JST 2006  h-masuda@dsmbase2:/usr/netbsd-4/src/sys/arch/i386/compile/DSM_XEN3_DOM0 i386

>Description:
I want to build NetBSD 4.0_BETA2's XEN3_DOM0 kernel with CONS_OVERRIDE.
Then compile is failed with errors as in the "How to repeat the problem".

>How-To-Repeat:
cd $SRC/sys/arch/i386/conf
cat > XEN3_DOM0_CONS_OVERRIDE <<EOM
include "arch/i386/conf/XEN3_DOM0"
options         CONSDEVNAME="\"xencons\""
options         CONS_OVERRIDE
EOM
config XEN3_DOM0_CONS_OVERRIDE
cd ../compile/XEN3_DOM0_CONS_OVERRIDE
make consinit.o
        (snip)
#   compile  XEN3_DOM0_CONSOVERRIDE/consinit.o
cc -ffreestanding -fno-zero-initialized-in-bss -march=i686 -g -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-sign-compare -Di386 -I. -I/usr/netbsd-4/src/sys/arch/i386/compile/XEN3_DOM0_CONSOVERRIDE/xen-ma -I../../../../contrib/dev/ath/netbsd -I../../../../../common/include -I../../../../arch -I../../../.. -nostdinc -DLKM -DDIAGNOSTIC -DDEBUG -DMSGBUFSIZE=24576 -DCONSDEVNAME="xencons" -DCONS_OVERRIDE -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT -I../../../../lib/libkern/../../../common/lib/libc/quad -I../../../../lib/libkern/../../../common/lib/libc/string -I../../../../lib/libkern/../../../common/lib/libc/arch/i386/string -I../../../../dist/ipf -c ../../../../arch/xen/x86/consinit.c
../../../../arch/xen/x86/consinit.c: In function `consinit':
../../../../arch/xen/x86/consinit.c:171: error: parse error before ')' token
../../../../arch/xen/x86/consinit.c:179: error: `error' undeclared (first use in this function)
../../../../arch/xen/x86/consinit.c:179: error: (Each undeclared identifier is reported only once
../../../../arch/xen/x86/consinit.c:179: error: for each function it appears in.)
../../../../arch/xen/x86/consinit.c: At top level:
../../../../arch/xen/x86/consinit.c:196: warning: type defaults to `int' in declaration of `xenconscn_attach'
../../../../arch/xen/x86/consinit.c:196: warning: function declaration isn't a prototype
../../../../arch/xen/x86/consinit.c:196: error: conflicting types for `xenconscn_attach'
machine/xen.h:54: error: previous declaration of `xenconscn_attach'
../../../../arch/xen/x86/consinit.c:196: warning: data definition has no type or storage class
../../../../arch/xen/x86/consinit.c:197: error: parse error before "return"
../../../../arch/xen/x86/consinit.c:199: error: parse error before string constant
../../../../arch/xen/x86/consinit.c:199: warning: type defaults to `int' in declaration of `panic'
../../../../arch/xen/x86/consinit.c:199: warning: function declaration isn't a prototype
../../../../arch/xen/x86/consinit.c:199: error: conflicting types for `panic'
../../../../sys/systm.h:222: error: previous declaration of `panic'
../../../../arch/xen/x86/consinit.c:199: warning: data definition has no type or storage class
*** Error code 1

Stop.

>Fix:
# cvs diff -u consinit.c
Index: consinit.c
===================================================================
RCS file: /cvs/cvsroot/src/sys/arch/xen/x86/consinit.c,v
retrieving revision 1.6
diff -u -r1.6 consinit.c
--- consinit.c  11 Dec 2005 12:19:50 -0000      1.6
+++ consinit.c  9 Dec 2006 05:22:17 -0000
@@ -168,7 +168,7 @@
        if (xen_start_info.flags & SIF_PRIVILEGED) {
 #ifdef CONS_OVERRIDE
                if (strcmp(default_consinfo.devname, "tty0") == 0 ||
-                   strcmp(default_consinfo.devname, "pc") == 0)) {
+                   strcmp(default_consinfo.devname, "pc") == 0) {
 #else
                if (strcmp(xcp.xcp_console, "tty0") == 0 || /* linux name */
                    strcmp(xcp.xcp_console, "pc") == 0) { /* NetBSD name */