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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

3.3 PATCH: Fix libjava bootstrap failure on Tru64 UNIX


libjava didn't bootstrap on the 3.3 branch on alpha-dec-osf5.1: to get the
proper prototypes for accept() etc., platform.h (include/posix.h on that
platform) needs to be included before all system headers so the definition
of _POSIX_PII_SOCKET is effective.  This patch fixes those sources that
violated this requirement.  At the same time, it uses the <> form for all
inclusions of platform.h: the header is located in the libjava/include
directory in the build tree, exactly the same location as config.h which is
always included as <config.h>.  platform.h should be handled the same way
for consistency.

Even with this fix, bootstrap didn't complete since the system headers
(<sys/socket.h> in particular) provide macro definitions of e.g. accept
that mutilate the method declarations in libjava/java/net/SocketImpl.h.  On
the 3.2 branch, this has been avoided by #undef'ing accept and friends in
java/net/natPlainSocketImpl.cc.  Those #undef's have been lost on the 3.3
branch when part of the code got moved to include/posix.h.  This patch
restores the #undef's (but without the older

#ifdef accept
#undef accept
#endif

): it's harmless to #undef a macro that hasn't been defined.

With those changes, 3.3 bootstraps successfully.

Ok for the 3.3 branch?

mainline suffers from the same problem, but doesn't bootstrap at all for
unrelated reasons, so I cannot check there.  The 3.2 branch may or may not
be affected by some of the problems: I need to check there as well.

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University


Tue Feb 18 12:30:44 2003  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* gnu/gcj/runtime/natStackTrace.cc: Include platform.h immediately
	after config.h.  Use <> for consistency.
	* java/lang/natObject.cc: Likewise.
	* java/lang/natRuntime.cc: Likewise.
	* java/lang/natSystem.cc: Likewise.
	* java/util/natTimeZone.cc: Likewise.
	* win32.cc: Likewise.
	* include/posix.h (fcntl, socket, connect, close, bind, accept,
	listen, write, read): Undef to avoid interference from OS macros.
	
Index: win32.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/win32.cc,v
retrieving revision 1.12
diff -u -p -r1.12 win32.cc
--- win32.cc	24 Apr 2002 01:33:19 -0000	1.12
+++ win32.cc	18 Feb 2003 13:13:27 -0000
@@ -9,11 +9,11 @@ Libgcj License.  Please consult the file
 details.  */
 
 #include <config.h>
+#include <platform.h>
 #include <jvm.h>
 #include <sys/timeb.h>
 #include <stdlib.h>
 
-#include "platform.h"
 #include <java/lang/ArithmeticException.h>
 #include <java/util/Properties.h>
 
Index: gnu/gcj/runtime/natStackTrace.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/runtime/natStackTrace.cc,v
retrieving revision 1.2.6.1
diff -u -p -r1.2.6.1 natStackTrace.cc
--- gnu/gcj/runtime/natStackTrace.cc	28 Jan 2003 19:10:57 -0000	1.2.6.1
+++ gnu/gcj/runtime/natStackTrace.cc	18 Feb 2003 13:13:30 -0000
@@ -16,6 +16,7 @@ details.  */
  */
 
 #include <config.h>
+#include <platform.h>
 
 #include <string.h>
 
@@ -30,8 +31,6 @@ details.  */
 #include <java-interp.h>
 #include <java/util/IdentityHashMap.h>
 #include <java/lang/ArrayIndexOutOfBoundsException.h>
-
-#include "platform.h"
 
 #include <sys/types.h>
 
Index: include/posix.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/posix.h,v
retrieving revision 1.13.2.2
diff -u -p -r1.13.2.2 posix.h
--- include/posix.h	7 Jan 2003 16:46:53 -0000	1.13.2.2
+++ include/posix.h	18 Feb 2003 13:13:30 -0000
@@ -60,6 +60,8 @@ _Jv_platform_close_on_exec (jint fd)
   ::fcntl (fd, F_SETFD, FD_CLOEXEC);
 }
 
+#undef fcntl
+
 #ifdef JV_HASH_SYNCHRONIZATION
 inline void
 _Jv_platform_usleep (unsigned long usecs)
@@ -80,18 +82,24 @@ _Jv_socket (int domain, int type, int pr
   return ::socket (domain, type, protocol);
 }
 
