Commits

Ronald Oussoren  committed 84bfc6d

Fix compiler warnings for clang

This patch fixes a number of small issues in the PyObjC source code
and ensures that we compile basicly warnings-free with clang
(Xcode 4.2, -Wall).

Als add "-(BOOL)supportsWeakPointers { return YES; }" to the OC_Python*
classes, this makes sure we play nice with ARC (our release implementation
calls the super one after grabbing the python GIL and should therefore
be safe in ARC mode).

  • Participants
  • Parent commits 50e8780

Comments (0)

Files changed (40)

File pyobjc-core/Modules/objc/OC_PythonArray.m

 	return result;
 }
 
-+ arrayWithPythonObject:(PyObject*)v;
++ arrayWithPythonObject:(PyObject*)v
 {
 	OC_PythonArray* res;
 
 	return res;
 }
 
-- initWithPythonObject:(PyObject*)v;
+- initWithPythonObject:(PyObject*)v
 {
 	self = [super init];
 	if (unlikely(self == nil)) return nil;
 	return value;
 }
 
--(void)release
+-(BOOL)supportsWeakPointers { return YES; }
+
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL
 }
 
 
--(void)replaceObjectAtIndex:(NSUInteger)idx withObject:newValue;
+-(void)replaceObjectAtIndex:(NSUInteger)idx withObject:newValue
 {
 	PyObject* v;
 
 	PyObjC_END_WITH_GIL;
 }
 
