[kaffe] CVS kaffe (doogie): Fix several gcc warnings. 725 -> 691,
on my machine. Note, that
Kaffe CVS
cvs-commits at kaffe.org
Thu Dec 9 16:41:28 PST 2004
PatchSet 5586
Date: 2004/12/10 00:37:16
Author: doogie
Branch: HEAD
Tag: (none)
Log:
Fix several gcc warnings. 725 -> 691, on my machine. Note, that
do_execute_java_class_method and do_execute_java_method (and the _v
counterparts) have changed their signatures.
Members:
ChangeLog:1.3131->1.3132
binreloc/prefix.c:1.1->1.2
binreloc/prefix.h:1.1->1.2
kaffe/kaffe/main.c:1.67->1.68
kaffe/kaffevm/stackTrace.c:1.39->1.40
kaffe/kaffevm/support.c:1.76->1.77
kaffe/kaffevm/support.h:1.35->1.36
kaffe/kaffevm/thread.c:1.80->1.81
kaffe/kaffevm/jni/jni.c:1.9->1.10
libraries/clib/native/Arrays.c:1.5->1.6
libraries/clib/net/NetworkInterface.c:1.9->1.10
libraries/clib/net/PlainSocketImpl.c:1.46->1.47
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3131 kaffe/ChangeLog:1.3132
--- kaffe/ChangeLog:1.3131 Thu Dec 9 21:57:08 2004
+++ kaffe/ChangeLog Fri Dec 10 00:37:16 2004
@@ -1,5 +1,17 @@
2004-12-09 Adam Heath <doogie at brainfood.com>
+ * binreloc/prefix.c, binreloc/prefix.h, kaffe/kaffe/main.c,
+ kaffe/kaffevm/stackTrace.c, kaffe/kaffevm/support.c,
+ kaffe/kaffevm/support.h, kaffe/kaffevm/thread.c,
+ kaffe/kaffevm/jni/jni.c, libraries/clib/native/Arrays.c,
+ libraries/clib/net/NetworkInterface.c,
+ libraries/clib/net/PlainSocketImpl.c:
+ Fix several gcc warnings. 725 -> 691, on my machine.
+ Note, that do_execute_java_class_method and do_execute_java_method
+ (and the _v counterparts) have changed their signatures.
+
+2004-12-09 Adam Heath <doogie at brainfood.com>
+
* kaffe/kaffevm/jit3/basecode.c, kaffe/kaffevm/jit3/basecode.h,
kaffe/kaffevm/jit3/icode.c:
Fix 'function returns an aggretate type' warning.
Index: kaffe/binreloc/prefix.c
diff -u kaffe/binreloc/prefix.c:1.1 kaffe/binreloc/prefix.c:1.2
--- kaffe/binreloc/prefix.c:1.1 Sat Jun 19 21:13:52 2004
+++ kaffe/binreloc/prefix.c Fri Dec 10 00:37:20 2004
@@ -92,7 +92,7 @@
* }
*/
char *
-br_locate (void *symbol)
+br_locate (const char *symbol)
{
char line[5000];
FILE *f;
@@ -158,7 +158,7 @@
* br_locate_prefix (&argc); --> returns: "/usr"
*/
char *
-br_locate_prefix (void *symbol)
+br_locate_prefix (const char *symbol)
{
char *path, *prefix;
@@ -188,7 +188,7 @@
* br_prepend_prefix (&argc, "/share/foo/data.png"); --> Returns "/usr/share/foo/data.png"
*/
char *
-br_prepend_prefix (void *symbol, char *path)
+br_prepend_prefix (const char *symbol, const char *path)
{
char *tmp, *newpath;
@@ -221,7 +221,7 @@
static void
-br_thread_local_store_fini ()
+br_thread_local_store_fini (void)
{
char *specific;
@@ -237,7 +237,7 @@
static void
-br_str_free (void *str)
+br_str_free (char *str)
{
if (str)
free (str);
@@ -245,9 +245,9 @@
static void
-br_thread_local_store_init ()
+br_thread_local_store_init (void)
{
- if (pthread_key_create (&br_thread_key, br_str_free) == 0)
+ if (pthread_key_create (&br_thread_key, (void (*)(void *))br_str_free) == 0)
atexit (br_thread_local_store_fini);
}
@@ -335,7 +335,7 @@
/* Emulates glibc's strndup() */
static char *
-br_strndup (char *str, size_t size)
+br_strndup (const char *str, size_t size)
{
char *result = NULL;
size_t len;
@@ -374,7 +374,7 @@
while (end > path && *end == '/')
end--;
- result = br_strndup ((char *) path, end - path + 1);
+ result = br_strndup (path, (size_t)(end - path + 1));
if (!*result)
{
free (result);
@@ -407,7 +407,7 @@
end = strrchr (path, '/');
if (!end) return strdup (path);
- tmp = br_strndup ((char *) path, end - path);
+ tmp = br_strndup (path, (size_t)(end - path));
if (!*tmp)
{
free (tmp);
@@ -416,7 +416,7 @@
end = strrchr (tmp, '/');
if (!end) return tmp;
- result = br_strndup (tmp, end - tmp);
+ result = br_strndup (tmp, (size_t)(end - tmp));
free (tmp);
if (!*result)
Index: kaffe/binreloc/prefix.h
diff -u kaffe/binreloc/prefix.h:1.1 kaffe/binreloc/prefix.h:1.2
--- kaffe/binreloc/prefix.h:1.1 Sat Jun 19 21:13:52 2004
+++ kaffe/binreloc/prefix.h Fri Dec 10 00:37:20 2004
@@ -33,7 +33,7 @@
* --> expands br_locate to foobar_br_locate
*/
#undef BR_NAMESPACE
-#define BR_NAMESPACE(funcName) funcName
+#define BR_NAMESPACE(funcName) _kf_ ## funcName
#ifdef ENABLE_BINRELOC
@@ -59,18 +59,18 @@
#undef CONFDIR
#undef LOCALEDIR
- #define SELFPATH (br_thread_local_store (br_locate ((void *) "")))
- #define PREFIX (br_thread_local_store (br_locate_prefix ((void *) "")))
- #define PREFIXDIR (br_thread_local_store (br_locate_prefix ((void *) "")))
- #define BINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin")))
- #define SBINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin")))
- #define DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share")))
- #define LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib")))
- #define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec")))
- #define ETCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
- #define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
- #define CONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
- #define LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale")))
+ #define SELFPATH (br_thread_local_store (br_locate ("")))
+ #define PREFIX (br_thread_local_store (br_locate_prefix ("")))
+ #define PREFIXDIR (br_thread_local_store (br_locate_prefix ("")))
+ #define BINDIR (br_thread_local_store (br_prepend_prefix ("", "/bin")))
+ #define SBINDIR (br_thread_local_store (br_prepend_prefix ("", "/sbin")))
+ #define DATADIR (br_thread_local_store (br_prepend_prefix ("", "/share")))
+ #define LIBDIR (br_thread_local_store (br_prepend_prefix ("", "/lib")))
+ #define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ("", "/libexec")))
+ #define ETCDIR (br_thread_local_store (br_prepend_prefix ("", "/etc")))
+ #define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ("", "/etc")))
+ #define CONFDIR (br_thread_local_store (br_prepend_prefix ("", "/etc")))
+ #define LOCALEDIR (br_thread_local_store (br_prepend_prefix ("", "/share/locale")))
#endif /* BR_NO_MACROS */
@@ -78,9 +78,9 @@
and shouldn't be used directly in applications. */
const char *br_thread_local_store (char *str);
-char *br_locate (void *symbol);
-char *br_locate_prefix (void *symbol);
-char *br_prepend_prefix (void *symbol, char *path);
+char *br_locate (const char *symbol);
+char *br_locate_prefix (const char *symbol);
+char *br_prepend_prefix (const char *symbol, const char *path);
#endif /* ENABLE_BINRELOC */
Index: kaffe/kaffe/kaffe/main.c
diff -u kaffe/kaffe/kaffe/main.c:1.67 kaffe/kaffe/kaffe/main.c:1.68
--- kaffe/kaffe/kaffe/main.c:1.67 Thu Dec 9 05:19:32 2004
+++ kaffe/kaffe/kaffe/main.c Fri Dec 10 00:37:21 2004
@@ -287,14 +287,14 @@
cls = (*env)->FindClass(env, "java/lang/String");
if (checkException())
goto done;
- args = (*env)->NewObjectArray(env, (unsigned)argc, cls, 0);
+ args = (*env)->NewObjectArray(env, argc, cls, 0);
if (checkException())
goto done;
for (i = 0; i < argc; i++) {
str = (*env)->NewStringUTF(env, argv[farg+i]);
if (checkException())
goto done;
- (*env)->SetObjectArrayElement(env, args, (unsigned)i, str);
+ (*env)->SetObjectArrayElement(env, args, i, str);
if (checkException())
goto done;
}
@@ -382,7 +382,7 @@
*/
static
userProperty*
-setKaffeAWT(char * propStr)
+setKaffeAWT(const char * propStr)
{
char *newbootcpath;
unsigned int bootcpathlength;
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.39 kaffe/kaffe/kaffevm/stackTrace.c:1.40
--- kaffe/kaffe/kaffevm/stackTrace.c:1.39 Sun Oct 31 14:35:32 2004
+++ kaffe/kaffe/kaffevm/stackTrace.c Fri Dec 10 00:37:21 2004
@@ -292,6 +292,6 @@
}
}
if (p != 0 || !nullOK) {
- do_execute_java_method(p, "flush", "()V", 0, 0);
+ do_execute_java_method(NULL, p, "flush", "()V", 0, 0);
}
}
Index: kaffe/kaffe/kaffevm/support.c
diff -u kaffe/kaffe/kaffevm/support.c:1.76 kaffe/kaffe/kaffevm/support.c:1.77
--- kaffe/kaffe/kaffevm/support.c:1.76 Wed Dec 8 07:22:07 2004
+++ kaffe/kaffe/kaffevm/support.c Fri Dec 10 00:37:22 2004
@@ -65,10 +65,9 @@
*
* @return the return value of the method to be called
*/
-jvalue
-do_execute_java_method_v(void* obj, const char* method_name, const char* signature, Method* mb, int isStaticCall, va_list argptr)
+void
+do_execute_java_method_v(jvalue *retval, void* obj, const char* method_name, const char* signature, Method* mb, int isStaticCall, va_list argptr)
{
- jvalue retval;
errorInfo info;
if (obj == 0 && (! isStaticCall || ! mb)) {
@@ -76,7 +75,8 @@
}
if (mb == 0) {
- assert(method_name != 0 && signature != 0);
+ assert(method_name != NULL);
+ assert(signature != NULL);
if (isStaticCall) {
mb = lookupClassMethod((Hjava_lang_Class*)obj, method_name, signature, &info);
}
@@ -96,9 +96,7 @@
throwException(NoSuchMethodError(method_name));
}
- callMethodV(mb, METHOD_NATIVECODE(mb), obj, argptr, &retval);
-
- return (retval);
+ callMethodV(mb, METHOD_NATIVECODE(mb), obj, argptr, retval);
}
/**
@@ -113,19 +111,16 @@
*
* @return the return value of the method to be called
*/
-jvalue
-do_execute_java_method(void* obj, const char* method_name, const char* signature, Method* mb, int isStaticCall, ...)
+void
+do_execute_java_method(jvalue *retval, void* obj, const char* method_name, const char* signature, Method* mb, int isStaticCall, ...)
{
va_list argptr;
- jvalue retval;
assert(method_name != 0 || mb != 0);
va_start(argptr, isStaticCall);
- retval = do_execute_java_method_v(obj, method_name, signature, mb, isStaticCall, argptr);
+ do_execute_java_method_v(retval, obj, method_name, signature, mb, isStaticCall, argptr);
va_end(argptr);
-
- return (retval);
}
/**
@@ -141,15 +136,14 @@
*
* @return the return value of the method
*/
-jvalue
-do_execute_java_class_method_v(const char* cname,
+void
+do_execute_java_class_method_v(jvalue *retval, const char* cname,
Hjava_lang_ClassLoader* loader, const char* method_name,
const char* signature, va_list argptr)
{
Hjava_lang_Class* clazz;
errorInfo info;
Method* mb = 0;
- jvalue retval;
char *buf;
/* Convert "." to "/" and lookup class */
@@ -172,9 +166,7 @@
}
/* Make the call */
- callMethodV(mb, METHOD_NATIVECODE(mb), 0, argptr, &retval);
-
- return (retval);
+ callMethodV(mb, METHOD_NATIVECODE(mb), 0, argptr, retval);
}
/**
@@ -188,18 +180,15 @@
*
* @return the return value of the method
*/
-jvalue
-do_execute_java_class_method(const char* cname, Hjava_lang_ClassLoader*loader,
+void
+do_execute_java_class_method(jvalue *retval, const char* cname, Hjava_lang_ClassLoader*loader,
const char* method_name, const char* signature, ...)
{
va_list argptr;
- jvalue retval;
va_start(argptr, signature);
- retval = do_execute_java_class_method_v(cname, loader, method_name, signature, argptr);
+ do_execute_java_class_method_v(retval, cname, loader, method_name, signature, argptr);
va_end(argptr);
-
- return (retval);
}
/**
Index: kaffe/kaffe/kaffevm/support.h
diff -u kaffe/kaffe/kaffevm/support.h:1.35 kaffe/kaffe/kaffevm/support.h:1.36
--- kaffe/kaffe/kaffevm/support.h:1.35 Wed Dec 8 07:22:08 2004
+++ kaffe/kaffe/kaffevm/support.h Fri Dec 10 00:37:23 2004
@@ -108,10 +108,10 @@
struct Hjava_lang_ClassLoader;
extern const char* getEngine(void);
-extern jvalue do_execute_java_method(void*, const char*, const char*, struct _methods*, int, ...);
-extern jvalue do_execute_java_method_v(void*, const char*, const char*, struct _methods*, int, va_list);
-extern jvalue do_execute_java_class_method(const char*, struct Hjava_lang_ClassLoader*, const char*, const char*, ...);
-extern jvalue do_execute_java_class_method_v(const char*, struct Hjava_lang_ClassLoader*, const char*, const char*, va_list);
+extern void do_execute_java_method(jvalue *retval, void*, const char*, const char*, struct _methods*, int, ...);
+extern void do_execute_java_method_v(jvalue *retval, void*, const char*, const char*, struct _methods*, int, va_list);
+extern void do_execute_java_class_method(jvalue *retval, const char*, struct Hjava_lang_ClassLoader*, const char*, const char*, ...);
+extern void do_execute_java_class_method_v(jvalue *retval, const char*, struct Hjava_lang_ClassLoader*, const char*, const char*, va_list);
extern struct Hjava_lang_Object* execute_java_constructor(const char*, struct Hjava_lang_ClassLoader*, struct Hjava_lang_Class*, const char*, ...);
extern struct Hjava_lang_Object* execute_java_constructor_v(const char*, struct Hjava_lang_ClassLoader*, struct Hjava_lang_Class*, const char*, va_list);
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.80 kaffe/kaffe/kaffevm/thread.c:1.81
--- kaffe/kaffe/kaffevm/thread.c:1.80 Sun Oct 31 14:35:32 2004
+++ kaffe/kaffe/kaffevm/thread.c Fri Dec 10 00:37:23 2004
@@ -207,6 +207,7 @@
attachFakedThreadInstance(const char* nm, int isDaemon)
{
Hjava_lang_Thread* tid;
+ jvalue retval;
int i;
DBG(VMTHREAD, dprintf("attachFakedThreadInstance(%s)\n", nm); )
@@ -250,14 +251,14 @@
* must not be done earlier, since getCurrentThread() won't work
* before the jthread_createfirst and the jthreadID assignment
*/
- unhand(tid)->contextClassLoader = (struct Hjava_lang_ClassLoader *)
- do_execute_java_class_method ("kaffe/lang/AppClassLoader",
+ do_execute_java_class_method (&retval, "kaffe/lang/AppClassLoader",
NULL,
"getSingleton",
- "()Ljava/lang/ClassLoader;").l;
+ "()Ljava/lang/ClassLoader;");
+ unhand(tid)->contextClassLoader = (struct Hjava_lang_ClassLoader *) retval.l;
/* Attach thread to threadGroup */
- do_execute_java_method(unhand(tid)->group, "addThread", "(Ljava/lang/Thread;)V", 0, 0, tid);
+ do_execute_java_method(NULL, unhand(tid)->group, "addThread", "(Ljava/lang/Thread;)V", 0, 0, tid);
DBG(VMTHREAD, dprintf("attachFakedThreadInstance(%s)=%p done\n", nm, tid); )
}
@@ -313,6 +314,7 @@
jthread_t nativeTid;
Hjava_lang_String* name;
void *specialArgument[3];
+ jvalue retval;
DBG(VMTHREAD, dprintf("createDaemon %s\n", nm); )
@@ -332,11 +334,11 @@
unhand(vmtid)->thread = tid;
unhand(vmtid)->running = true;
- unhand(tid)->contextClassLoader = (struct Hjava_lang_ClassLoader *)
- do_execute_java_class_method ("java/lang/ClassLoader",
+ do_execute_java_class_method (&retval, "java/lang/ClassLoader",
NULL,
"getSystemClassLoader",
- "()Ljava/lang/ClassLoader;").l;
+ "()Ljava/lang/ClassLoader;");
+ unhand(tid)->contextClassLoader = (struct Hjava_lang_ClassLoader *) retval.l;
specialArgument[0] = func;
specialArgument[1] = arg;
@@ -568,7 +570,7 @@
}
/* Do java-land cleanup */
- do_execute_java_method(SystemClass, "exitJavaCleanup",
+ do_execute_java_method(NULL, SystemClass, "exitJavaCleanup",
"()V", NULL, true);
if (runFinalizerOnExit) {
invokeFinalizer();
Index: kaffe/kaffe/kaffevm/jni/jni.c
diff -u kaffe/kaffe/kaffevm/jni/jni.c:1.9 kaffe/kaffe/kaffevm/jni/jni.c:1.10
--- kaffe/kaffe/kaffevm/jni/jni.c:1.9 Sat Nov 6 01:31:40 2004
+++ kaffe/kaffe/kaffevm/jni/jni.c Fri Dec 10 00:37:23 2004
@@ -221,7 +221,7 @@
{
jstring nameString;
Utf8Const* utf8;
- jobject retval;
+ jvalue retval;
BEGIN_EXCEPTION_HANDLING(0);
@@ -231,12 +231,12 @@
utf8ConstRelease(utf8);
checkPtr(nameString);
- retval = do_execute_java_class_method("java.lang.Class", NULL,
- "forName", "(Ljava/lang/String;)Ljava/lang/Class;", nameString).l;
- ADD_REF(retval);
+ do_execute_java_class_method(&retval, "java.lang.Class", NULL,
+ "forName", "(Ljava/lang/String;)Ljava/lang/Class;", nameString);
+ ADD_REF(retval.l);
END_EXCEPTION_HANDLING();
- return (retval);
+ return (retval.l);
}
static jclass
@@ -337,7 +337,7 @@
BEGIN_EXCEPTION_HANDLING_VOID();
if (thread_data->exceptObj != 0) {
- do_execute_java_method(thread_data->exceptObj, "printStackTrace", "()V",
+ do_execute_java_method(NULL, thread_data->exceptObj, "printStackTrace", "()V",
0, 0, thread_data->exceptObj);
}
END_EXCEPTION_HANDLING();
Index: kaffe/libraries/clib/native/Arrays.c
diff -u kaffe/libraries/clib/native/Arrays.c:1.5 kaffe/libraries/clib/native/Arrays.c:1.6
--- kaffe/libraries/clib/native/Arrays.c:1.5 Sun Apr 18 13:57:29 2004
+++ kaffe/libraries/clib/native/Arrays.c Fri Dec 10 00:37:24 2004
@@ -157,7 +157,7 @@
const struct objcmpinfo *const o2 = (const struct objcmpinfo *) p2;
jvalue rtn;
- rtn = do_execute_java_method(o1->cmp, "compare",
+ do_execute_java_method(&rtn, o1->cmp, "compare",
"(Ljava/lang/Object;Ljava/lang/Object;)I",
0, false, o1->obj, o2->obj);
return rtn.i;
Index: kaffe/libraries/clib/net/NetworkInterface.c
diff -u kaffe/libraries/clib/net/NetworkInterface.c:1.9 kaffe/libraries/clib/net/NetworkInterface.c:1.10
--- kaffe/libraries/clib/net/NetworkInterface.c:1.9 Fri May 28 13:40:13 2004
+++ kaffe/libraries/clib/net/NetworkInterface.c Fri Dec 10 00:37:24 2004
@@ -78,6 +78,7 @@
getInetAddress(struct ifaddrs *ifa)
{
struct Hjava_lang_String *address_string = NULL;
+ jvalue jvalue;
struct Hjava_net_InetAddress *retval = NULL;
if( ifa )
@@ -113,10 +114,12 @@
}
}
}
- if (address_string)
- retval = (struct Hjava_net_InetAddress *)do_execute_java_class_method
- ("java/net/InetAddress", 0, "getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;",
- address_string).l;
+ if (address_string) {
+ do_execute_java_class_method
+ (&jvalue, "java/net/InetAddress", 0, "getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;",
+ address_string);
+ retval = (struct Hjava_net_InetAddress *)jvalue.l;
+ }
return( retval );
}
@@ -142,7 +145,8 @@
if (addr != NULL)
{
do_execute_java_method
- (vector,
+ (NULL,
+ vector,
"add",
"(Ljava/lang/Object;)Z",
0,
Index: kaffe/libraries/clib/net/PlainSocketImpl.c
diff -u kaffe/libraries/clib/net/PlainSocketImpl.c:1.46 kaffe/libraries/clib/net/PlainSocketImpl.c:1.47
--- kaffe/libraries/clib/net/PlainSocketImpl.c:1.46 Wed Sep 15 09:25:51 2004
+++ kaffe/libraries/clib/net/PlainSocketImpl.c Fri Dec 10 00:37:24 2004
@@ -392,6 +392,7 @@
HArrayOfByte *remote_addr;
struct Hgnu_java_net_PlainSocketImpl* accepted_socket =
(struct Hgnu_java_net_PlainSocketImpl *)sock;
+ jvalue jvalue;
remote_addr = NULL;
memset(&addr, 0, sizeof(addr));
@@ -467,11 +468,12 @@
}
/* and use that byte array to create an appropriate Inet*Address instance */
- unhand(sock)->address = do_execute_java_class_method ("java.net.InetAddress",
+ do_execute_java_class_method (&jvalue, "java.net.InetAddress",
0,
"getByAddress",
"([B)Ljava/net/InetAddress;",
- remote_addr).l;
+ remote_addr);
+ unhand(sock)->address = jvalue.l;
unhand(sock)->port = ntohs(addr.sin_port);
alen = sizeof(addr);
More information about the kaffe
mailing list