This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: some warnings (from Gentoos build process)
Andrew Haley wrote:
Keith, most of these warnings are yours. Please fix them.
As a matter of fact, they aren't mine. They're all API specification
silliness. Only one of them occurs in code that I touched.
The attach patch removes the all the warnings I could find in
natVMVirtualMachine.cc and jvmti.cc. I will commit it when it is approved.
Thank you for looking,
Keith
> * /mnt/data/tmp/portage/dev-java/gcj-4.3.0_alpha20070216/work/gcc-4.3-20070216/libjava/jvmti.cc:1002: warning: dereferencing type-punned pointer will break strict-aliasing rules
> /mnt/data/tmp/portage/dev-java/gcj-4.3.0_alpha20070216/work/gcc-4.3-20070216/libjava/jvmti.cc:1009: warning: dereferencing type-punned pointer will break strict-aliasing rules
> /mnt/data/tmp/portage/dev-java/gcj-4.3.0_alpha20070216/work/gcc-4.3-20070216/libjava/jvmti.cc:1016: warning: dereferencing type-punned pointer will break strict-aliasing rules
> /mnt/data/tmp/portage/dev-java/gcj-4.3.0_alpha20070216/work/gcc-4.3-20070216/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:105: warning: dereferencing type-punned pointer will break strict-aliasing rules
Index: jvmti.cc
===================================================================
--- jvmti.cc (revision 122057)
+++ jvmti.cc (working copy)
@@ -997,23 +997,23 @@
table_slot)
>= 0)
{
+ char **charp = &((*locals)[table_slot].name);
jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
- reinterpret_cast<unsigned char **>
- (&(*locals)[table_slot].name));
+ reinterpret_cast<unsigned char **> (charp));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].name, name);
+ charp = &((*locals)[table_slot].signature);
jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
- reinterpret_cast<unsigned char **>
- (&(*locals)[table_slot].signature));
+ reinterpret_cast<unsigned char **> (charp));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].signature, sig);
+ charp = &((*locals)[table_slot].generic_signature);
jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
- reinterpret_cast<unsigned char **>
- (&(*locals)[table_slot].generic_signature));
+ reinterpret_cast<unsigned char **> (charp));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].generic_signature, generic_sig);
Index: gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 122065)
+++ gnu/classpath/jdwp/natVMVirtualMachine.cc (working copy)
@@ -111,7 +111,13 @@
_stepping_threads = new ::java::util::Hashtable ();
JavaVM *vm = _Jv_GetJavaVM ();
- vm->GetEnv (reinterpret_cast<void **> (&_jdwp_jvmtiEnv), JVMTI_VERSION_1_0);
+ union
+ {
+ void *ptr;
+ jvmtiEnv *env;
+ } foo;
+ vm->GetEnv (&(foo.ptr), JVMTI_VERSION_1_0);
+ _jdwp_jvmtiEnv = foo.env;
// Wait for VM_INIT to do more initialization
jvmtiEventCallbacks callbacks;
}
static void JNICALL
-jdwpSingleStepCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
+jdwpSingleStepCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, jthread thread,
jmethodID method, jlocation location)
{
jobject si =