[kaffe] first pass at adding __attribute__ to various places

Adam Heath doogie at debian.org
Sun Mar 28 18:14:30 PST 2004


This fixes most(if not all) of the printf functions, and some of the
non-returning functions.  I haven't done UNUSED yet.
-------------- next part --------------
Index: config/config-std.h
===================================================================
RCS file: /cvs/kaffe/kaffe/config/config-std.h,v
retrieving revision 1.10
diff -u -r1.10 config-std.h
--- config/config-std.h	24 Mar 2004 20:38:43 -0000	1.10
+++ config/config-std.h	28 Mar 2004 21:26:16 -0000
@@ -52,13 +52,6 @@
 #include <kernel/OS.h>
 #endif
 
-#undef	__NORETURN__
-#if defined(__GNUC__)
-#define	__NORETURN__ __attribute__((__noreturn__))
-#else
-#define	__NORETURN__
-#endif
-
 #undef	__UNUSED__
 #if defined(__GNUC__)
 #define	__UNUSED__ __attribute__((__unused__))
Index: include/errors.h
===================================================================
RCS file: /cvs/kaffe/kaffe/include/errors.h,v
retrieving revision 1.10
diff -u -r1.10 errors.h
--- include/errors.h	28 Feb 2004 18:44:27 -0000	1.10
+++ include/errors.h	28 Mar 2004 21:26:17 -0000
@@ -12,6 +12,7 @@
 #ifndef __errors_h
 #define __errors_h
 
+#include "config.h"
 #include "config-std.h"
 #include <stdarg.h>
 
@@ -42,11 +43,11 @@
 
 /* post an exception with a print like message */
 extern void postExceptionMessage(errorInfo *, 
-	const char *name, const char *msgfmt, ...);
+	const char *name, const char *msgfmt, ...) PRINTFFORMAT(3,4);
 
 /* va_list version of postExceptionMessage */
 extern void vpostExceptionMessage(errorInfo *einfo,
-        const char * fullname, const char * fmt, va_list args);
+        const char * fullname, const char * fmt, va_list args) PRINTFFORMAT(3,0);
 
 /* post an out of memory condition */
 extern void postOutOfMemory(errorInfo *einfo);
@@ -108,7 +109,7 @@
 
 #if !defined(KAFFEH)
 
-void throwError(struct _errorInfo*) __NORETURN__;
+void throwError(struct _errorInfo*) NONRETURNING;
 
 /*
  * KMALLOC and all the allocating string functions return null on
Index: include/jni.h
===================================================================
RCS file: /cvs/kaffe/kaffe/include/jni.h,v
retrieving revision 1.27
diff -u -r1.27 jni.h
--- include/jni.h	12 Mar 2004 16:56:58 -0000	1.27
+++ include/jni.h	28 Mar 2004 21:26:17 -0000
@@ -18,17 +18,14 @@
 #include "kaffe/jtypes.h"
 #include "kaffe/jmalloc.h"
 
-#undef  __NORETURN__
-#if defined(__GNUC__)
-#define __NORETURN__ __attribute__((noreturn))
-#else
-#define __NORETURN__
-#endif
-
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
+#ifndef NONRETURNING
+#define NONRETURNING
+#endif
+
 #define	JNIEXPORT extern
 #define	JNICALL
 
@@ -59,8 +56,8 @@
 	const char*	classpath;
 	const char*     bootClasspath;
 	jint		(*vfprintf)(FILE*, const char*, va_list);
-	void		(*exit)(jint) __NORETURN__;
-	void		(*abort)(void) __NORETURN__;
+	void		(*exit)(jint) NONRETURNING;
+	void		(*abort)(void) NONRETURNING;
 	jint		enableClassGC;
 	jint		enableVerboseGC;
 	jint		disableAsyncGC;
Index: include/native.h
===================================================================
RCS file: /cvs/kaffe/kaffe/include/native.h,v
retrieving revision 1.13
diff -u -r1.13 native.h
--- include/native.h	27 Mar 2004 16:07:31 -0000	1.13
+++ include/native.h	28 Mar 2004 21:26:17 -0000
@@ -12,13 +12,6 @@
 #ifndef __native_h
 #define __native_h
 
-#undef	__NORETURN__
-#if defined(__GNUC__)
-#define	__NORETURN__	__attribute__((noreturn))
-#else
-#define	__NORETURN__
-#endif
-
 #include <kaffe/jtypes.h>
 
 struct _methods;
Index: kaffe/kaffeh/mem.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffeh/mem.c,v
retrieving revision 1.3
diff -u -r1.3 mem.c
--- kaffe/kaffeh/mem.c	8 Mar 2004 21:21:06 -0000	1.3
+++ kaffe/kaffeh/mem.c	28 Mar 2004 21:26:17 -0000
@@ -28,6 +28,7 @@
 static void* gcRealloc(struct _Collector*, void*, size_t, gc_alloc_type_t);
 static void  gcFree(struct _Collector*, void*);
 
+extern void postExceptionMessage(struct _errorInfo *e, const char *name, const char *msgfmt, ...) PRINTFFORMAT(3,4);
 /*
  * We use a very simple 'fake' garbage collector interface
  */
