3.3 PATCH: Fix non-threaded libjava bootstrap failure

Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Fri Oct 25 15:14:00 GMT 2002


Current mainline failed to bootstrap in libjava on alpha-dec-osf5.1:

/vol/gnu/src/gcc/gcc-dist/libjava/java/lang/natObject.cc:432: error: ISO C++ 
   forbids declaration of `_Jv_ThreadId_t' with no type
/vol/gnu/src/gcc/gcc-dist/libjava/java/lang/natObject.cc:432: error: parse 
   error before `;' token

This happened because _Jv_ThreadId_t wasn't defined on that platform since
there's no pthread support yet.  The code in question (the declaration of
struct hash_entry) is only used if JV_HASH_SYNCHRONIZATION is defined.
This used to be undefined, but this got broken by this patch:

2002-10-20  Adam Megacz <adam@xwt.org>

	* aclocal.m4 (CHECK_FOR_BROKEN_MINGW_LD): added
	* configure.in: enabled hash sync on Win32
        * include/win32-threads.h (_Jv_ThreadId_t): added.
        * java/lang/natObject.cc (_Jv_MonitorEnter, _Jv_MonitorExit,
	heavy_lock_obj_finalization_proc, wait, notify, notifyAll):
	removed some posix-isms, use Thread::sleep() instead of usleep,
	added code to clear bottom three bits if platform has a broken
	linker.  * include/win32-threads.h (_Jv_ThreadId_t): added.

which removed the following test:

@@ -444,7 +445,7 @@ AC_LINK_FILES(sysdep/$sysdeps_dir/locks.
 
 HASH_SYNC_SPEC=
 # Hash synchronization is only useful with posix threads right now.
-if test "$enable_hash_synchronization" = yes && test "$THREADS" = "posix"; then
+if test "$enable_hash_synchronization" = yes; then
    HASH_SYNC_SPEC=-fhash-synchronization
    AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
 fi

This clearly breaks systems with THREADS=none.  The following trivial patch
fixes this and allows me to finish bootstrap.

Ok for mainline?

	Rainer


Fri Oct 25 22:35:17 2002  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* configure.in (HASH_SYNC_SPEC): Don't enable if no threads.
	* configure: Regenerate.
	
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.141
diff -u -p -r1.141 configure.in
--- configure.in	21 Oct 2002 01:50:13 -0000	1.141
+++ configure.in	25 Oct 2002 22:13:36 -0000
@@ -445,7 +445,7 @@ AC_LINK_FILES(sysdep/$sysdeps_dir/locks.
 
 HASH_SYNC_SPEC=
 # Hash synchronization is only useful with posix threads right now.
-if test "$enable_hash_synchronization" = yes; then
+if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
    HASH_SYNC_SPEC=-fhash-synchronization
    AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
 fi



More information about the Java-patches mailing list