--(void)removeObjectAtIndex:(NSUInteger)idx;
+-(void)removeObjectAtIndex:(NSUInteger)idx
 {
 	int r;
 

File pyobjc-core/Modules/objc/OC_PythonData.m

 
 @implementation OC_PythonData 
 
-+ dataWithPythonObject:(PyObject*)v;
++ dataWithPythonObject:(PyObject*)v
 {
 	OC_PythonData* res;
 
 	return res;
 }
 
-- initWithPythonObject:(PyObject*)v;
+- initWithPythonObject:(PyObject*)v
 {
 	self = [super init];
 	if (unlikely(self == nil)) return nil;
 	return value;
 }
 
+-(BOOL)supportsWeakPointers { return YES; }
 
--(void)release
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL

File pyobjc-core/Modules/objc/OC_PythonDate.m

 
 @implementation OC_PythonDate 
 
-+ depythonifyObject:(PyObject*)object;
++ depythonifyObject:(PyObject*)object
 {
 	if (datetime_types == NULL) {
 		/* Initialize the mapping table, don't worry about
 		Py_DECREF(name); name = NULL;
 
 		if (datetime == NULL) {
-			Py_DECREF(name);
 			PyErr_Clear();
 			return nil;
 		}
 	return nil;
 }
 
-+ dateWithPythonObject:(PyObject*)v;
++ dateWithPythonObject:(PyObject*)v
 {
-	OC_PythonArray* res;
+	OC_PythonDate* res;
 
 	res = [[OC_PythonDate alloc] initWithPythonObject:v];
 	[res autorelease];
 	return res;
 }
 
-- initWithPythonObject:(PyObject*)v;
+- initWithPythonObject:(PyObject*)v
 {
 	self = [super init];
 	if (unlikely(self == nil)) return nil;
 	return value;
 }
 
--(void)release
+-(BOOL)supportsWeakPointers { return YES; }
+
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL
 }
 
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+
 - (id)addTimeInterval:(NSTimeInterval)seconds
 {
 	return [[self _make_oc_value] addTimeInterval:seconds];
 }
 
+#pragma clang diagnostic pop
+
 - (NSComparisonResult)compare:(NSDate *)anotherDate
 {
 	return [[self _make_oc_value] compare:anotherDate];

File pyobjc-core/Modules/objc/OC_PythonDictionary.m

 
 @implementation OC_PythonDictionaryEnumerator
 
-+enumeratorWithWrappedDictionary:(OC_PythonDictionary*)v;
++enumeratorWithWrappedDictionary:(OC_PythonDictionary*)v
 {
 	return [[[self alloc] initWithWrappedDictionary:v] autorelease];
 }
 
--initWithWrappedDictionary:(OC_PythonDictionary*)v;
+-initWithWrappedDictionary:(OC_PythonDictionary*)v
 {
 	self = [super init];
 	if (unlikely(self == nil)) return nil;
 	return result;
 }
 
-+dictionaryWithPythonObject:(PyObject*)v;
++dictionaryWithPythonObject:(PyObject*)v
 {
 	OC_PythonDictionary* res = 
 		[[OC_PythonDictionary alloc] initWithPythonObject:v];
 	return res;
 }
 
--initWithPythonObject:(PyObject*)v;
+-initWithPythonObject:(PyObject*)v
 {
 	self = [super init];
 	if (unlikely(self == nil)) return nil;
 	return self;
 }
 
--(void)release
+-(BOOL)supportsWeakPointers { return YES; }
+
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL

File pyobjc-core/Modules/objc/OC_PythonNumber.m

 
 @implementation OC_PythonNumber
 
-+ numberWithPythonObject:(PyObject*)v;
++ numberWithPythonObject:(PyObject*)v
 {
 	OC_PythonNumber* res;
 
 	return res;
 }
 
-- initWithPythonObject:(PyObject*)v;
+- initWithPythonObject:(PyObject*)v
 {
 	self = [super init];
 	if (unlikely(self == nil)) return nil;
 	return value;
 }
 
--(void)release
+-(BOOL)supportsWeakPointers { return YES; }
+
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL

File pyobjc-core/Modules/objc/OC_PythonObject.m

 	PyObjC_END_WITH_GIL
 }
 
--(void)release
+-(BOOL)supportsWeakPointers { return YES; }
+
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL
 	return YES;
 }
 
-+ (BOOL)accessInstanceVariablesDirectly;
++ (BOOL)accessInstanceVariablesDirectly
 {
 	return YES;
 }
 /*
  *  Call PyObjCTools.KeyValueCoding.getKey to get the value for a key
  */
-- valueForKey:(NSString*) key;
+- valueForKey:(NSString*) key
 {
 static  PyObject* getKeyFunc = NULL;
 
 	return res;
 }
 
-- storedValueForKey: (NSString*) key;
+- storedValueForKey: (NSString*) key
 {
 	return [self valueForKey: key];
 }
 	[self setValue: value forKey: key];
 }
 
-- (void)setValue: value forKey: (NSString*) key;
+- (void)setValue: value forKey: (NSString*) key
 {
 static  PyObject* setKeyFunc = NULL;
 
 	PyObjC_END_WITH_GIL
 }
 
-- (void)takeStoredValue: value forKey: (NSString*) key;
+- (void)takeStoredValue: value forKey: (NSString*) key
 {
 	[self takeValue: value forKey: key];
 }
 
-- (NSDictionary*) valuesForKeys: (NSArray*)keys;
+- (NSDictionary*) valuesForKeys: (NSArray*)keys
 {
 	NSMutableDictionary* result;
 	NSEnumerator* enumerator;
 	return result;
 }
 
-- valueForKeyPath: (NSString*) keyPath;
+- valueForKeyPath: (NSString*) keyPath
 {
 	NSArray* elems = [keyPath componentsSeparatedByString:@"."];
 	NSEnumerator* enumerator = [elems objectEnumerator];
 	[self setValue: value forKeyPath: keyPath];
 }
 	
-- (void)setValue: value forKeyPath: (NSString*) keyPath;
+- (void)setValue: value forKeyPath: (NSString*) keyPath
 {
 	NSArray* elems = [keyPath componentsSeparatedByString:@"."];
 	id target;
 	[self setValuesForKeysWithDictionary: aDictionary];
 }
 
-- (void)setValuesForKeysWithDictionary: (NSDictionary*) aDictionary;
+- (void)setValuesForKeysWithDictionary: (NSDictionary*) aDictionary
 {
 	NSEnumerator* enumerator = [aDictionary keyEnumerator];
 	id aKey;
 	}
 }
 
-- (void)unableToSetNilForKey: (NSString*) key;
+- (void)unableToSetNilForKey: (NSString*) key
 {
 	[NSException 
 		raise: NSUnknownKeyException 
 		format: @"cannot set Nil for key: %@", key];
 }
 
-- (void)handleQueryWithUnboundKey: (NSString*) key;
+- (void)handleQueryWithUnboundKey: (NSString*) key
 {
 	[self valueForUndefinedKey: key];
 }
 
-- (void)valueForUndefinedKey: (NSString*)key;
+- (void)valueForUndefinedKey: (NSString*)key
 {
 	[NSException 
 		raise: NSUnknownKeyException
 		format: @"query for unknown key: %@", key];
 }
 
-- (void)handleTakeValue: value forUnboundKey: (NSString*) key;
+- (void)handleTakeValue: value forUnboundKey: (NSString*) key
 {
 	[self setValue: value forUndefinedKey: key];
 }
 
-- (void)setValue: value forUndefinedKey: (NSString*) key;
+- (void)setValue: value forUndefinedKey: (NSString*) key
 {
 	[NSException 
 		raise: NSUnknownKeyException 
 }
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
-- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context;
+- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context
 {
-	NSLog(@"*** Ignoring *** %@ for '%@' (of %@ with %#x in %p).\n", NSStringFromSelector(_cmd), keyPath, observer, options, context);
+	NSLog(@"*** Ignoring *** %@ for '%@' (of %@ with %#lx in %p).\n", NSStringFromSelector(_cmd), keyPath, observer, (long)options, context);
 	return;
 }
-- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath;
+- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath
 {
 	NSLog(@"*** Ignoring *** %@ for '%@' (of %@).", NSStringFromSelector(_cmd), keyPath, observer);
 }

File pyobjc-core/Modules/objc/OC_PythonSet.m

 	return result;
 }
 
-+ setWithPythonObject:(PyObject*)v;
++ setWithPythonObject:(PyObject*)v
 {
 	OC_PythonSet* res;
 
 	return res;
 }
 
-- initWithPythonObject:(PyObject*)v;
+- initWithPythonObject:(PyObject*)v
 {
 	self = [super init];
 	if (unlikely(self == nil)) return nil;
 	return value;
 }
 
--(void)release
+-(BOOL)supportsWeakPointers { return YES; }
+
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL

File pyobjc-core/Modules/objc/OC_PythonString.m

 
 @implementation OC_PythonString 
 
-+ stringWithPythonObject:(PyObject*)v;
++ stringWithPythonObject:(PyObject*)v
 {
 	OC_PythonString* res;
 
 	return res;
 }
 
-- initWithPythonObject:(PyObject*)v;
+- initWithPythonObject:(PyObject*)v
 {
 	Py_INCREF(v);
 	Py_XDECREF(value);
 	return value;
 }
 
+-(BOOL)supportsWeakPointers { return YES; }
 
--(void)release
+-(oneway void)release
 {
 	/* See comment in OC_PythonUnicode */
 	PyObjC_BEGIN_WITH_GIL

File pyobjc-core/Modules/objc/OC_PythonUnicode.m

 
 @implementation OC_PythonUnicode 
 
-+ unicodeWithPythonObject:(PyObject*)v;
++ unicodeWithPythonObject:(PyObject*)v
 {
 	OC_PythonUnicode* res;
 
 	return res;
 }
 
-- initWithPythonObject:(PyObject*)v;
+- initWithPythonObject:(PyObject*)v
 {
 	Py_INCREF(v);
 	Py_XDECREF(value);
 
 
 
--(void)release
+-(BOOL)supportsWeakPointers { return YES; }
+
+-(oneway void)release
 {
 	/* There is small race condition when an object is almost deallocated
 	 * in one thread and fetched from the registration mapping in another
 	 * shutdown and if we're very unlucky this can happen after the 
 	 * GILState machinery has shut down...
 	 */
+	/* FIXME3: Should switch to __weak on OSX 10.7 or later, that should
+	 * fix this issue without a performance penalty.
+	 */
 #if 0
 	if ([self retainCount] == 1) {
 #endif

File pyobjc-core/Modules/objc/fsref.m

 			strlen((char*)buffer), NULL);
 }
 
-static PyObject* fsref_from_path(PyObject* self, PyObject* path)
+static PyObject* fsref_from_path(PyObject* self __attribute__((__unused__)), PyObject* path)
 {
 	PyObject* value;
 	FSRef result;

File pyobjc-core/Modules/objc/informal-protocol.h

 
 /* TODO: rename */
 PyObject* findSelInDict(PyObject* clsdict, SEL selector);
-int signaturesEqual(char* sig1, char* sig2);
+int signaturesEqual(const char* sig1, const char* sig2);
 
 
 

File pyobjc-core/Modules/objc/informal-protocol.m

 }
 
 int 
-signaturesEqual(char* sig1, char* sig2)
+signaturesEqual(const char* sig1, const char* sig2)
 {
 	char buf1[1024];
 	char buf2[1024];

File pyobjc-core/Modules/objc/instance-var.m

 				[new_value retain];
 				[old_value release];
 			PyObjC_HANDLER
-				NSLog(@"PyObjC: ignoring exception during attribute replacement", localException);
+				NSLog(@"PyObjC: ignoring exception during attribute replacement: %@", localException);
 			PyObjC_ENDHANDLER
 		}
 

File pyobjc-core/Modules/objc/libffi_support.m

 #ifdef __ppc64__
 extern bool ffi64_stret_needs_ptr(const ffi_type* inType,
 		        unsigned short*, unsigned short*);
-#endif;
+#endif
 
 /*
  * Define SMALL_STRUCT_LIMIT as the largest struct that will be returned

File pyobjc-core/Modules/objc/objc-object.m

      0,					/* name */
      0,					/* slots */
 #endif
-   }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+   }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
 /*

File pyobjc-core/Modules/objc/objc_util.h

 int     PyObjC_IsPythonKeyword(const char* word);
 
 
-extern int PyObjCRT_SimplifySignature(char* signature, char* buf, size_t buflen);
+extern int PyObjCRT_SimplifySignature(const char* signature, char* buf, size_t buflen);
 
 extern int PyObjCObject_Convert(PyObject* object, void* pvar);
 extern int PyObjCClass_Convert(PyObject* object, void* pvar);

File pyobjc-core/Modules/objc/objc_util.m

 		PyGILState_Release(*state);
 	}
 	[exc raise];
+
+	/* Fatal error: this should never happen */
+	abort();
 }
 
 
 }
 
 int