Index: kaffe/kaffevm/exception.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/exception.c,v
retrieving revision 1.78
diff -u -r1.78 exception.c
--- kaffe/kaffevm/exception.c	8 Mar 2004 21:21:08 -0000	1.78
+++ kaffe/kaffevm/exception.c	28 Mar 2004 21:26:17 -0000
@@ -68,7 +68,7 @@
 
 static void nullException(struct _exceptionFrame *);
 static void floatingException(struct _exceptionFrame *);
-static void dispatchException(Hjava_lang_Throwable*, stackTraceInfo*) __NORETURN__;
+static void dispatchException(Hjava_lang_Throwable*, stackTraceInfo*) NONRETURNING;
 
 extern void printStackTrace(struct Hjava_lang_Throwable*, struct Hjava_lang_Object*, int);
 
Index: kaffe/kaffevm/exception.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/exception.h,v
retrieving revision 1.23
diff -u -r1.23 exception.h
--- kaffe/kaffevm/exception.h	28 Sep 2003 22:30:19 -0000	1.23
+++ kaffe/kaffevm/exception.h	28 Mar 2004 21:26:17 -0000
@@ -96,11 +96,11 @@
 
 #define VMEXCEPTHANDLER_KAFFEJNI_HANDLER ((struct _methods*)1)
 
-void throwException(struct Hjava_lang_Throwable*) __NORETURN__;
-void throwExternalException(struct Hjava_lang_Throwable*) __NORETURN__;
+void throwException(struct Hjava_lang_Throwable*) NONRETURNING; 
+void throwExternalException(struct Hjava_lang_Throwable*) NONRETURNING;
 struct Hjava_lang_Throwable* error2Throwable(struct _errorInfo* einfo);
 
-void unhandledException(struct Hjava_lang_Throwable *eobj) __NORETURN__;
+void unhandledException(struct Hjava_lang_Throwable *eobj) NONRETURNING;
 
 extern void initExceptions(void);
 
@@ -113,7 +113,7 @@
 static inline struct Hjava_lang_Object* vmExcept_getSyncObj(VmExceptHandler* eh) __UNUSED__;
 static inline void vmExcept_setPC(volatile VmExceptHandler* eh, u4 pc) __UNUSED__;
 static inline u4 vmExcept_getPC(const VmExceptHandler* eh) __UNUSED__;
-static inline void vmExcept_jumpToHandler(VmExceptHandler* frame) __UNUSED__ __NORETURN__;
+static inline void vmExcept_jumpToHandler(VmExceptHandler* frame) __UNUSED__ NONRETURNING;
 
 static inline bool
 vmExcept_isJNIFrame(VmExceptHandler* eh)
