[kaffe] CVS kaffe (dalibor): Fixed some compiler warnings with -pedantic

Kaffe CVS cvs-commits at kaffe.org
Sun Nov 2 21:32:02 PST 2003


PatchSet 4154 
Date: 2003/11/03 05:29:28
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixed some compiler warnings with -pedantic

Members: 
	ChangeLog:1.1746->1.1747 
	include/jni.h:1.23->1.24 
	include/jvmpi.h:1.3->1.4 
	kaffe/kaffeh/support.c:1.32->1.33 
	kaffe/kaffevm/access.h:1.8->1.9 
	kaffe/kaffevm/classMethod.c:1.112->1.113 
	kaffe/kaffevm/classMethod.h:1.61->1.62 
	kaffe/kaffevm/constants.h:1.7->1.8 
	kaffe/kaffevm/jni.c:1.96->1.97 
	kaffe/kaffevm/stringParsing.h:1.1->1.2 
	kaffe/kaffevm/verify.c:1.28->1.29 
	kaffe/kaffevm/verify.h:1.5->1.6 
	kaffe/kaffevm/intrp/machine.c:1.33->1.34 
	kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.102->1.103 
	libraries/clib/io/FileDescriptor.c:1.8->1.9 
	libraries/clib/native/ClassLoader.c:1.36->1.37 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1746 kaffe/ChangeLog:1.1747
--- kaffe/ChangeLog:1.1746	Mon Nov  3 04:25:47 2003
+++ kaffe/ChangeLog	Mon Nov  3 05:29:28 2003
@@ -1,3 +1,24 @@
+2003-11-03  Dalibor Topic  <robilad at kaffe.org>
+
+	* include/jni.h,
+	kaffe/kaffevm/constants.h,
+	kaffe/kaffevm/classMethod.c,
+	kaffe/kaffevm/jni.c,
+	kaffe/kaffevm/intrp/machine.c,
+	kaffe/kaffevm/systems/unix-jthreads/jthread.c,
+	kaffe/kaffevm/verify.h,
+	kaffe/kaffevm/verify.c,
+	kaffe/kaffeh/support.c,
+	libraries/clib/io/FileDescriptor.c,
+	libraries/clib/native/ClassLoader.c:
+	Changed C++ comments to C comments to fix -pedantic warnings.
+
+	* kaffe/kaffevm/access.h,
+	kaffe/kaffevm/classMethod.c,
+	kaffe/kaffevm/stringParsing.h,
+	include/jvmpi.h:
+	Removed comma at end of enumerator list.
+	
 2003-11-03  Dalibor Topic <robilad at kaffe.org>
 
 	Fixed build with kjc.
Index: kaffe/include/jni.h
diff -u kaffe/include/jni.h:1.23 kaffe/include/jni.h:1.24
--- kaffe/include/jni.h:1.23	Sat Oct 25 12:52:39 2003
+++ kaffe/include/jni.h	Mon Nov  3 05:29:29 2003
@@ -76,26 +76,26 @@
 	jint	(*GetVersion)			(JNIEnv*);
 	jclass	(*DefineClass)			(JNIEnv*, jobject, const jbyte*, jsize);
 	jclass	(*FindClass)			(JNIEnv*, const char*);
-	void*	reserved4; // FromReflectedMethod
-	void*	reserved5; // FromReflectedField
-	void*	reserved6; // ToReflectedMethod
+        void*	reserved4; /* FromReflectedMethod */
+        void*	reserved5; /* FromReflectedField */
+        void*	reserved6; /* ToReflectedMethod */
 	jclass	(*GetSuperclass)		(JNIEnv*, jclass);
 	jboolean	(*IsAssignableFrom)		(JNIEnv*, jclass, jclass);
-	void*	reserved7; // ToReflectedField
+        void*	reserved7; /* ToReflectedField */
 	jint	(*Throw)			(JNIEnv*, jobject);
 	jint	(*ThrowNew)			(JNIEnv*, jclass, const char*);
 	jthrowable (*ExceptionOccurred)		(JNIEnv*);
 	void	(*ExceptionDescribe)		(JNIEnv*);
 	void	(*ExceptionClear)		(JNIEnv*);
 	void	(*FatalError)			(JNIEnv*, const char*);
-	void*	reserved8; // PushLocalFrame
-	void*	reserved9; // PopLocalFrame
+        void*	reserved8; /* PushLocalFrame */
+        void*	reserved9; /* PopLocalFrame */
 	jref	(*NewGlobalRef)			(JNIEnv*, jref);
 	void	(*DeleteGlobalRef)		(JNIEnv*, jref);
 	void	(*DeleteLocalRef)		(JNIEnv*, jref);
 	jboolean	(*IsSameObject)			(JNIEnv*, jobject, jobject);
-	void*	reserved10; // NewLocalRef
-	void*	reserved11; // EnsureLocalCapacity
+        void*	reserved10; /* NewLocalRef */
+        void*	reserved11; /* EnsureLocalCapacity */
 	jobject	(*AllocObject)			(JNIEnv*, jclass);
 	jobject	(*NewObject)			(JNIEnv*, jclass, jmethodID, ...);
 	jobject	(*NewObjectV)			(JNIEnv*, jclass, jmethodID, va_list);
@@ -290,23 +290,23 @@
 	jint	(*MonitorExit)			(JNIEnv*, jobject);
 	jint	(*GetJavaVM)			(JNIEnv*, JavaVM**);
 
-	// New JNI 1.2 functions
+        /* New JNI 1.2 functions */
 	
