Subject: pkg/35337: gcc34 [PATCH]
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <mwicks@kettering.edu>
List: pkgsrc-bugs
Date: 12/29/2006 04:50:01
>Number:         35337
>Category:       pkg
>Synopsis:       gcc34 fails to compile on recent versions of netbsd
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 29 04:50:00 +0000 2006
>Originator:     Mark A. Wicks
>Release:        NetBSD 4.0_BETA2
>Organization:
Kettering University
>Environment:
System: NetBSD gaspra.kettering.edu 4.0_BETA2 NetBSD 4.0_BETA2 (GASPRA-4.0) #2: Mon Dec 11 13:09:07 EST 2006 mwicks@gaspra.kettering.edu:/var/tmp/build/sys/arch/i386/compile/GASPRA-4.0 i386
Architecture: i386
Machine: i386
>Description:
	Building gcc34 on recent versions of netbsd fails with:

	In file included from gnu/java/net/natPlainSocketImpl.cc:47:
	./java/lang/Boolean.h:26: error: expected unqualified-id before numeric constant
	./java/lang/Boolean.h:26: error: abstract declarator \ 
	`java::lang::Boolean*' used as declaration
	./java/lang/Boolean.h:26: error: expected `;' before numeric constant
	./java/lang/Boolean.h:27: error: expected unqualified-id before numeric constant
	./java/lang/Boolean.h:27: error: abstract declarator \ 
	`java::lang::Boolean*' used as declaration
	./java/lang/Boolean.h:27: error: expected `;' before numeric constant


>How-To-Repeat:
	Build gcc34 with NetBSD 4.0_BETA2
>Fix:
	Inclusion of ioctl.h (and filio.h) before Boolean.h causes the error.  I couldn't identify
	the specific defition causing the problem, but reordering the includes prevents the error,
	presumably without breaking anything else.
	Here's a patch:  

$NetBSD$

--- libjava/gnu/java/net/natPlainSocketImplPosix.cc.orig	2003-12-16 17:47:53.000000000 -0500
+++ libjava/gnu/java/net/natPlainSocketImplPosix.cc
@@ -9,26 +9,11 @@ details.  */
 #include <config.h>
 #include <platform.h>
 
-#ifdef HAVE_SYS_IOCTL_H
-#define BSD_COMP /* Get FIONREAD on Solaris2. */
-#include <sys/ioctl.h>
-#endif
-
-// Pick up FIONREAD on Solaris 2.5.
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
-
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <errno.h>
 #include <string.h>
 
-#if HAVE_BSTRING_H
-// Needed for bzero, implicitly used by FD_ZERO on IRIX 5.2 
-#include <bstring.h>
-#endif
-
 #include <gcj/cni.h>
 #include <gcj/javaprims.h>
 #include <gnu/java/net/PlainSocketImpl.h>
@@ -52,6 +37,21 @@ details.  */
 #include <java/lang/ArrayIndexOutOfBoundsException.h>
 #include <java/lang/IllegalArgumentException.h>
 
+#if HAVE_BSTRING_H
+// Needed for bzero, implicitly used by FD_ZERO on IRIX 5.2 
+#include <bstring.h>
+#endif
+
+#ifdef HAVE_SYS_IOCTL_H
+#define BSD_COMP /* Get FIONREAD on Solaris2. */
+#include <sys/ioctl.h>
+#endif
+
+// Pick up FIONREAD on Solaris 2.5.
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
 union SockAddr
 {
   struct sockaddr_in address;