Q) jdk1.4.1 compile on -current

Mike Bristow mike at urgle.com
Sun Jul 27 07:22:02 PDT 2003


On Sun, 2003-07-27 at 14:23, Sheldon Hearn wrote:
> On (2003/07/27 15:05), Sheldon Hearn wrote:
> 
> > > It's not a GCC bug, it's a JDK bug which GCC used to silently ignore.
> > > The ## operator should only be used to paste together parts of what is
> > > meant to be a single token, but apparently a lot of people use it
> > > between tokens in macro definitions (which is not only incorrect but
> > > also completely unnecessary).
> > 
> > So name##_t is supposed to be name_t?  Any idea what the original
> > programmer wanted to achieve or avoid by doing this?
> 
> Ah, wait.  Those are bad examples (and don't produce errors).
> 
> I've just looked at the standard and seen what you're talking about.
> It's easy to imagine the author of the failing code thinking this was
> necessary.
> 

I've been looking at this problem too, and while the patch you have is
neccessary, it isn't complete.  You'll blow up in the same way later.

The attached patch touches all the problems I've found, but the first
time the built java is used (in the build process) it dumps core, so
I've obviously done something stupid. 


--- ../../hotspot/src/share/vm/runtime/mutexLocker.cpp.orig	Sat Jul 26
19:49:23 2003
+++ ../../hotspot/src/share/vm/runtime/mutexLocker.cpp	Sat Jul 26
19:48:45 2003
@@ -95,7 +95,7 @@
 #endif
 
 #define def(var, type, pri, vm_block) \
-  var = new type(Mutex::##pri, #var, vm_block)
+  var = new type(Mutex::pri, #var, vm_block)
 
 void mutex_init() {  
   def(Event_lock                   , Mutex  , event,       true ); //
allow to lock in VM
--- ../../hotspot/src/share/vm/prims/jni.cpp.orig	Sat Jul 26 10:57:21
2003
+++ ../../hotspot/src/share/vm/prims/jni.cpp	Sat Jul 26 11:50:15 2003
@@ -902,7 +902,7 @@
   JNI_ArgumentPusherVaArg ap(methodID, args); \
   jni_invoke_nonstatic(env, &jvalue, obj, JNI_VIRTUAL, methodID, &ap,
CHECK_0); \
   va_end(args); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END \
 \
 \
@@ -912,7 +912,7 @@
   JavaValue jvalue(Tag); \
   JNI_ArgumentPusherVaArg ap(methodID, args); \
   jni_invoke_nonstatic(env, &jvalue, obj, JNI_VIRTUAL, methodID, &ap,
CHECK_0); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END \
 \
 \
@@ -922,7 +922,7 @@
   JavaValue jvalue(Tag); \
   JNI_ArgumentPusherArray ap(methodID, args); \
   jni_invoke_nonstatic(env, &jvalue, obj, JNI_VIRTUAL, methodID, &ap,
CHECK_0); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END
 
 // the runtime type of subword integral basic types is integer
@@ -976,7 +976,7 @@
   JNI_ArgumentPusherVaArg ap(methodID, args); \
   jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID,
&ap, CHECK_0); \
   va_end(args); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END \
 \
 \
@@ -986,7 +986,7 @@
   JavaValue jvalue(Tag); \
   JNI_ArgumentPusherVaArg ap(methodID, args); \
   jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID,
&ap, CHECK_0); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END \
 \
 \
@@ -996,7 +996,7 @@
   JavaValue jvalue(Tag); \
   JNI_ArgumentPusherArray ap(methodID, args); \
   jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID,
&ap, CHECK_0); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END
 
 // the runtime type of subword integral basic types is integer
@@ -1051,7 +1051,7 @@
   JNI_ArgumentPusherVaArg ap(methodID, args); \
   jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap,
CHECK_0); \
   va_end(args); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END \
 \
 \
@@ -1061,7 +1061,7 @@
   JavaValue jvalue(Tag); \
   JNI_ArgumentPusherVaArg ap(methodID, args); \
   jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap,
CHECK_0); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END \
 \
 \
@@ -1071,7 +1071,7 @@
   JavaValue jvalue(Tag); \
   JNI_ArgumentPusherArray ap(methodID, args); \
   jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap,
CHECK_0); \
-  return (ResultType)(jvalue._value.##unionType); \
+  return (ResultType)(jvalue._value.unionType); \
 JNI_END
 
 // the runtime type of subword integral basic types is integer
@@ -1204,7 +1204,7 @@
   /* and creates a ResetNoHandleMark.                                  
*/ \
   if (jvmdi::enabled()) { \
     jvalue field_value; \
-    field_value.##unionType = value; \
+    field_value.unionType = value; \
     o = jvmdi::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false,
SigType, (jvalue *)&field_value); \
   } \
   o->Fieldname##_field_put(offset, value); \
@@ -1333,7 +1333,7 @@
   /* jni_SetField_probe() assumes that is okay to create handles. */ \
   if (jvmdi::enabled()) { \
     jvalue field_value; \
-    field_value.##unionType = value; \
+    field_value.unionType = value; \
     jvmdi::jni_SetField_probe(thread, NULL, NULL, id->holder(),
fieldID, true, SigType, (jvalue *)&field_value); \
   } \
   id->holder()-> Fieldname##_field_put (id->offset(), value); \
---
../../hotspot/src/share/vm/runtime/jvmdiInterfaceSupport.hpp.orig	Fri
Sep  6 08:04:51 2002
+++ ../../hotspot/src/share/vm/runtime/jvmdiInterfaceSupport.hpp	Sat Jul
26 18:15:36 2003
@@ -24,7 +24,7 @@
   result_type JNICALL methodName signature
{                                         \
     JavaThread* thread = (JavaThread*)
ThreadLocalStorage::thread();                 \
     TransitionClass
__tiv(thread);                                                   \
-    __ENTRY(result_type, methodName##signature,
thread)                              \
+    __ENTRY(result_type, methodName signature,
thread)                              \
     debug_only(VMNativeEntryWrapper
__vew;)                                          \
     debug_only(const char* const _jvmdi_methodName_ =
#methodName;)                  \
     debug_only(bool  _trace_ = trace;
);                                             \



More information about the freebsd-java mailing list