-PyObjCRT_SimplifySignature(char* signature, char* buf, size_t buflen)
+PyObjCRT_SimplifySignature(const char* signature, char* buf, size_t buflen)
 {
-	char* cur;
-	char* end;
-	char* next;
+	const char* cur;
+	const char* end;
+	const char* next;
 
 	cur = signature;
 	*buf = '\0';
 
 	while (*cur != '\0') {
-		next = end = (char*)PyObjCRT_SkipTypeSpec(cur);
+		next = end = PyObjCRT_SkipTypeSpec(cur);
 		end -= 1;
 		while (end != cur && isdigit(*end)) {
 			end --;

File pyobjc-core/Modules/objc/pyobjc-api.h

  * compatibility.
  */
 
-#include "Python.h"
 #include <objc/objc.h>
 
 #import <Foundation/Foundation.h>
 	const char* (*selname)(SEL sel);
 
 	/* PyObjCRT_SimplifySignature */
-	int (*simplify_sig)(char* signature, char* buf, size_t buflen);
+	int (*simplify_sig)(const char* signature, char* buf, size_t buflen);
 
 	/* PyObjC_FreeCArray */
 	void    (*free_c_array)(int,void*);

File pyobjc-core/Modules/objc/pyobjc-compat.m

 
 			case 'R':
 			case 'S':
+			   {
 				/* unused, since we already have the result */
 				(void) va_arg(vargs, PyObject *);
 
-				memcpy(s, PyString_AS_STRING(*callresult),
+				/* FIXME: The clang analyzer thinks that 'callresult' might be 
+				 * NULL here. That's wrong, this is the second loop through 
+				 * the format string and on the previous loop callresults got
+				 * created and filled.
+				 */
+
+				if (callresult != NULL) {
+					memcpy(s, PyString_AS_STRING(*callresult),
 					  PyString_GET_SIZE(*callresult));
-				s += PyString_GET_SIZE(*callresult);
-				Py_DECREF(*callresult); *callresult = NULL;
+					s += PyString_GET_SIZE(*callresult);
+					Py_DECREF(*callresult); *callresult = NULL;
+				}
 				callresult++;
 				break;
+			    }
 
 			case '%':
 				*s++ = '%';

File pyobjc-core/Modules/objc/pyobjc.h

 #include "structmember.h"
 #include "pyobjc-compat.h"
 
+#ifdef __clang__
+
+/* This is a crude hack to disable a otherwise useful warning in the context of
+ * PyTuple_SET_ITEM, without disabling it everywhere
+ */
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warray-bounds"
+static inline void _PyObjCTuple_SetItem(PyObject* tuple, Py_ssize_t idx, PyObject* value)
+{
+	PyTuple_SET_ITEM(tuple, idx, value);
+}
+#undef PyTuple_SET_ITEM
+#define PyTuple_SET_ITEM(a, b, c) _PyObjCTuple_SetItem(a, b, c)
+
+static inline PyObject* _PyObjCTuple_GetItem(PyObject* tuple, Py_ssize_t idx)
+{
+	return PyTuple_GET_ITEM(tuple, idx);
+}
+#undef PyTuple_GET_ITEM
+#define PyTuple_GET_ITEM(a, b) _PyObjCTuple_GetItem(a, b)
+
+#pragma clang diagnostic pop
+
+#endif /* __clang__ */
+
+
 /* PyObjC_DEBUG: If defined the bridge will perform more internal checks */
 #ifdef Py_DEBUG
    /* Enable when Python is compiled with internal checks enabled */

File pyobjc-core/Modules/objc/selector.m

 /*
  * Find the signature of 'selector' in the list of protocols.
  */
-static char*
+static const char*
 find_protocol_signature(PyObject* protocols, SEL selector, int is_class_method)
 {
 	Py_ssize_t len;
 			oc_class);
 		Py_XDECREF(super_sel);
 	} else {
-		char* signature = NULL;
+		const char* signature = NULL;
 
 		PyErr_Clear(); /* The call to PyObjCClass_FindSelector failed */
 		if (protocols != NULL) {

File pyobjc-core/Modules/objc/super-call.m

 }
 
 static struct registry*
-find_signature(char* signature)
+find_signature(const char* signature)
 {
 	PyObject* o;
 	struct registry* r;

File pyobjc-core/Modules/objc/test/block.m

 
 -(int(^)(void))getIntBlock
 {
-	return ^{ return 42; };
+	return [[^{ return 42; } copy] autorelease];
 }
 
 -(double(^)(double,double))getFloatBlock
 {
-	return ^(double a, double b) { return a + b; };
+	return [[^(double a, double b) { return a + b; } copy] autorelease];
 }
 
 -(void)callIntBlock:(void(^)(int))block withValue:(int)value

File pyobjc-core/Modules/objc/test/cfsocket.m

 @end
 
 @implementation OC_TestCFSocket
--(id)create
+-(id)newSocket
 {
 	CFSocketRef sock;
 

File pyobjc-core/Modules/objc/test/copying.m

 
 	retval = [tmp copyWithZone:nil];
 	[tmp release];
-	return retval;
+	return [retval autorelease];
 }
 +(NSObject*)newObjectOfClass:(Class)aClass
 {

File pyobjc-core/Modules/objc/test/corefoundation.m

 
 +(NSString*)formatDate:(CFDateRef)date
 {
+	CFLocaleRef currentLocale = CFLocaleCopyCurrent();
 	CFDateFormatterRef formatter = CFDateFormatterCreate(
-			NULL, CFLocaleCopyCurrent(), 
+			NULL, currentLocale, 
 			kCFDateFormatterShortStyle, NSDateFormatterNoStyle  );
 
+	if (currentLocale != NULL) {
+		CFRelease(currentLocale);
+	}
+
 	NSString* result = (NSString*)CFDateFormatterCreateStringWithDate(
 			NULL, formatter, date);
 

File pyobjc-core/Modules/objc/test/ctests.m

 	[inv setArgument: &v2 atIndex: 3];
 
 	[inv invoke];
+	[obj release];
 	ASSERT_EQUALS(invokeHelper.f1, v1.f1, "%d");
 	ASSERT_EQUALS(invokeHelper.f2, v1.f2, "%g");
 	ASSERT_EQUALS(invokeHelper.s[0], v1.s[0], "%d");

File pyobjc-core/Modules/objc/test/exceptions.m

 				NULL]] raise];
 }
 
--(void)raiseUnicodeName;
+-(void)raiseUnicodeName
 {
 	[NSException 	
 		raise:addSomeUnicode(@"SimpleException") 
 		format:@"hello world"];
 }
 
--(void)raiseUnicodeReason;
+-(void)raiseUnicodeReason
 {
 	[NSException 
 		raise:@"SimpleException" 

File pyobjc-core/Modules/objc/test/identity.m

 	isClassic = 0;
 }
 
--(void)setStoredClassicObject:(NSObject*)object;
+-(void)setStoredClassicObject:(NSObject*)object
 {
 	if (!isClassic) {
 		[storedObject release];
 
 -(void)setStoredObjectAnInstanceOf:(Class) cls
 {
-	[self setStoredObject: [[cls alloc] init]];
+	[self setStoredObject: [[[cls alloc] init] autorelease]];
 }
 -(void)setStoredObjectAnInstanceOfClassic:(Class)cls
 {
-	[self setStoredClassicObject:[cls new]];
+	[self setStoredClassicObject:[[cls new] autorelease]];
 }
 
 -(void)writeStoredObjectToFile:(NSString*)fname

File pyobjc-core/Modules/objc/test/instanceVariables.m

 	NSRect  rectValue;
 	NSObject* nilValue;
 	PyObject* pyValue;
-	NSString* objValue;
+	NSObject* objValue;
 }
 -init;
 -(void)dealloc;

File pyobjc-core/Modules/objc/test/metadata.m

 	}
 	return result;
 }
--(int*)   nullIntArrayOf5
+-(const int*)   nullIntArrayOf5
 {
 	return NULL;
 }
 	return array;
 }
 
--(NSArray*)makeObjectArray:(id*)data;
+-(NSArray*)makeObjectArray:(id*)data
 {
 	NSMutableArray* array;
 
 	}
 }
 
--(void)fill4Tuple:(int*)data;
+-(void)fill4Tuple:(int*)data
 {
 	int i;
 	for (i = 0; i < 4; i++) {
 	}
 }
 
--(int)nullfill4Tuple:(int*)data;
+-(int)nullfill4Tuple:(int*)data
 {
 	if (data == NULL) {
 		return 0;
 	return 1;
 }
 
--(void)reverseArray:(float*)data count:(int)count;
+-(void)reverseArray:(float*)data count:(int)count
 {
 	float t;
 	int i;
 	}
 }
 
--(int)nullreverseArray:(float*)data count:(int)count;
+-(int)nullreverseArray:(float*)data count:(int)count
 {
 	if (data == NULL) return 0;
 	[self reverseArray:data count:count];
 	return 1;
 }
 
--(void)reverseStrings:(char**)data;
+-(void)reverseStrings:(char**)data
 {
 	int count, i;
 	char* t;
 	}
 }
 