-	void* reserved12; // GetStringRegion
-	void* reserved13; // GetStringUTFRegion
-	void* reserved14; // GetPrimitiveArrayCritical
-	void* reserved15; // ReleasePromitiveArrayCritical
-	void* reserved16; // GetStringCritical
-	void* reserved17; // ReleaseStringCritical
-	void* reserved18; // NewWeakGlobalRef
-	void* reserved19; // DeleteWeakGlobalRef
+        void* reserved12; /* GetStringRegion */
+        void* reserved13; /* GetStringUTFRegion */
+        void* reserved14; /* GetPrimitiveArrayCritical */
+        void* reserved15; /* ReleasePromitiveArrayCritical */
+        void* reserved16; /* GetStringCritical */
+        void* reserved17; /* ReleaseStringCritical */
+        void* reserved18; /* NewWeakGlobalRef */
+        void* reserved19; /* DeleteWeakGlobalRef */
 	jboolean	(*ExceptionCheck)	(JNIEnv*);
 
-	// New JNI 1.4 functions
+        /* New JNI 1.4 functions */
 	
-	void* reserved20; // NewDirectByteBuffer
-	void* reserved21; // GetDirectBufferAddress
-	void* reserved22; // GetDirectBufferCapacity
+        void* reserved20; /* NewDirectByteBuffer */
+        void* reserved21; /* GetDirectBufferAddress */
+        void* reserved22; /* GetDirectBufferCapacity */
 };
 
 struct JavaVMAttachArgs {
@@ -327,7 +327,7 @@
 	jint	(*AttachCurrentThread)		(JavaVM*, void**, ThreadAttachArgs*);
 	jint	(*DetachCurrentThread)		(JavaVM*);
 	jint	(*GetEnv)			(JavaVM*, void**, jint);
-	void*	reserved3; // AttachCurrentThreadAsDaemon
+        void*	reserved3; /* AttachCurrentThreadAsDaemon */
 };
 
 struct JNIEnv_ {
Index: kaffe/include/jvmpi.h
diff -u kaffe/include/jvmpi.h:1.3 kaffe/include/jvmpi.h:1.4
--- kaffe/include/jvmpi.h:1.3	Sat Oct 11 20:45:48 2003
+++ kaffe/include/jvmpi.h	Mon Nov  3 05:29:30 2003
@@ -9,24 +9,24 @@
 enum {
 	JVMPI_FAIL = -1,
 	JVMPI_SUCCESS,
-	JVMPI_NOT_AVAILABLE,
+	JVMPI_NOT_AVAILABLE
 };
 
 enum {
 	JVMPI_THREAD_RUNNABLE = 1,
 	JVMPI_THREAD_MONITOR_WAIT,
-	JVMPI_THREAD_CONDVAR_WAIT,
+	JVMPI_THREAD_CONDVAR_WAIT
 };
 
 enum {
 	JVMPI_THREAD_INTERRUPTED = 0x4000,
-	JVMPI_THREAD_SUSPENDED = 0x8000,
+	JVMPI_THREAD_SUSPENDED = 0x8000
 };
 
 enum {
 	JVMPI_MINIMUM_PRIORITY = 1,
 	JVMPI_NORMAL_PRIORITY = 5,
-	JVMPI_MAXIMUM_PRIORITY = 10,
+	JVMPI_MAXIMUM_PRIORITY = 10
 };
 
 enum {
@@ -90,7 +90,7 @@
 enum {
 	JVMPI_DUMP_LEVEL_0,
 	JVMPI_DUMP_LEVEL_1,
-	JVMPI_DUMP_LEVEL_2,
+	JVMPI_DUMP_LEVEL_2
 };
 
 enum {
@@ -103,7 +103,7 @@
 	JVMPI_BYTE = 8,
 	JVMPI_SHORT = 9,
 	JVMPI_INT = 10,
-	JVMPI_LONG = 11,
+	JVMPI_LONG = 11
 };
 
 enum {
@@ -121,12 +121,12 @@
 	JVMPI_GC_OBJ_ARRAY_DUMP,
 	JVMPI_GC_PRIM_ARRAY_DUMP,
 	
-	JVMPI_GC_ROOT_UNKNOWN = 0xff,
+	JVMPI_GC_ROOT_UNKNOWN = 0xff
 };
 
 enum {
 	JVMPI_MONITOR_JAVA = 1,
-	JVMPI_MONITOR_RAW,
+	JVMPI_MONITOR_RAW
 };
 
 typedef struct {
Index: kaffe/kaffe/kaffeh/support.c
diff -u kaffe/kaffe/kaffeh/support.c:1.32 kaffe/kaffe/kaffeh/support.c:1.33
--- kaffe/kaffe/kaffeh/support.c:1.32	Wed Sep 24 17:50:23 2003
+++ kaffe/kaffe/kaffeh/support.c	Mon Nov  3 05:29:30 2003
@@ -876,7 +876,7 @@
 			classFileInit(&hand, buf, sbuf.st_size, CP_DIR);
 
 			objectDepth++;
-			//savepool = constant_pool;
+			/* savepool = constant_pool; */
 
 			memset(&tmpClass, 0, sizeof(tmpClass));
 			readClass(&tmpClass, &hand, NULL, &einfo);
@@ -915,12 +915,12 @@
 			classFileInit(&hand, buf, jentry->uncompressedSize, CP_ZIPFILE);
 
 			objectDepth++;
-			//savepool = constant_pool;
+			/* savepool = constant_pool; */
 
 			memset(&tmpClass, 0, sizeof(tmpClass));
 			readClass(&tmpClass, &hand, NULL, &einfo);
 
-			//constant_pool = savepool;
+			/* constant_pool = savepool; */
 			objectDepth--;
 
 			hand.type = CP_INVALID;
Index: kaffe/kaffe/kaffevm/access.h
diff -u kaffe/kaffe/kaffevm/access.h:1.8 kaffe/kaffe/kaffevm/access.h:1.9
--- kaffe/kaffe/kaffevm/access.h:1.8	Sun Aug 31 22:09:01 2003
+++ kaffe/kaffe/kaffevm/access.h	Mon Nov  3 05:29:31 2003
@@ -46,7 +46,7 @@
 	ACC_TYPE_METHOD,
 	ACC_TYPE_INTERFACE_METHOD,
 	ACC_TYPE_FIELD,
-	ACC_TYPE_INTERFACE_FIELD,
+	ACC_TYPE_INTERFACE_FIELD
 } access_type_t;
 
 struct Hjava_lang_Class;
Index: kaffe/kaffe/kaffevm/classMethod.c
diff -u kaffe/kaffe/kaffevm/classMethod.c:1.112 kaffe/kaffe/kaffevm/classMethod.c:1.113
--- kaffe/kaffe/kaffevm/classMethod.c:1.112	Sat Oct 11 20:45:49 2003
+++ kaffe/kaffe/kaffevm/classMethod.c	Mon Nov  3 05:29:31 2003
@@ -160,7 +160,7 @@
 				     JAVA_LANG(NoClassDefFoundError),
 				     "%s",
 				     class->name->data);
-		einfo->type |= KERR_NO_CLASS_FOUND; // for the verifier
+		einfo->type |= KERR_NO_CLASS_FOUND; /* for the verifier */
 		success = false;
 		goto done;
 	}