+#undef socket
+
 inline int
 _Jv_connect (jint fd, sockaddr *ptr, int len)
 {
    return ::connect (fd, ptr, len);
 }
 
+#undef connect
+
 inline int
 _Jv_close (jint fd)
 {
   return ::close (fd);
 }
 
+#undef close
+
 // Avoid macro definitions of bind from system headers, e.g. on
 // Solaris 7 with _XOPEN_SOURCE.  FIXME
 inline int
@@ -100,6 +108,8 @@ _Jv_bind (int fd, struct sockaddr *addr,
   return ::bind (fd, addr, addrlen);
 }
 
+#undef bind
+
 // Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
 inline int
 _Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
@@ -107,23 +117,31 @@ _Jv_accept (int fd, struct sockaddr *add
   return ::accept (fd, addr, addrlen);
 }
 
+#undef accept
+
 inline int
 _Jv_listen (int fd, int backlog)
 {
   return ::listen (fd, backlog);
 }
 
+#undef listen
+
 inline int
 _Jv_write(int s, void *buf, int len)
 {
   return ::write (s, buf, len);
 }
 
+#undef write
+
 inline int
 _Jv_read(int s, void *buf, int len)
 {
   return ::read (s, buf, len);
 }
+
+#undef read
 
 #endif /* DISABLE_JAVA_NET */
 
Index: java/lang/natObject.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natObject.cc,v
retrieving revision 1.23.4.1
diff -u -p -r1.23.4.1 natObject.cc
--- java/lang/natObject.cc	31 Dec 2002 17:44:43 -0000	1.23.4.1
+++ java/lang/natObject.cc	18 Feb 2003 13:13:30 -0000
@@ -9,6 +9,7 @@ Libgcj License.  Please consult the file
 details.  */
 
 #include <config.h>
+#include <platform.h>
 
 #include <string.h>
 
@@ -27,8 +28,6 @@ details.  */
 #include <java/lang/Class.h>
 #include <java/lang/Cloneable.h>
 #include <java/lang/Thread.h>
-
-#include "platform.h"
 
 #ifdef LOCK_DEBUG
 #  include <stdio.h>
Index: java/lang/natRuntime.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natRuntime.cc,v
retrieving revision 1.29.2.2
diff -u -p -r1.29.2.2 natRuntime.cc
--- java/lang/natRuntime.cc	3 Feb 2003 21:23:14 -0000	1.29.2.2
+++ java/lang/natRuntime.cc	18 Feb 2003 13:13:30 -0000
@@ -9,6 +9,7 @@ Libgcj License.  Please consult the file
 details.  */
 
 #include <config.h>
+#include <platform.h>
 
 #include <stdlib.h>
 
@@ -32,8 +33,6 @@ details.  */
 #include <java/lang/ArrayIndexOutOfBoundsException.h>
 
 #include <jni.h>
-
-#include "platform.h"
 
 #ifdef HAVE_PWD_H
 #include <pwd.h>
Index: java/lang/natSystem.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natSystem.cc,v
retrieving revision 1.54
diff -u -p -r1.54 natSystem.cc
--- java/lang/natSystem.cc	13 May 2002 20:10:36 -0000	1.54
+++ java/lang/natSystem.cc	18 Feb 2003 13:13:35 -0000
@@ -9,6 +9,7 @@ Libgcj License.  Please consult the file
 details.  */
 
 #include <config.h>
+#include <platform.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -23,8 +24,6 @@ details.  */
 #include <java/lang/NullPointerException.h>
 #include <java/io/PrintStream.h>
 #include <java/io/InputStream.h>
-
-#include "platform.h"
 
 
 
Index: java/util/natTimeZone.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/natTimeZone.cc,v
retrieving revision 1.5
diff -u -p -r1.5 natTimeZone.cc
--- java/util/natTimeZone.cc	4 Jun 2002 19:30:20 -0000	1.5
+++ java/util/natTimeZone.cc	18 Feb 2003 13:13:35 -0000
@@ -9,11 +9,10 @@ Libgcj License.  Please consult the file
 details.  */
 
 #include <config.h>
+#include <platform.h>
 
 #include <gcj/cni.h>
 #include <jvm.h>
-
-#include "platform.h"
 
 #include <java/util/TimeZone.h>
 #include <java/lang/Character.h>


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