--(int)nullreverseStrings:(char**)data;
+-(int)nullreverseStrings:(char**)data
 {
 	if (data == NULL) return 0;
 	[self reverseStrings:data];
 	return count/2;
 }
 
--(int)maybeReverseArray:(short*)data;
+-(int)maybeReverseArray:(short*)data
 {
 	[self reverse4Tuple:data];
 	return 2;
 	va_list ap;
 	char buffer[2048];
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+
 	va_start(ap, fmt);
 	vsnprintf(buffer, sizeof(buffer), [fmt UTF8String], ap);
 	va_end(ap);
 
+#pragma clang diagnostic pop
+
 	return [NSArray arrayWithObjects: 
 			fmt, 
 			[NSString stringWithUTF8String:buffer],
 			NULL];
 }
 
--(NSArray*)makeArrayWithArguments:(id)arg, ...;
+-(NSArray*)makeArrayWithArguments:(id)arg, ...
 {
 	va_list ap;
-	NSMutableArray* array = [[NSMutableArray alloc] init];
+	NSMutableArray* array = [[[NSMutableArray alloc] init] autorelease];
 	if (arg == NULL) {
 		return array;
 	}

File pyobjc-core/Modules/objc/test/metadatafunction.m

 	char buffer[2048];
 
 	va_start(ap, fmt);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+
 	vsnprintf(buffer, sizeof(buffer), [fmt UTF8String], ap);
+#pragma clang diagnostic pop
 	va_end(ap);
 
 	return [NSArray arrayWithObjects: 

File pyobjc-core/Modules/objc/test/protocol.m

 -(void)method2:(int)v;
 @end
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wprotocol"
+#pragma clang diagnostic ignored "-Wincomplete-implementation"
 @interface OC_TestProtocolClass : NSObject <OC_TestProtocol>
 {}
 @end
 
 @implementation OC_TestProtocolClass
 @end
+#pragma clang diagnostic pop
 
 static PyMethodDef mod_methods[] = {
 	{ 0, 0, 0, 0 }

File pyobjc-core/Modules/objc/test/pythonset.m

 /* copying */
 +(id)set:(NSSet*)set copyWithZone:(NSZone*)zone
 {
-	return [set copyWithZone:zone];
+	return [[set copyWithZone:zone] autorelease];
 }
 
 +(id)set:(NSSet*)set mutableCopyWithZone:(NSZone*)zone
 {
-	return [set mutableCopyWithZone:zone];
+	return [[set mutableCopyWithZone:zone] autorelease];
 }
 
 

File pyobjc-core/Modules/objc/test/specialtypecodes.m

 
 -(char)int8Value
 {
-	char result = gTextCharValues[_idx];
+	char result = gNumCharValues[_idx];
 	_idx = (_idx + 1) % (sizeof(gNumCharValues)/sizeof(char));
 	return result;
 }
 	for (i = 0; value[i] != 0; i++) {
 		[a addObject:[NSNumber numberWithInt:value[i]]];
 	}
-	return a;
+	return [a autorelease];
 }
 
 -(NSObject*)int8Arg:(char)a andint8Arg:(char)b

File pyobjc-core/Modules/objc/test/structs.m

 
 	return [object arrayOf4Structs:structs];
 }
--(NSObject*)arrayOf4Structs:(struct FooStruct[4])argument;
+-(NSObject*)arrayOf4Structs:(struct FooStruct[4])argument
 {
 	return [NSData dataWithBytes:(void*)argument length:sizeof(argument)];
 }

File pyobjc-core/Modules/objc/test/testbndl.m

 	g_idx = 0;
 }
 