Index: kaffe/kaffe/kaffevm/classMethod.h
diff -u kaffe/kaffe/kaffevm/classMethod.h:1.61 kaffe/kaffe/kaffevm/classMethod.h:1.62
--- kaffe/kaffe/kaffevm/classMethod.h:1.61	Sun Aug 31 22:09:01 2003
+++ kaffe/kaffe/kaffevm/classMethod.h	Mon Nov  3 05:29:31 2003
@@ -38,7 +38,7 @@
 	CSTATE_DOING_SUPER,
 	CSTATE_USABLE,
 	CSTATE_DOING_INIT,
-	CSTATE_COMPLETE,
+	CSTATE_COMPLETE
 } class_state_t;
 
 struct _classEntry;
@@ -192,7 +192,7 @@
 	NMS_SEARCHING,
 	NMS_LOADING,
 	NMS_LOADED,
-	NMS_DONE,
+	NMS_DONE
 } name_mapping_state_t;
 
 /*
Index: kaffe/kaffe/kaffevm/constants.h
diff -u kaffe/kaffe/kaffevm/constants.h:1.7 kaffe/kaffe/kaffevm/constants.h:1.8
--- kaffe/kaffe/kaffevm/constants.h:1.7	Wed Jul  9 20:22:17 2003
+++ kaffe/kaffe/kaffevm/constants.h	Mon Nov  3 05:29:31 2003
@@ -1,5 +1,5 @@
 /*
- * constants.h
+ * cnstants.h
  * Manage constants.
  *
  * Copyright (c) 1996, 1997
@@ -59,7 +59,7 @@
 #define CLASS_NAME(idx, pool)                           ((uint16)pool->data[idx])
 #define CONST_STRING_NAME(idx, pool)                    CLASS_NAME(idx, pool)
 
-// the actual character string pointed to by the data
+/* the actual character string pointed to by the data */
 #define UNRESOLVED_CLASS_NAMED(idx, pool)               (WORD2UTF(pool->data[idx])->data)
 #define RESOLVED_CLASS_NAMED(idx, pool)                 ((CLASS_CLASS(idx, pool))->name->data)
 
@@ -80,7 +80,7 @@
 #define NAMEANDTYPE_NAME(idx, pool)                     ((uint16)pool->data[idx])
 #define NAMEANDTYPE_SIGNATURE(idx, pool)                ((uint16)(pool->data[idx] >> 16))
 
-// the actual character string pointed to by the data
+/* the actual character string pointed to by the data */
 #define NAMEANDTYPE_NAMED(idx, pool)                    (WORD2UTF(pool->data[NAMEANDTYPE_NAME(idx, pool)])->data)
 #define NAMEANDTYPE_SIGD(idx, pool)                     (WORD2UTF(pool->data[NAMEANDTYPE_SIGNATURE(idx, pool)])->data)
 
@@ -89,7 +89,7 @@
 #define METHODREF_NAME(idx, pool)                       FIELDREF_NAME(idx, pool)
 #define INTERFACEMETHODREF_NAME(idx, pool)              FIELDREF_NAME(idx, pool)
 
-// the actual character string pointed to by the data
+/* the actual character string pointed to by the data */
 #define FIELDREF_NAMED(idx, pool)                       (WORD2UTF(pool->data[FIELDREF_NAME(idx, pool)])->data)
 #define METHODREF_NAMED(idx, pool)                      FIELDREF_NAMED(idx, pool)
 #define INTERFACEMETHODREF_NAMED(idx, pool)             FIELDREF_NAMED(idx, pool)
@@ -98,12 +98,12 @@
 #define METHODREF_SIGNATURE(idx, pool)                  FIELDREF_SIGNATURE(idx, pool)
 #define INTERFACEMETHODREF_SIGNATURE(idx, pool)         FIELDREF_SIGNATURE(idx, pool)
 
-// aliases...make more sense in certain situations, like type checking
+/* aliases...make more sense in certain situations, like type checking */
 #define FIELDREF_TYPE(idx, pool)                        FIELDREF_SIGNATURE(idx, pool)
 #define METHODREF_TYPE(idx, pool)                       FIELDREF_TYPE(idx, pool)
 #define INTERFACEMETHODREF_TYPE(idx, pool)              FIELDREF_TYPE(idx, pool)
 
