[kaffe] warning hunt
Nektarios K. Papadopoulos
npapadop@inaccessnetworks.com
Wed Apr 7 01:11:02 2004
This is a multi-part message in MIME format.
--------------050900000106030203040308
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Adam Heath wrote:
> I've checked in your patch. Be careful doing fixes to verify.c(and friends).
> I've got several fixes locally, but not checked in, as there are several
> cascading issues. I can cope if you send me changes, tho, that are small and
> isolated.
Thanks and sorry for the reckless copy-paste in the prototypes in
stackTrace.h
I fixed them and moved them in stackTrace.c (stackTrace.diff attached)
I also fixed several 'unreachable-code' and a few 'sign-compare' in
code-analyse.c (code-analyse.diff attached).
I also tried to resolve the 13 warnings:
'passing arg xxx of `xxxxxxxxx' with different width due to prototype'
but I just got confused! It seems that this warning is raised for any
prototyped function with argument that require conversion other than the
default. Quoting the gcc man page:
[[[[
Warn if a prototype causes a type conversion that is different from
what would happen to the same argument in the absence of a prototype.
]]]]
Passing literals or variables of the exact type (i.e. constIndex) to
arg 1 of getField for example still raises the warning.
Maybe we should just ignore this warnings?
Or should all functions accept arguments of the default width (int ????)
and cast / convert / check limits locally ?
>>BTW scripts/sort-warnings.pl warning count:
>>before: Total Errors: 1493
>>after : Total Errors: 1388
>
>
> It'd be nice if you used gcc 3.3, as it outputs many more warnings.
Using
> anything before this, might output warnings that the script doesn't
check for,
> and might not output warnings that are actual problems.
I am using gcc 3.3.3 , I just don't compile everything (no awt, no
sound), thus the low warning count
cheers
nek
--------------050900000106030203040308
Content-Type: text/plain;
name="stackTrace.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="stackTrace.diff"
Index: kaffe/kaffevm/stackTrace.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/stackTrace.c,v
retrieving revision 1.33
diff -u -r1.33 stackTrace.c
--- kaffe/kaffevm/stackTrace.c 3 Apr 2004 00:06:10 -0000 1.33
+++ kaffe/kaffevm/stackTrace.c 6 Apr 2004 10:23:56 -0000
@@ -43,6 +43,8 @@
static Method*
stacktraceFindMethod (uintp fp, uintp pc);
+HArrayOfObject* getStackTraceElements(struct Hjava_lang_VMThrowable*, struct Hjava_lang_Throwable*);
+void printStackTrace(struct Hjava_lang_Throwable*, struct Hjava_lang_Object*, int);
Hjava_lang_Object*
buildStackTrace(struct _exceptionFrame* base)
--------------050900000106030203040308
Content-Type: text/plain;
name="code-analyse.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="code-analyse.diff"
Index: kaffe/kaffevm/code-analyse.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/code-analyse.c,v
retrieving revision 1.39
diff -u -r1.39 code-analyse.c
--- kaffe/kaffevm/code-analyse.c 22 Sep 2003 15:31:24 -0000 1.39
+++ kaffe/kaffevm/code-analyse.c 6 Apr 2004 10:25:29 -0000
@@ -261,7 +261,7 @@
/* Setup exception info. */
sp = meth->localsz + meth->stacksz - 1;
if (meth->exception_table != 0) {
- for (lcl = 0; lcl < meth->exception_table->length; lcl++) {
+ for (lcl = 0; lcl < (int32)meth->exception_table->length; lcl++) {
bool succ;
jexceptionEntry *entry;
@@ -428,9 +428,9 @@
* the handler.
*/
if (meth->exception_table != 0) {
- for (idx = 0; idx < meth->exception_table->length; idx++) {
- if (pc >= meth->exception_table->entry[idx].start_pc && pc < meth->exception_table->entry[idx].end_pc) {
- FRAMEMERGE_LOCALS(meth->exception_table->entry[idx].handler_pc);
+ for (idx = 0; idx < (int32)meth->exception_table->length; idx++) {
+ if (pc >= (int32)meth->exception_table->entry[idx].start_pc && pc < (int32)meth->exception_table->entry[idx].end_pc) {
+ FRAMEMERGE_LOCALS((int32)(meth->exception_table->entry[idx].handler_pc));
}
}
}
@@ -1396,8 +1396,7 @@
case GETSTATIC:
if (getField(WORD(pc+1), meth->class, true, &finfo, einfo) == 0) {
if (!checkNoClassDefFoundError(einfo)) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
switch (finfo.signature->data[0]){
@@ -1438,8 +1437,7 @@
case PUTSTATIC:
if (getField(WORD(pc+1), meth->class, true, &finfo, einfo) == 0) {
if (!checkNoClassDefFoundError(einfo)) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
switch (finfo.signature->data[0]){
@@ -1479,8 +1477,7 @@
case GETFIELD:
if (getField(WORD(pc+1), meth->class, false, &finfo, einfo) == 0) {
- failed = true;
- goto done;
+ goto done_fail;
}
STACKIN(0, TOBJ);
if (!FIELD_ISPRIM(finfo.field)) {
@@ -1516,8 +1513,7 @@
case PUTFIELD:
if (getField(WORD(pc+1), meth->class, false, &finfo, einfo) == 0) {
- failed = true;
- goto done;
+ goto done_fail;
}
if (!FIELD_ISPRIM(finfo.field)) {
STACKIN(0, TOBJ);
@@ -1562,8 +1558,7 @@
case INVOKESPECIAL:
if (getMethodSignatureClass(WORD(pc+1), meth->class, true, false, &call, einfo) == false) {
if (!checkNoClassDefFoundError(einfo) || call.signature == 0) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
@@ -1665,8 +1660,7 @@
case INVOKEINTERFACE:
if (getMethodSignatureClass(WORD(pc+1), meth->class, true, false, &call, einfo) == false) {
if (!checkNoClassDefFoundError(einfo) || call.signature == 0) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
@@ -1767,8 +1761,7 @@
case INVOKESTATIC:
if (getMethodSignatureClass(WORD(pc+1), meth->class, true, false, &call, einfo) == false) {
if (!checkNoClassDefFoundError(einfo) || call.signature == 0) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
@@ -1867,8 +1860,7 @@
case NEW:
if (getClass(WORD(pc+1), meth->class, einfo) == 0) {
if (!checkNoClassDefFoundError(einfo)) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
STKPUSH(1);
@@ -1885,8 +1877,7 @@
case ANEWARRAY:
if (getClass(WORD(pc+1), meth->class, einfo) == 0) {
if (!checkNoClassDefFoundError(einfo)) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
STACKIN(0, TINT);
@@ -1897,8 +1888,7 @@
case MULTIANEWARRAY:
if (getClass(WORD(pc+1), meth->class, einfo) == 0) {
if (!checkNoClassDefFoundError(einfo)) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
for (idx = INSN(pc+3) - 1; idx >= 0; idx--) {
@@ -1924,8 +1914,7 @@
case CHECKCAST:
if (getClass(WORD(pc+1), meth->class, einfo) == 0) {
if (!checkNoClassDefFoundError(einfo)) {
- failed = true;
- goto done;
+ goto done_fail;
}
}
STACKIN(0, TOBJ);
@@ -1936,8 +1925,6 @@
case INSTANCEOF:
if (getClass(WORD(pc+1), meth->class, einfo) == 0) {
if (!checkNoClassDefFoundError(einfo)) {
- failed = true;
- goto done;
}
}
STACKIN(0, TOBJ);
@@ -1989,6 +1976,10 @@
KFREE(activeFrame);
return (failed);
+
+done_fail:
+ failed = true;
+ goto done;
}
/*
--------------050900000106030203040308--