-+ (long long)longlongClsFunc;
++ (long long)longlongClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_longlongs)) g_idx = 0;
 	return g_longlongs[g_idx++];
 	return g_ulonglongs[g_idx++];
 }
 
-+ (long)longClsFunc;
++ (long)longClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_longs)) g_idx = 0;
 	return g_longs[g_idx++];
 	return g_ulongs[g_idx++];
 }
 
-+ (int)intClsFunc;
++ (int)intClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_ints)) g_idx = 0;
 	return g_ints[g_idx++];
 	return g_ushorts[g_idx++];
 }
 
-+ (char)charClsFunc;
++ (char)charClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_chars)) g_idx = 0;
 	return g_chars[g_idx++];
 }
 
-+ (unsigned char)ucharClsFunc;
++ (unsigned char)ucharClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_uchars)) g_idx = 0;
 	return g_uchars[g_idx++];
 }
 
-+ (float)floatClsFunc;
++ (float)floatClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_floats)) g_idx = 0;
 	return g_floats[g_idx++];
 }
 
-+ (double)doubleClsFunc;
++ (double)doubleClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_doubles)) g_idx = 0;
 	return g_doubles[g_idx++];
 }
 
-+ (char*)charpClsFunc;
++ (char*)charpClsFunc
 {
 	if (g_idx > ARRAYSIZE(g_charps)) g_idx = 0;
 	return g_charps[g_idx++];
 }
 
-+ (id)idClsFunc;
++ (id)idClsFunc
 {
 	if (g_idx > 3) g_idx = 0;
 	
 	g_idx = 0;
 }
 
-- (long long)longlongFunc;
+- (long long)longlongFunc
 {
 	if (g_idx > ARRAYSIZE(g_longlongs)) g_idx = 0;
 	return g_longlongs[g_idx++];
 	return g_ulonglongs[g_idx++];
 }
 
-- (long)longFunc;
+- (long)longFunc
 {
 	if (g_idx > ARRAYSIZE(g_longs)) g_idx = 0;
 	return g_longs[g_idx++];
 	return g_ulongs[g_idx++];
 }
 
-- (int)intFunc;
+- (int)intFunc
 {
 	if (g_idx > ARRAYSIZE(g_ints)) g_idx = 0;
 	return g_ints[g_idx++];
 	return g_ushorts[g_idx++];
 }
 
-- (char)charFunc;
+- (char)charFunc
 {
 	if (g_idx > ARRAYSIZE(g_chars)) g_idx = 0;
 	return g_chars[g_idx++];
 }
 
-- (unsigned char)ucharFunc;
+- (unsigned char)ucharFunc
 {
 	if (g_idx > ARRAYSIZE(g_uchars)) g_idx = 0;
 	return g_uchars[g_idx++];
 }
 
-- (float)floatFunc;
+- (float)floatFunc
 {
 	if (g_idx > ARRAYSIZE(g_floats)) g_idx = 0;
 	return g_floats[g_idx++];
 }
 
-- (double)doubleFunc;
+- (double)doubleFunc
 {
 	if (g_idx > ARRAYSIZE(g_doubles)) g_idx = 0;
 	return g_doubles[g_idx++];
 }
 
-- (char*)charpFunc;
+- (char*)charpFunc
 {
 	if (g_idx > ARRAYSIZE(g_charps)) g_idx = 0;
 	return g_charps[g_idx++];
 }
 
-- (id)idFunc;
+- (id)idFunc
 {
 	if (g_idx > 3) g_idx = 0;
 	
 	return result;
 }
 