-// the actual character string pointed to by the data
+/* the actual character string pointed to by the data */
 #define FIELDREF_SIGD(idx, pool)                        (WORD2UTF(pool->data[FIELDREF_SIGNATURE(idx, pool)])->data)
 #define METHODREF_SIGD(idx, pool)                       FIELDREF_SIGD(idx, pool)
 #define INTERFACEMETHODREF_SIGD(idx, pool)              FIELDREF_SIGD(idx, pool)
Index: kaffe/kaffe/kaffevm/jni.c
diff -u kaffe/kaffe/kaffevm/jni.c:1.96 kaffe/kaffe/kaffevm/jni.c:1.97
--- kaffe/kaffe/kaffevm/jni.c:1.96	Thu Oct 30 21:22:56 2003
+++ kaffe/kaffe/kaffevm/jni.c	Mon Nov  3 05:29:31 2003
@@ -4466,7 +4466,7 @@
 	0,		/* Java stack size */
 	MIN_HEAPSIZE,	/* Min heap size */
 	MAX_HEAPSIZE,	/* Max heap size */
-	//	2,		/* Verify mode ... verify remote by default */
+	/*	2,	*/	/* Verify mode ... verify remote by default */
 	0,              /* Verify mode ... noverify by default */
 	".",		/* Classpath */
 	".",		/* Bootclasspath */
Index: kaffe/kaffe/kaffevm/stringParsing.h
diff -u kaffe/kaffe/kaffevm/stringParsing.h:1.1 kaffe/kaffe/kaffevm/stringParsing.h:1.2
--- kaffe/kaffe/kaffevm/stringParsing.h:1.1	Fri Apr 25 21:35:34 2003
+++ kaffe/kaffe/kaffevm/stringParsing.h	Mon Nov  3 05:29:31 2003
@@ -108,7 +108,7 @@
 	/* (int *) Increment the counter on each value found */
 	SPO_Count,
 	/* () Skip any preceding white space. */
-	SPO_SkipSpace,
+	SPO_SkipSpace
 };
 
 #define SPO_MAX_ARG_COUNT 2
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.28 kaffe/kaffe/kaffevm/verify.c:1.29
--- kaffe/kaffe/kaffevm/verify.c:1.28	Mon Sep 22 15:31:24 2003
+++ kaffe/kaffe/kaffevm/verify.c	Mon Nov  3 05:29:31 2003
@@ -29,7 +29,7 @@
 #include "debug.h"
 #include "utf8const.h"
 
-// needed for pass 3
+/* needed for pass 3 */
 #include "bytecode.h"
 #include "itypes.h"
 #include "soft.h"
@@ -43,9 +43,10 @@
 static
 bool
 isTrustedClass(Hjava_lang_Class* class) {
-	// recall (from main.c): -verifyremote (default) ==> verifyMode = 2
-	//                       -verify                 ==> verifyMode = 3
-	//                       -noverify               ==> verifyMode = 0
+        /* recall (from main.c): -verifyremote (default) ==> verifyMode = 2
+	 *                       -verify                 ==> verifyMode = 3
+	 *                       -noverify               ==> verifyMode = 0
+	 */
 	return ((class->loader == 0 && (Kaffe_JavaVMArgs[0].verifyMode & 1) == 0) ||
 		(class->loader != 0 && (Kaffe_JavaVMArgs[0].verifyMode & 2) == 0));
 }
@@ -165,7 +166,7 @@
 	
 	DBG(VERIFY2, dprintf("        parsing method type descriptor: %s\n", sig); );
 	
-	// parse the type parameters
+	/* parse the type parameters */
 	for (sig++; sig && *sig != ')' && *sig != '\0'; sig = parseFieldTypeDescriptor(sig)) {
 		DBG(VERIFY2, dprintf("            parameter sig: %s\n", sig); );
 	}
@@ -198,7 +199,7 @@
 static bool checkMethodStaticConstraints(Method*, errorInfo*);
 static bool checkAbstractMethod(Method*, errorInfo*);
 
