This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libjava build failure on branch for sparc-sun-solaris2.7



On Tue, 22 May 2001, Mark Mitchell wrote:
> Short term, I'd say you'll have to do the `#undef' thing, grotesque
> though it is.

Here goes.  With this and my (unreviewed) binutils patch, I can bootstrap
on solaris once again:

FAIL: Invoke_1 execution from source compiled test
FAIL: Invoke_1 execution from bytecode->native test
FAIL: Invoke_1 -O execution from source compiled test
FAIL: Invoke_1 -O execution from bytecode->native test
FAIL: Thread_Alive execution from source compiled test
FAIL: Thread_Alive execution from bytecode->native test
FAIL: Thread_Alive -O execution from source compiled test
FAIL: Thread_Alive -O execution from bytecode->native test

		=== libjava Summary ===

# of expected passes		1660
# of unexpected failures	8
# of unexpected successes	10
# of expected failures		14
# of untested testcases		24

Tested on sparc-sun-solaris2.7 and i686-pc-linux-gnu.  Ok for branch?


2001-05-23  Jeff Sturm  <jsturm@one-point.com>

	* java/net/natPlainDatagramSocketImpl.cc: Undefine bind if defined.
	(_Jv_bind): New static function.
	(bind): Use _Jv_bind.
	* java/net/natPlainSocketImpl.cc: Undefine bind, connect if defined.
	(_Jv_bind, _Jv_connect): New static functions.
	(bind): Use _Jv_bind.
	(connect): Use _Jv_connect.

Index: java/net/natPlainDatagramSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainDatagramSocketImpl.cc,v
retrieving revision 1.26
diff -u -p -r1.26 natPlainDatagramSocketImpl.cc
--- natPlainDatagramSocketImpl.cc	2000/11/03 07:43:06	1.26
+++ natPlainDatagramSocketImpl.cc	2001/05/23 20:08:38
@@ -36,6 +36,18 @@ details.  */
 #include <bstring.h>
 #endif
 
+// Avoid macro definitions of bind from system headers, e.g. on
+// Solaris 7 with _XOPEN_SOURCE.  FIXME
+static inline int
+_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
+{
+  return ::bind (fd, addr, addrlen);
+}
+
+#ifdef bind
+#undef bind
+#endif
+
 #include <gcj/cni.h>
 #include <java/io/IOException.h>
 #include <java/io/FileDescriptor.h>
@@ -210,7 +222,7 @@ java::net::PlainDatagramSocketImpl::bind
   else
     throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
 
-  if (::bind (fnum, ptr, len) == 0)
+  if (_Jv_bind (fnum, ptr, len) == 0)
     {
       socklen_t addrlen = sizeof(u);
       if (lport != 0)
Index: java/net/natPlainSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.23
diff -u -p -r1.23 natPlainSocketImpl.cc
--- natPlainSocketImpl.cc	2000/11/03 07:43:06	1.23
+++ natPlainSocketImpl.cc	2001/05/23 20:08:38
@@ -33,6 +33,28 @@ details.  */
 #include <bstring.h>
 #endif
 
+// Avoid macro definitions of bind, connect from system headers, e.g. on
+// Solaris 7 with _XOPEN_SOURCE.  FIXME
+static inline int
+_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
+{
+  return ::bind (fd, addr, addrlen);
+}
+
+#ifdef bind
+#undef bind
+#endif
+
+static inline int
+_Jv_connect (int fd, struct sockaddr *addr, int addrlen)
+{
+  return ::connect (fd, addr, addrlen);
+}
+
+#ifdef connect
+#undef connect
+#endif
+
 #include <gcj/cni.h>
 #include <gcj/javaprims.h>
 #include <java/io/IOException.h>
@@ -164,7 +186,7 @@ java::net::PlainSocketImpl::bind (java::
   // Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
   ::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i));
   
-  if (::bind (fnum, ptr, len) == 0)
+  if (_Jv_bind (fnum, ptr, len) == 0)
     {
       address = host;
       socklen_t addrlen = sizeof(u);
@@ -209,7 +231,7 @@ java::net::PlainSocketImpl::connect (jav
   else
     throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
 
-  if (::connect (fnum, ptr, len) != 0)
+  if (_Jv_connect (fnum, ptr, len) != 0)
     goto error;
   address = host;
   port = rport;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]