Index: kaffe/kaffevm/support.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/support.h,v
retrieving revision 1.28
diff -u -r1.28 support.h
--- kaffe/kaffevm/support.h	27 Mar 2004 16:07:32 -0000	1.28
+++ kaffe/kaffevm/support.h	28 Mar 2004 21:26:17 -0000
@@ -127,10 +127,10 @@
 extern struct _methods*	lookupObjectMethod(struct Hjava_lang_Object*, const char*, const char*, struct _errorInfo*);
 
 struct _strconst;
-extern void SignalError(const char *, const char *) __NORETURN__;
-extern void SignalErrorf(const char *, const char *, ...) __NORETURN__;
-extern void unimp(const char*) __NORETURN__;
-extern void kprintf(FILE*, const char*, ...);
+extern void SignalError(const char *, const char *) NONRETURNING;
+extern void SignalErrorf(const char *, const char *, ...) NONRETURNING PRINTFFORMAT(2,3);
+extern void unimp(const char*) NONRETURNING;
+extern void kprintf(FILE*, const char*, ...) PRINTFFORMAT(2,3);
 extern int addClasspath(const char*);
 extern int prependClasspath(const char*);
 
Index: kaffe/kaffevm/mem/gc-incremental.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/mem/gc-incremental.c,v
retrieving revision 1.74
diff -u -r1.74 gc-incremental.c
--- kaffe/kaffevm/mem/gc-incremental.c	24 Mar 2004 20:23:57 -0000	1.74
+++ kaffe/kaffevm/mem/gc-incremental.c	28 Mar 2004 21:26:17 -0000
@@ -1001,7 +1001,7 @@
  * collector.
  */
 
-void throwOutOfMemory(void) __NORETURN__;
+void throwOutOfMemory(void) NONRETURNING;
 
 static
 void*
Index: kaffe/kaffevm/systems/beos-native/jthread.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/systems/beos-native/jthread.h,v
retrieving revision 1.4
diff -u -r1.4 jthread.h
--- kaffe/kaffevm/systems/beos-native/jthread.h	8 Jul 2000 20:58:09 -0000	1.4
+++ kaffe/kaffevm/systems/beos-native/jthread.h	28 Mar 2004 21:26:17 -0000
@@ -222,7 +222,7 @@
 /*
  * have the current thread exit
  */
-void 	jthread_exit(void) __NORETURN__;
+void 	jthread_exit(void) NONRETURNING;
 
 /*
  * determine whether a location is on the stack of the current thread
Index: kaffe/kaffevm/systems/oskit-pthreads/jthread.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/systems/oskit-pthreads/jthread.h,v
retrieving revision 1.10
diff -u -r1.10 jthread.h
--- kaffe/kaffevm/systems/oskit-pthreads/jthread.h	26 May 2003 21:38:47 -0000	1.10
+++ kaffe/kaffevm/systems/oskit-pthreads/jthread.h	28 Mar 2004 21:26:17 -0000
@@ -206,7 +206,7 @@
 /*
  * have the current thread exit
  */
-void 	jthread_exit(void) __NORETURN__;
+void 	jthread_exit(void) NONRETURNING;
 
 /*
  * determine whether a location is on the stack of the current thread
Index: kaffe/kaffevm/systems/unix-jthreads/jthread.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h,v
retrieving revision 1.51
diff -u -r1.51 jthread.h
--- kaffe/kaffevm/systems/unix-jthreads/jthread.h	1 Feb 2004 22:14:54 -0000	1.51
+++ kaffe/kaffevm/systems/unix-jthreads/jthread.h	28 Mar 2004 21:26:17 -0000
@@ -232,7 +232,7 @@
 /*
  * have the current thread exit
  */
-void 	jthread_exit(void) __NORETURN__;
+void 	jthread_exit(void) NONRETURNING;
 
 /*
  * determine whether a location is on the stack of the current thread


More information about the kaffe mailing list