-- (char)passInChar:(char*)arg;
+- (char)passInChar:(char*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutChar:(char*)arg;
+- (void)passOutChar:(char*)arg
 {
 	if (g_idx > ARRAYSIZE(g_ints)) g_idx = 0;
 	*arg = g_chars[g_idx++];
 }
 
-- (void)passInOutChar:(char*)arg;
+- (void)passInOutChar:(char*)arg
 {
 	*arg += 42;
 }
 
-- (unsigned char)passInUChar:(unsigned char*)arg;
+- (unsigned char)passInUChar:(unsigned char*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutUChar:(unsigned char*)arg;
+- (void)passOutUChar:(unsigned char*)arg
 {
 	if (g_idx > ARRAYSIZE(g_uchars)) g_idx = 0;
 	*arg = g_uchars[g_idx++];
 }
 
-- (void)passInOutUChar:(unsigned char*)arg;
+- (void)passInOutUChar:(unsigned char*)arg
 {
 	*arg += 42;
 }
 
-- (short)passInShort:(short*)arg;
+- (short)passInShort:(short*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutShort:(short*)arg;
+- (void)passOutShort:(short*)arg
 {
 	if (g_idx > ARRAYSIZE(g_shorts)) g_idx = 0;
 	*arg = g_shorts[g_idx++];
 }
 
-- (void)passInOutShort:(short*)arg;
+- (void)passInOutShort:(short*)arg
 {
 	*arg += 42;
 }
 
-- (unsigned short)passInUShort:(unsigned short*)arg;
+- (unsigned short)passInUShort:(unsigned short*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutUShort:(unsigned short*)arg;
+- (void)passOutUShort:(unsigned short*)arg
 {
 	if (g_idx > ARRAYSIZE(g_ushorts)) g_idx = 0;
 	*arg = g_ushorts[g_idx++];
 }
 
-- (void)passInOutUShort:(unsigned short*)arg;
+- (void)passInOutUShort:(unsigned short*)arg
 {
 	*arg += 42;
 }
 
-- (int)passInInt:(int*)arg;
+- (int)passInInt:(int*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutInt:(int*)arg;
+- (void)passOutInt:(int*)arg
 {
 	if (g_idx > ARRAYSIZE(g_ints)) g_idx = 0;
 	*arg = g_ints[g_idx++];
 }
 
-- (void)passInOutInt:(int*)arg;
+- (void)passInOutInt:(int*)arg
 {
 	*arg += 42;
 }
 
-- (unsigned int)passInUInt:(unsigned int*)arg;
+- (unsigned int)passInUInt:(unsigned int*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutUInt:(unsigned int*)arg;
+- (void)passOutUInt:(unsigned int*)arg
 {
 	if (g_idx > ARRAYSIZE(g_uints)) g_idx = 0;
 	*arg = g_uints[g_idx++];
 }
 
-- (void)passInOutUInt:(unsigned int*)arg;
+- (void)passInOutUInt:(unsigned int*)arg
 {
 	*arg += 42;
 }
 
-- (long)passInLong:(long*)arg;
+- (long)passInLong:(long*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutLong:(long*)arg;
+- (void)passOutLong:(long*)arg
 {
 	if (g_idx > ARRAYSIZE(g_longs)) g_idx = 0;
 	*arg = g_longs[g_idx++];
 }
 
-- (void)passInOutLong:(long*)arg;
+- (void)passInOutLong:(long*)arg
 {
 	*arg += 42;
 }
 
-- (unsigned long)passInULong:(unsigned long*)arg;
+- (unsigned long)passInULong:(unsigned long*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutULong:(unsigned long*)arg;
+- (void)passOutULong:(unsigned long*)arg
 {
 	if (g_idx > ARRAYSIZE(g_ulongs)) g_idx = 0;
 	*arg = g_ulongs[g_idx++];
 }
 
-- (void)passInOutULong:(unsigned long*)arg;
+- (void)passInOutULong:(unsigned long*)arg
 {
 	*arg += 42;
 }
 
-- (long long)passInLongLong:(long long*)arg;
+- (long long)passInLongLong:(long long*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutLongLong:(long long*)arg;
+- (void)passOutLongLong:(long long*)arg
 {
 	if (g_idx > ARRAYSIZE(g_longlongs)) g_idx = 0;
 	*arg = g_longlongs[g_idx++];
 }
 
-- (void)passInOutLongLong:(long long*)arg;
+- (void)passInOutLongLong:(long long*)arg
 {
 	*arg += 42;
 }
 
-- (unsigned long long)passInULongLong:(unsigned long long*)arg;
+- (unsigned long long)passInULongLong:(unsigned long long*)arg
 {
 	return *arg + 9;
 }
 
-- (void)passOutULongLong:(unsigned long long*)arg;
+- (void)passOutULongLong:(unsigned long long*)arg
 {
 	if (g_idx > ARRAYSIZE(g_ulonglongs)) g_idx = 0;
 	*arg = g_ulonglongs[g_idx++];
 }
 
-- (void)passInOutULongLong:(unsigned long long*)arg;
+- (void)passInOutULongLong:(unsigned long long*)arg
 {
 	*arg += 42;
 }
 
-- (float)passInFloat:(float*)arg;
+- (float)passInFloat:(float*)arg
 {
 	return *arg * 9;
 }
 
-- (void)passOutFloat:(float*)arg;
+- (void)passOutFloat:(float*)arg
 {
 	if (g_idx > ARRAYSIZE(g_floats)) g_idx = 0;
 	*arg = g_floats[g_idx++];
 }
 
-- (void)passInOutFloat:(float*)arg;
+- (void)passInOutFloat:(float*)arg
 {
 	*arg *= 42;
 }
 
-- (double)passInDouble:(double*)arg;
+- (double)passInDouble:(double*)arg
 {
 	return *arg * 9;
 }
 
-- (void)passOutDouble:(double*)arg;
+- (void)passOutDouble:(double*)arg
 {
 	if (g_idx > ARRAYSIZE(g_doubles)) g_idx = 0;
 	*arg = g_doubles[g_idx++];
 }
 
-- (void)passInOutDouble:(double*)arg;
+- (void)passInOutDouble:(double*)arg
 {
 	*arg *= 42;
 }
 
-- (char*)passInCharp:(char**)arg;
+- (char*)passInCharp:(char**)arg
 {
 	/* Yes this is leaking, but we're only testing method calling */
 	int len = strlen(*arg);
 	return res;
 }
 
-- (void)passOutCharp:(char**)arg;
+- (void)passOutCharp:(char**)arg
 {
 	if (g_idx > ARRAYSIZE(g_charps)) g_idx = 0;
 	*arg = g_charps[g_idx++];
 }
 
-- (void)passInOutCharp:(char**)arg;
+- (void)passInOutCharp:(char**)arg
 {
 	/* Yes this is leaking, but we're only testing method calling */
 	int len = strlen(*arg);
 	*arg = res;
 }
 
-- (id)passInID:(id*)arg;
+- (id)passInID:(id*)arg
 {
 	id temp;
 
 	return [NSArray arrayWithObject:temp];
 }
 
-- (void)passOutID:(id*)arg;
+- (void)passOutID:(id*)arg
 {
 	if (g_idx > 3) g_idx = 0;
 	
 	}
 }
 
-- (void)passInOutID:(id*)arg;
+- (void)passInOutID:(id*)arg
 {
 	id temp;
 
 	return [arg nspointFunc];
 }
 
-- (long long)callInstanceLongLongArg:(long long)arg on:(OC_TestClass1*)obj;
+- (long long)callInstanceLongLongArg:(long long)arg on:(OC_TestClass1*)obj
 {
 	return [obj longlongArg:arg];
 }
 
-- (unsigned long long)callInstanceUnsignedLongLongArg:(unsigned long long)arg on:(OC_TestClass1*)obj;
+- (unsigned long long)callInstanceUnsignedLongLongArg:(unsigned long long)arg on:(OC_TestClass1*)obj
 {
 	return [obj ulonglongArg:arg];
 }
 
-- (long)callInstanceLongArg:(long)arg on:(OC_TestClass1*)obj;
+- (long)callInstanceLongArg:(long)arg on:(OC_TestClass1*)obj
 {
 	return [obj longArg:arg];
 }
 
-- (unsigned long)callInstanceUnsignedLongArg:(unsigned long)arg on:(OC_TestClass1*)obj;
+- (unsigned long)callInstanceUnsignedLongArg:(unsigned long)arg on:(OC_TestClass1*)obj
 {
 	return [obj ulongArg:arg];
 }
 
-- (int)callInstanceIntArg:(int)arg on:(OC_TestClass1*)obj;
+- (int)callInstanceIntArg:(int)arg on:(OC_TestClass1*)obj
 {
 	return [obj intArg:arg];
 }
 
-- (unsigned int)callInstanceUnsignedIntArg:(unsigned int)arg on:(OC_TestClass1*)obj;
+- (unsigned int)callInstanceUnsignedIntArg:(unsigned int)arg on:(OC_TestClass1*)obj
 {
 	return [obj uintArg:arg];
 }
 
-- (short)callInstanceShortArg:(short)arg on:(OC_TestClass1*)obj;
+- (short)callInstanceShortArg:(short)arg on:(OC_TestClass1*)obj
 {
 	return [obj shortArg:arg];
 }
 
-- (unsigned short)callInstanceUnsignedShortArg:(unsigned short)arg on:(OC_TestClass1*)obj;
+- (unsigned short)callInstanceUnsignedShortArg:(unsigned short)arg on:(OC_TestClass1*)obj
 {
 	return [obj ushortArg:arg];
 }
 
-- (char)callInstanceCharArg:(char)arg on:(OC_TestClass1*)obj;
+- (char)callInstanceCharArg:(char)arg on:(OC_TestClass1*)obj
 {
 	return [obj charArg:arg];
 }
 
-- (unsigned char)callInstanceUnsignedCharArg:(unsigned char)arg on:(OC_TestClass1*)obj;
+- (unsigned char)callInstanceUnsignedCharArg:(unsigned char)arg on:(OC_TestClass1*)obj
 {
 	return [obj ucharArg:arg];
 }
 
-- (float)callInstanceFloatArg:(float)arg on:(OC_TestClass1*)obj;
+- (float)callInstanceFloatArg:(float)arg on:(OC_TestClass1*)obj
 {
 	return [obj floatArg:arg];
 }
 
-- (double)callInstanceDoubleArg:(double)arg on:(OC_TestClass1*)obj;
+- (double)callInstanceDoubleArg:(double)arg on:(OC_TestClass1*)obj
 {
 	return [obj doubleArg:arg];
 }
 
-- (char*)callInstanceCharpArg:(char*)arg on:(OC_TestClass1*)obj;
+- (char*)callInstanceCharpArg:(char*)arg on:(OC_TestClass1*)obj
 {
 	return [obj charpArg:arg];
 }
 
-- (id)callInstanceIdArg:(id)arg on:(OC_TestClass1*)obj;
+- (id)callInstanceIdArg:(id)arg on:(OC_TestClass1*)obj
 {
 	return [obj idArg:arg];
 }
 	return res;
 }
 
-- (long long)invokeInstanceLongLongArg:(long long)arg on:(OC_TestClass1*)obj;
+- (long long)invokeInstanceLongLongArg:(long long)arg on:(OC_TestClass1*)obj
 {
 	long long res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (unsigned long long)invokeInstanceUnsignedLongLongArg:(unsigned long long)arg on:(OC_TestClass1*)obj;
+- (unsigned long long)invokeInstanceUnsignedLongLongArg:(unsigned long long)arg on:(OC_TestClass1*)obj
 {
 	unsigned long long res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (long)invokeInstanceLongArg:(long)arg on:(OC_TestClass1*)obj;
+- (long)invokeInstanceLongArg:(long)arg on:(OC_TestClass1*)obj
 {
 	long res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (unsigned long)invokeInstanceUnsignedLongArg:(unsigned long)arg on:(OC_TestClass1*)obj;
+- (unsigned long)invokeInstanceUnsignedLongArg:(unsigned long)arg on:(OC_TestClass1*)obj
 {
 	unsigned long res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (int)invokeInstanceIntArg:(int)arg on:(OC_TestClass1*)obj;
+- (int)invokeInstanceIntArg:(int)arg on:(OC_TestClass1*)obj
 {
 	int res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (unsigned int)invokeInstanceUnsignedIntArg:(unsigned int)arg on:(OC_TestClass1*)obj;
+- (unsigned int)invokeInstanceUnsignedIntArg:(unsigned int)arg on:(OC_TestClass1*)obj
 {
 	unsigned int res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (short)invokeInstanceShortArg:(short)arg on:(OC_TestClass1*)obj;
+- (short)invokeInstanceShortArg:(short)arg on:(OC_TestClass1*)obj
 {
 	short res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (unsigned short)invokeInstanceUnsignedShortArg:(unsigned short)arg on:(OC_TestClass1*)obj;
+- (unsigned short)invokeInstanceUnsignedShortArg:(unsigned short)arg on:(OC_TestClass1*)obj
 {
 	unsigned short res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (char)invokeInstanceCharArg:(char)arg on:(OC_TestClass1*)obj;
+- (char)invokeInstanceCharArg:(char)arg on:(OC_TestClass1*)obj
 {
 	char res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (unsigned char)invokeInstanceUnsignedCharArg:(unsigned char)arg on:(OC_TestClass1*)obj;
+- (unsigned char)invokeInstanceUnsignedCharArg:(unsigned char)arg on:(OC_TestClass1*)obj
 {
 	unsigned char res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (float)invokeInstanceFloatArg:(float)arg on:(OC_TestClass1*)obj;
+- (float)invokeInstanceFloatArg:(float)arg on:(OC_TestClass1*)obj
 {
 	float res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (double)invokeInstanceDoubleArg:(double)arg on:(OC_TestClass1*)obj;
+- (double)invokeInstanceDoubleArg:(double)arg on:(OC_TestClass1*)obj
 {
 	double res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (char*)invokeInstanceCharpArg:(char*)arg on:(OC_TestClass1*)obj;
+- (char*)invokeInstanceCharpArg:(char*)arg on:(OC_TestClass1*)obj
 {
 	char* res;
 	NSInvocation* inv;
 	return res;
 }
 
-- (id)invokeInstanceIdArg:(id)arg on:(OC_TestClass1*)obj;
+- (id)invokeInstanceIdArg:(id)arg on:(OC_TestClass1*)obj
 {
 	id res;
 	NSInvocation* inv;
 {
 }
 +createAHostWithAddress:(NSString*)address;
-+makeACopy:source;
-+makeDataWithBytes:(Class)cls method:(int)i;
++copyValue:source;
+#if 0
++newDataWithBytes:(Class)cls method:(int)i;
 +makeDictFromClass:(Class)cls method:(int)i;
+#endif
 +getBytes:(NSData*)data;
 +keyValue:(int)idx forObject: value key: id;
 +(void)setKeyValue:(int)idx forObject: object key: key value: value;
 	}
 }
 
-
-+makeDataWithBytes:(Class)cls method:(int)i
+#if 0
++newDataWithBytes:(Class)cls method:(int)i
 {
 	if (i == 0) {
 		return [cls dataWithBytes:"hello world" length:sizeof("hello world")-1];
 		return [o initWithBytes:"hello world" length:sizeof("hello world")-1];
 	}
 }
+#endif
 
+#if 0
 +makeDictFromClass:(Class)cls method:(int)i
 {
 	id objects[4];
 				forKeys:keys count:4];
 	}
 }
+#endif
 
 
-+makeACopy:source
++copyValue:source
 {
 	id theCopy;
 	id pool;
 	}
 }
 
-+(NSObject*)createObservedOfClass:(Class)class observer:(NSObject*)obj keyPath:(NSString*)path
++(NSObject*)makeObservedOfClass:(Class)theClass observer:(NSObject*)obj keyPath:(NSString*)path
 {
 #if defined (MAC_OS_X_VERSION_10_3) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
-	NSObject* o = [[class alloc] init];
+	NSObject* o = [[[theClass alloc] init] autorelease];
 	[o addObserver:obj
 	   forKeyPath:path
 	   options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld
 #else
 	/* Use arguments */
 	int i;
-	i = (int)&class; i = (int)&obj; i = (int)&path;
+	i = (int)&theClass; i = (int)&obj; i = (int)&path;
 	return nil;
 #endif
 }
 	[pool release];
 }
 
-- (id)returnObject;
+- (id)returnObject
 {
 	return returnObject;
 }
     return self;
 }
 
-- (NSString *) indirectString; { return indirectString; }
-- (void) setIndirectString: (NSString *) aString;
+- (NSString *) indirectString { return indirectString; }
+- (void) setIndirectString: (NSString *) aString
 {
     [aString retain];
     [indirectString release];
     indirectString = aString;
 }
 
-- (NSNumber *) indirectNumber; { return indirectNumber; }
-- (void) setIndirectNumber: (NSNumber *) aNumber;
+- (NSNumber *) indirectNumber { return indirectNumber; }
+- (void) setIndirectNumber: (NSNumber *) aNumber
 {
     [aNumber retain];
     [indirectNumber release];
 }
 
 - (PyObjCTest_KVBaseClass *) indirectHead { return indirectHead; } 
-- (void) setInidrectHead: (PyObjCTest_KVBaseClass *) aHead;
+- (void) setInidrectHead: (PyObjCTest_KVBaseClass *) aHead
 {
     [aHead retain];
     [indirectHead release];

File pyobjc-core/Modules/objc/test/testbndl2.m

 {
 	g_idx = 0;
 }
--(void)reset;
+-(void)reset
 {
 	g_idx = 0;
 }
 	return g_bool_values[g_idx++];
 }
 
--(bool)boolMethod;
+-(bool)boolMethod
 {
 	if (g_idx > 2) g_idx = 0;
 	return g_bool_values[g_idx++];
 	return g_BOOL_values[g_idx++];
 }
 
--(BOOL)BOOLMethod;
+-(BOOL)BOOLMethod
 {
 	if (g_idx > 2) g_idx = 0;
 	return g_BOOL_values[g_idx++];
 	return g_char_values[g_idx++];
 }
 
--(char)charMethod;
+-(char)charMethod
 {
 	if (g_idx > 3) g_idx = 0;
 	return g_char_values[g_idx++];
 	return g_signedshort_values[g_idx++];
 }
 
--(signed short)signedshortMethod;
+-(signed short)signedshortMethod
 {
 	if (g_idx > 5) g_idx = 0;
 	return g_signedshort_values[g_idx++];
 	return g_signedint_values[g_idx++];
 }
 
--(signed int)signedintMethod;
+-(signed int)signedintMethod
 {
 	if (g_idx > 5) g_idx = 0;
 	return g_signedint_values[g_idx++];
 	return g_signedlong_values[g_idx++];
 }
 
--(signed long)signedlongMethod;
+-(signed long)signedlongMethod
 {
 	if (g_idx > 5) g_idx = 0;
 	return g_signedlong_values[g_idx++];
 	return g_signedlonglong_values[g_idx++];
 }
 
--(signed long long)signedlonglongMethod;
+-(signed long long)signedlonglongMethod
 {
 	if (g_idx > 5) g_idx = 0;
 	return g_signedlonglong_values[g_idx++];
 	return g_unsignedchar_values[g_idx++];
 }
 
--(unsigned char)unsignedcharMethod;
+-(unsigned char)unsignedcharMethod
 {
 	if (g_idx > 3) g_idx = 0;
 	return g_unsignedchar_values[g_idx++];
 	return g_unsignedshort_values[g_idx++];
 }
 
--(unsigned short)unsignedshortMethod;
+-(unsigned short)unsignedshortMethod
 {
 	if (g_idx > 3) g_idx = 0;
 	return g_unsignedshort_values[g_idx++];
 	return g_unsignedint_values[g_idx++];
 }
 
--(unsigned int)unsignedintMethod;
+-(unsigned int)unsignedintMethod
 {
 	if (g_idx > 3) g_idx = 0;
 	return g_unsignedint_values[g_idx++];
 	return g_unsignedlong_values[g_idx++];
 }
 
--(unsigned long)unsignedlongMethod;
+-(unsigned long)unsignedlongMethod
 {
 	if (g_idx > 3) g_idx = 0;
 	return g_unsignedlong_values[g_idx++];
 	return g_unsignedlonglong_values[g_idx++];
 }
 
--(unsigned long long)unsignedlonglongMethod;
+-(unsigned long long)unsignedlonglongMethod
 {
 	if (g_idx > 3) g_idx = 0;
 	return g_unsignedlonglong_values[g_idx++];
 	return g_float_values[g_idx++];
 }
 
--(float)floatMethod;
+-(float)floatMethod
 {
 	if (g_idx > 4) g_idx = 0;
 	return g_float_values[g_idx++];