[kaffe] CVS kaffe (dalibor): Replaced macro by static inline function

Kaffe CVS cvs-commits at kaffe.org
Wed Feb 11 09:49:04 PST 2004


PatchSet 4414 
Date: 2004/02/11 17:46:04
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Replaced macro by static inline function

2004-02-11  Dalibor Topic <robilad at kaffe.org>

        * kaffe/kaffevm/verify.c
        (abstractMethodError): New static inline function.
        (ABSTRACT_METHOD_ERROR) Removed.
        (checkAbstractMethod) Use abstractMethodError instead of
        ABSTRACT_METHOD_ERROR macro.

Members: 
	ChangeLog:1.1997->1.1998 
	kaffe/kaffevm/verify.c:1.31->1.32 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1997 kaffe/ChangeLog:1.1998
--- kaffe/ChangeLog:1.1997	Wed Feb 11 17:23:48 2004
+++ kaffe/ChangeLog	Wed Feb 11 17:46:04 2004
@@ -1,5 +1,13 @@
 2004-02-11  Dalibor Topic <robilad at kaffe.org>
 
+        * kaffe/kaffevm/verify.c
+	(abstractMethodError): New static inline function.
+	(ABSTRACT_METHOD_ERROR) Removed.
+	(checkAbstractMethod) Use abstractMethodError instead of
+	ABSTRACT_METHOD_ERROR macro.
+
+2004-02-11  Dalibor Topic <robilad at kaffe.org>
+
 	* kaffe/kaffevm/verify.c
 	(poolError): New static inline function.
 	(POOLERROR): Removed.
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.31 kaffe/kaffe/kaffevm/verify.c:1.32
--- kaffe/kaffe/kaffevm/verify.c:1.31	Wed Feb 11 17:23:50 2004
+++ kaffe/kaffe/kaffevm/verify.c	Wed Feb 11 17:46:05 2004
@@ -777,7 +777,18 @@
 	return(true);
 }
 
-
+static inline
+bool
+abstractMethodError(Method* method, errorInfo* einfo, const char * msg)
+{
+	postExceptionMessage(einfo, 
+			     JAVA_LANG(ClassFormatError),
+			     "in method \"%s.%s\": abstract methods cannot be %s",
+			     CLASS_CNAME(method->class),
+			     METHOD_NAMED(method),
+			     msg);
+	return(false);
+}
 
 /*
  * Given a method with its ACC_ABSTRACT flag set, this checks the the rest of the access flags
@@ -789,12 +800,6 @@
 bool
 checkAbstractMethod(Method* method, errorInfo* einfo)
 {
-#define ABSTRACT_METHOD_ERROR(_MSG) \
-	postExceptionMessage(einfo, JAVA_LANG(ClassFormatError), \
-			     "in method \"%s.%s\": abstract methods cannot be %s", \
-			     CLASS_CNAME(method->class), \
-			     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
@@ -840,21 +845,19 @@
 	
 	
 	/* 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");       }
-	else if (METHOD_IS_STATIC(method))       { ABSTRACT_METHOD_ERROR("static");       }
-	else if (METHOD_IS_STRICT(method))       { ABSTRACT_METHOD_ERROR("strictfp");     }
+	if (METHOD_IS_PRIVATE(method))           { return abstractMethodError(method, einfo, "private");      }
+	else if (METHOD_IS_FINAL(method))        { return abstractMethodError(method, einfo, "final");        }
+	else if (METHOD_IS_NATIVE(method))       { return abstractMethodError(method, einfo, "native");       }
+	else if (METHOD_IS_STATIC(method))       { return abstractMethodError(method, einfo, "static");       }
+	else if (METHOD_IS_STRICT(method))       { return abstractMethodError(method, einfo, "strictfp");     }
 	
 	/* not enforced by Sun's verifier
 	 *
-	else if (METHOD_IS_SYNCHRONISED(method)) { ABSTRACT_METHOD_ERROR("synchronized"); }
+	else if (METHOD_IS_SYNCHRONISED(method)) { return abstractMethodError(method, einfo, "synchronized"); }
 	*/
 	
 	
 	return(true);
-	
-#undef ABSTRACT_METHOD_ERROR
 }
 
 




More information about the kaffe mailing list