-// perhaps this should go in classMethod.[ch]...
+/* perhaps this should go in classMethod.[ch]... */
 static bool isMethodVoid(Method* method)
 {
 	char* sig = (char*)method->parsed_sig->signature->data;
@@ -344,16 +345,17 @@
 	
 	DBG(VERIFY2, dprintf("\nPass 2 Verifying class %s\n", CLASS_CNAME(class)); );
 	
-	
+#ifdef UNENFORCED_INTERFACE_RESTRICTIONS
 	/* this is commented out because Sun's Java runtime environment doesn't enforce the restrictions
 	 * placed upon interfaces by the specification.
 	 * GJC also doesn't follow this!
-	 *
+	 */
 	if (CLASS_IS_INTERFACE(class)) {
-		// JVML spec p. 96: if a class has ACC_INTERFACE flag set, it must also have
-		// ACC_ABSTRACT set and may have ACC_PUBLIC set.  it may not have any other flags
-		// (in the given table) set.
-		
+	        /* JVML spec p. 96: if a class has ACC_INTERFACE flag set, it must also have
+		 * ( ACC_ABSTRACT set and may have ACC_PUBLIC set.  it may not have any other flags
+		 * (in the given table) set.
+		 */
+
 		if (!CLASS_IS_ABSTRACT(class)) {
 			postExceptionMessage(einfo, JAVA_LANG(ClassFormatError),
 					     "interfaces must have their abstract flag set (in interface \"%s\")",
@@ -366,7 +368,7 @@
 			return(false);
 		}
 	}
-	*/
+#endif /* UNENFORCED_INTERFACE_RESTRICTIONS */
 
 	{
 		Field *fld;
@@ -380,8 +382,9 @@
 		}
 	}
 	
-	// java/lang/Object does not have a superclass, is not final, and is not an interface,
-	// so we skip all of those checks
+        /* java/lang/Object does not have a superclass, is not final, and is not an interface,
+	 * so we skip all of those checks
+	 */
 	if(strcmp(OBJECTCLASS, CLASS_CNAME(class))) {
 		if (class->superclass == NULL) {
 			/***********************************************************
@@ -402,9 +405,9 @@
 					     CLASS_CNAME(class->superclass));
 			return(false);
 		} else if (CLASS_IS_INTERFACE(class)) {
-			// we separate this from the rest of the method checking because the only requirement
-			// of methods in an interface is that they be public, abstract, and nothing else.
-			
+		        /* we separate this from the rest of the method checking because the only requirement
+			 * of methods in an interface is that they be public, abstract, and nothing else.
+			 */
 			Method* method;
 			int n;
 		
@@ -412,9 +415,10 @@
 			     n > 0;
 			     --n, ++method) {
 				
-				// if it's <clinit> (init_name) then it doesn't have to be public.
-				// compilers often insert a <clinit> function to initialize an
-				// interfaces public static fields, if there are any.
+			        /* if it's <clinit> (init_name) then it doesn't have to be public.
+				 * compilers often insert a <clinit> function to initialize an
+				 * interfaces public static fields, if there are any.
+				 */
 				if (strcmp(init_name->data, METHOD_NAMED(method))) {
 					if (!METHOD_IS_PUBLIC(method)) {
 						postExceptionMessage(einfo, JAVA_LANG(ClassFormatError),
@@ -432,7 +436,7 @@
 				}
 				
 				if (checkMethodStaticConstraints(method, einfo) == false) {
-					// something else is wrong...exception raised elsewhere
+				        /* something else is wrong...exception raised elsewhere */
 					return(false);
 				}
 			}
@@ -451,7 +455,7 @@
 			     n > 0;
 			     --n, ++curMethod) {
 			
-				// check static constraints on each method
+			        /* check static constraints on each method */
 			
 				if (METHOD_IS_CONSTRUCTOR(curMethod) && checkConstructor(curMethod, einfo) == false) {
 					return(false);
@@ -461,21 +465,21 @@
 			}
 			
 			
-			// cycle through superclass hiarchy and make sure final methods aren't overriden
+			/* cycle through superclass hiarchy and make sure final methods aren't overriden */
 			for (superclass = class->superclass; superclass != NULL; superclass = superclass->superclass) {
 				
-				// cycle through methods in current super class
+			        /* cycle through methods in current super class */
 				for (m = CLASS_NMETHODS(superclass), method = CLASS_METHODS(superclass);
 				     m > 0;
 				     --m, ++method) {
 					
 					if (METHOD_IS_FINAL(method) && !METHOD_IS_PRIVATE(method) &&
 					    
-					    // the following exceptions come from testing against Sun's JVM behavior
+					    /* the following exceptions come from testing against Sun's JVM behavior */
 					    (strcmp(init_name->data, METHOD_NAMED(method)) &&
 					     strcmp("this", METHOD_NAMED(method)))) {
 						
-						// make sure the method in question was not overriden in the current class
+					        /* make sure the method in question was not overriden in the current class */
 						for (n = CLASS_NMETHODS(class), curMethod = CLASS_METHODS(class);
 						     n > 0;
 						     --n, ++curMethod) {
@@ -510,7 +514,7 @@
 	 * This is the only section of pass 2 that was available
 	 * under Transvirtual, though even this has been modified.
 	 *********************************************************/
-	// error message for step 3
+	/* error message for step 3 */
 #define POOLERROR \
 	postExceptionMessage(einfo, JAVA_LANG(ClassFormatError), "malformed constant pool in class \"%s\"", CLASS_CNAME(class)); \
 	return (false)
@@ -518,7 +522,7 @@
 	
 	pool = CLASS_CONSTANTS(class);
 	
-	// Constant pool loaded - check it's integrity.
+        /* Constant pool loaded - check it's integrity. */
 	for (idx = 1; idx < pool->size; idx++) {
 		switch (pool->tags[idx]) {
 		case CONSTANT_Fieldref:
@@ -543,7 +547,7 @@
 			break;
 			
 			
-			// the following tags are always legal, so no furthur checks need be performed
+			/* the following tags are always legal, so no furthur checks need be performed */
 		case CONSTANT_Long:
 		case CONSTANT_Double:
 			idx++;
@@ -567,7 +571,7 @@
 			
 			
 		default:
-			// undefined tag
+		        /* undefined tag */
 			POOLERROR;
 			break;
 		}
@@ -590,7 +594,7 @@
 	 *   formed.
 	 **************************************************************/
 	
-	// Constant pool loaded - check the integrity of the type references
+	/* Constant pool loaded - check the integrity of the type references */
 	pool = CLASS_CONSTANTS(class);
 	for (idx = 1; idx < pool->size; idx++) {
 		switch (pool->tags[idx]) {
@@ -644,7 +648,7 @@
 			break;
 			
 		default:
-			// we'll never get here, because of pass 3
+		        /* we'll never get here, because of pass 3 */
 			postExceptionMessage(einfo, JAVA_LANG(InternalError),
 					     "step 4 of pass 2 verification has screwed up while processing class \"%s\"",
 					     CLASS_CNAME(class));
@@ -747,7 +751,7 @@
 			return(false);
 		}
 	} else if (!METHOD_IS_NATIVE(method)) {
-		// code length static constraints
+	        /* code length static constraints */
 		
 		if (METHOD_BYTECODE_LEN(method) == 0) {
 			postExceptionMessage(einfo, JAVA_LANG(ClassFormatError),
@@ -787,11 +791,11 @@
 			     METHOD_NAMED(method), _MSG); \
 	return(false)
 	
-	
+#ifdef ABSTRACT_METHOD_VS_ABSTRACT_CLASS	
 	/* This is commented out because Sun's verifier doesn't care if an abstract method
 	 * is in an abstract class.
-	 * 
-	// ensure that only abstract classes may have abstract methods
+	 */
+	 /* ensure that only abstract classes may have abstract methods */
 	if (!(CLASS_IS_INTERFACE(method->class) || CLASS_IS_ABSTRACT(method->class))) {
 		postExceptionMessage(einfo, JAVA_LANG(ClassFormatError),
 				     "in method \"%s.%s\": only abstract classes may have abstract methods",
@@ -799,10 +803,10 @@
 				     METHOD_NAMED(method));
 		return(false);
 	}
-	*/
+#endif /* ABSTRACT_METHOD_VS_ABSTRACT_CLASS */
 	
 	
-	// constructors cannot be abstract
+	/* constructors cannot be abstract */
 	if (METHOD_IS_CONSTRUCTOR(method)) {
 		if (CLASS_IS_INTERFACE(method->class)) {
 			postExceptionMessage(einfo, JAVA_LANG(ClassFormatError),
@@ -820,7 +824,7 @@
 	}
 	
 	
-	// ensure the abstract method has no code
+	/* ensure the abstract method has no code */
 	if (METHOD_BYTECODE_LEN(method) > 0) {
 		postExceptionMessage(einfo, JAVA_LANG(ClassFormatError),
 				     "in method \"%s.%s\": abstract methods cannot have a Code attribute",
@@ -830,7 +834,7 @@
 	}
 	
 	
-	// enforce access flag rules of the JVML spec. for abstract methods
+	/* enforce access flag rules of the JVML spec. for abstract methods */
 	if (METHOD_IS_PRIVATE(method))           { ABSTRACT_METHOD_ERROR("private");      }
 	else if (METHOD_IS_FINAL(method))        { ABSTRACT_METHOD_ERROR("final");        }
 	else if (METHOD_IS_NATIVE(method))       { ABSTRACT_METHOD_ERROR("native");       }
@@ -871,8 +875,8 @@
  *       code-analyze.c again later on.
  ************************************************************************************/
 
-// lengths in bytes of all the instructions
-// 16 rows of 16
+/* lengths in bytes of all the instructions */
+/* 16 rows of 16 */
 static const uint8 insnLen[256] = {
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
 	2, 3, 2, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 
@@ -893,8 +897,9 @@
 };
 
 
-// these retrieve the word (16 bits) or double world (32 bits) of bytecode starting
-// at pc = _PC
+/* these retrieve the word (16 bits) or double world (32 bits) of bytecode starting
+ * at pc = _PC
+ */
 #define	WORD(_CODE, _PC)  ((int16)( \
 			   (_CODE[(_PC)+0] << 8) | \
 			   (_CODE[(_PC)+1])))
@@ -905,9 +910,9 @@
 			   (_CODE[(_PC)+3])))
 
 
-//
-// types for type checking (pass 3b)
-//
+/*
+ * types for type checking (pass 3b)
+ */
 static Type  verify_UNSTABLE;
 static Type* TUNSTABLE = &verify_UNSTABLE;
 
@@ -923,8 +928,9 @@
 static Type  verify_DOUBLE;
 static Type* TDOUBLE = &verify_DOUBLE;
 
-// used for the second space of LONGs and DOUBLEs
-// in local variables or on the operand stack
+/* used for the second space of LONGs and DOUBLEs
+ * in local variables or on the operand stack
+ */
 static Type  _WIDE;
 static Type* TWIDE = &_WIDE;
 #define IS_WIDE(_TINFO) ((_TINFO)->data.class == TWIDE->data.class)
@@ -1020,8 +1026,8 @@
 static bool               verifyMethod(errorInfo* einfo, Method* method);
 static BlockInfo**        verifyMethod3a(errorInfo* einfo,
 					 Method* method,
-					 uint32* status,     // array of status info for all opcodes
-					 uint32* numBlocks); // number of basic blocks
+					 uint32* status,     /* array of status info for all opcodes */
+					 uint32* numBlocks); /* number of basic blocks */
 static bool               verifyMethod3b(errorInfo* einfo,
 					 const Method* method,
 					 const uint32* status,
@@ -1140,15 +1146,16 @@
 	bool success = true;
 	Method* method;
 	
-	// see if verification is turned on, and whether the class we're about to verify requires verification
-	//
-	// NOTE: we don't skip interfaces here because an interface may contain a <clinit> method with bytecode
+	/* see if verification is turned on, and whether the class we're about to verify requires verification
+	 *
+	 * NOTE: we don't skip interfaces here because an interface may contain a <clinit> method with bytecode
+	 */
 	if (isTrustedClass(class)) {
 		goto done;
 	}
 	
 	
-	// make sure it's initialized...we had some problems because of this
+	/* make sure it's initialized...we had some problems because of this */
 	einfo->type = 0;
 	
 	
@@ -1167,7 +1174,7 @@
 		DBG(VERIFY3, dprintf("\n  -----------------------------------\n  considering method %s%s\n",
 				     METHOD_NAMED(method), METHOD_SIGD(method)); );
 		
-		// if it's abstract or native, no verification necessary
+		/* if it's abstract or native, no verification necessary */
 		if (!(METHOD_IS_ABSTRACT(method) || METHOD_IS_NATIVE(method))) {
 			DBG(VERIFY3, dprintf("  verifying method %s\n", METHOD_NAMED(method)); );
 			
@@ -1205,12 +1212,13 @@
 bool
 verifyMethod(errorInfo *einfo, Method* method)
 {
-	// to save some typing, etc.
+        /* to save some typing, etc. */
 	int codelen  = METHOD_BYTECODE_LEN(method);
 	
-	uint32* status = NULL; // the status of each instruction...changed, visited, etc.
-                               // used primarily to help find the basic blocks initially
-	
+	uint32* status = NULL; /* the status of each instruction...changed, visited, etc.
+				* used primarily to help find the basic blocks initially
+				*/
+
 	SigStack* sigs = NULL;
 	
 	UninitializedType* uninits = NULL;
@@ -1222,8 +1230,9 @@
 	/**************************************************************************************************
 	 * Memory Management Macros
 	 **************************************************************************************************/
-	// to make sure we don't forget to unalloc anything...
-	// should be called during ANY EXIT FROM THIS METHOD
+	/* to make sure we don't forget to unalloc anything...
+	 * should be called during ANY EXIT FROM THIS METHOD
+	 */
 #define CLEANUP \
 	DBG(VERIFY3, dprintf("    cleaning up..."); ); \
 	KFREE(status); \
@@ -1255,12 +1264,12 @@
 	
         status   = checkPtr((char*)gc_malloc(codelen * sizeof(uint32), GC_ALLOC_VERIFIER));
 	
-	// find basic blocks and allocate memory for them
+	/* find basic blocks and allocate memory for them */
 	blocks = verifyMethod3a(einfo, method, status, &numBlocks);
 	if (!blocks) {
 		DBG(VERIFY3, dprintf("        some kinda error finding the basic blocks in pass 3a\n"); );
 		
-		// propagate error
+		/* propagate error */
 		FAIL;
 	}
 	
@@ -1269,14 +1278,14 @@
 	 * Prepare for data-flow analysis
 	 **************************************************************************************************/
 	
-	// load initial arguments into local variable array
+	/* load initial arguments into local variable array */
 	DBG(VERIFY3, dprintf("    about to load initial args...\n"); );
 	if (!loadInitialArgs(method, einfo, blocks[0], &sigs, &uninits)) {
-		// propagate error
+	        /* propagate error */
 		FAIL;
 	}
 	DBG(VERIFY3, {
-		// print out the local arguments
+	        /* print out the local arguments */
 		int n;
 		for(n = 0; n < method->localsz; n++) {
 			dprintf("        local %d: ", n);
@@ -1316,8 +1325,8 @@
 BlockInfo**
 verifyMethod3a(errorInfo* einfo,
 	       Method* method,
-	       uint32* status,    // array of status info for all opcodes
-	       uint32* numBlocks) // number of basic blocks
+	       uint32* status,    /* array of status info for all opcodes */
+	       uint32* numBlocks) /* number of basic blocks */
 {
 #define VERIFY_ERROR(_MSG) \
 	if (einfo->type == 0) { \
@@ -1353,7 +1362,7 @@
 		VERIFY_ERROR("branch out of method code"); \
 	}
 
-	// makes sure the index given for a local variable is within the correct index
+        /* makes sure the index given for a local variable is within the correct index */
 #define CHECK_LOCAL_INDEX(_N) \
 	if ((_N) >= method->localsz) { \
 		DBG(VERIFY3, \
@@ -1367,7 +1376,7 @@
 	
 	constants* pool     = CLASS_CONSTANTS(method->class);
 	
-	// used for looking at method signatures...
+	/* used for looking at method signatures... */
 	const char* sig;
 	
 	int codelen         = METHOD_BYTECODE_LEN(method);
@@ -1379,7 +1388,7 @@
 	int32 low, high;
 	
 	bool wide;
-	bool inABlock; // used when calculating the start/return address of each block
+	bool inABlock; /* used when calculating the start/return address of each block */
 	
 	uint32 blockCount  = 0;
 	BlockInfo** blocks = NULL;
@@ -1388,9 +1397,10 @@
 	DBG(VERIFY3, dprintf("    Verifier Pass 3a: checking static constraints and finding basic blocks...\n"); );
 	
 	
-	// find the start of every instruction and basic block to determine legal branches
-	//
-	// also, this makes sure that only legal instructions follow the WIDE instruction
+	/* find the start of every instruction and basic block to determine legal branches
+	 *
+	 * also, this makes sure that only legal instructions follow the WIDE instruction
+	 */
 	status[0] |= START_BLOCK;
 	wide = false;
 	pc = 0;
@@ -1498,12 +1508,13 @@
 			break;
 			
 			
-			// invokeinterface is a 5 byte instruction.  the first byte is the instruction.
-			// the next two are the index into the constant pool for the methodreference.
-			// the fourth is the number of parameters expected by the method, and the verifier
-			// must check that the actual method signature of the method to be invoked matches
-			// this number.  the 5th must be zero.  these are apparently present for historical
-			// reasons (yeah Sun :::smirk:::).
+			/* invokeinterface is a 5 byte instruction.  the first byte is the instruction.
+			 * the next two are the index into the constant pool for the methodreference.
+			 * the fourth is the number of parameters expected by the method, and the verifier
+			 * must check that the actual method signature of the method to be invoked matches
+			 * this number.  the 5th must be zero.  these are apparently present for historical
+			 * reasons (yeah Sun :::smirk:::).
+			 */
 		case INVOKEINTERFACE:
 			ENSURE_NON_WIDE;
 			
@@ -1549,7 +1560,7 @@
 				VERIFY_ERROR("multinewarray indexes a constant pool entry that is not type CONSTANT_Class or CONSTANT_ResolvedClass");
 			}
 			
-			// number of dimensions must be <= num dimensions of array type being created
+			/* number of dimensions must be <= num dimensions of array type being created */
 			sig = CLASS_NAMED(idx, pool);
 			newpc = code[pc + 3];
 			if (newpc == 0) {
@@ -1572,7 +1583,7 @@
 				VERIFY_ERROR("new indexes a constant pool entry that is not type CONSTANT_Class or CONSTANT_ResolvedClass");
 			}
 			
-			// cannot create arrays with NEW
+			/* cannot create arrays with NEW */
 			sig = CLASS_NAMED(idx, pool);
 			if (*sig == '[') {
 				VERIFY_ERROR("new instruction used to create a new array");
@@ -1589,7 +1600,7 @@
 				VERIFY_ERROR("anewarray indexes a constant pool entry that is not type CONSTANT_Class or CONSTANT_ResolvedClass");
 			}
 			
-			// count the number of dimensions of the array being created...it must be <= 255
+			/* count the number of dimensions of the array being created...it must be <= 255 */
 			sig = CLASS_NAMED(idx, pool);
 			for (n = 0; *sig == '['; sig++, n++);
 			if (n > 255) {
@@ -1623,7 +1634,7 @@
 		case ILOAD: case ISTORE:
 		case FLOAD: case FSTORE:
 			if (wide == true) {
-				// the WIDE is considered the beginning of the instruction
+			        /* the WIDE is considered the beginning of the instruction */
 				status[pc] ^= IS_INSTRUCTION;
 				status[pc] |= WIDE_MODDED;
 				
@@ -1642,7 +1653,7 @@
 		case LLOAD: case LSTORE:
 		case DLOAD: case DSTORE:
 			if (wide == true) {
-				// the WIDE is considered the beginning of the instruction
+			        /* the WIDE is considered the beginning of the instruction */
 				status[pc] ^= IS_INSTRUCTION;
 				status[pc] |= WIDE_MODDED;
 				
@@ -1655,16 +1666,17 @@
 				GET_IDX(n, pc);
 			}
 			
-			// makes sure the index given for a local variable is within the correct index
-			//
-			// REM: longs and doubles take two consecutive local spots
+			/* makes sure the index given for a local variable is within the correct index
+			 *
+			 * REM: longs and doubles take two consecutive local spots
+			 */
 			CHECK_LOCAL_INDEX(n + 1);
 			break;
 			
 			
 		case IINC:
 			if (wide == true) {
-				// the WIDE is considered the beginning of the instruction
+			        /* the WIDE is considered the beginning of the instruction */
 				status[pc] ^= IS_INSTRUCTION;
 				status[pc] |= WIDE_MODDED;
 				
@@ -1738,7 +1750,7 @@
 			BRANCH_IN_BOUNDS(newpc, "jsr");
 			status[newpc] |= START_BLOCK;
 			
-			// the next instruction is a target for branching via RET
+			/* the next instruction is a target for branching via RET */
 			pc = NEXTPC;
 			BRANCH_IN_BOUNDS(pc, "jsr/ret");
 			status[pc] |= START_BLOCK;
@@ -1766,8 +1778,9 @@
 			ENSURE_NON_WIDE;
 			status[pc] |= END_BLOCK;
 			
-			// default branch...between 0 and 3 bytes of padding are added so that the
-			// default branch is at an address that is divisible by 4
+			/* default branch...between 0 and 3 bytes of padding are added so that the
+			 * default branch is at an address that is divisible by 4
+			 */
 			n = (pc + 1) % 4;
 			if (n) n = pc + 5 - n;
 			else   n = pc + 1;
@@ -1780,14 +1793,14 @@
 			    dprintf("\n");
 			    );
 			
-			// get number of key/target pairs
+			/* get number of key/target pairs */
 			n += 4;
 			low = DWORD(code, n);
 			if (low < 0) {
 				VERIFY_ERROR("lookupswitch with npairs < 0");
 			}
 			
-			// make sure all targets are in bounds
+			/* make sure all targets are in bounds */
 			for (n += 4, high = n + 8*low; n < high; n += 8) {
 				newpc = pc + DWORD(code, n+4);
 				BRANCH_IN_BOUNDS(newpc, "lookupswitch");
@@ -1808,8 +1821,9 @@
 			ENSURE_NON_WIDE;
 			status[pc] |= END_BLOCK;
 			
-			// default branch...between 0 and 3 bytes of padding are added so that the
-			// default branch is at an address that is divisible by 4
+			/* default branch...between 0 and 3 bytes of padding are added so that the
+			 * default branch is at an address that is divisible by 4
+			 */
 			n = (pc + 1) % 4;
 			if (n) n = pc + 5 - n;
 			else   n = pc + 1;
@@ -1822,7 +1836,7 @@
 			    dprintf("\n");
 			    );
 			
-			// get the high and low values of the table
+			/* get the high and low values of the table */
 			low  = DWORD(code, n + 4);
 			high = DWORD(code, n + 8);
 			if (high < low) {
@@ -1831,8 +1845,9 @@
 			}
 			n += 12;
 			
-			// high and low are used as temps in this loop that checks
-			// the validity of all the branches in the table
+			/* high and low are used as temps in this loop that checks
+			 * the validity of all the branches in the table
+			 */
 			for (high = n + 4*(high - low + 1); n < high; n += 4) {
 				newpc = pc + DWORD(code, n);
 				BRANCH_IN_BOUNDS(newpc, "tableswitch");
@@ -1849,7 +1864,7 @@
 			continue;
 			
 			
-			// the rest of the ways to end a block
+			/* the rest of the ways to end a block */
 		case RETURN:

*** Patch too long, truncated ***




More information about the kaffe mailing list