Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -154,10 +154,12 @@ [OBJCFLAGS="$OBJCFLAGS -Wsemicolon-before-method-body"]) AX_CHECK_COMPILER_FLAGS(-Wobjc-missing-property-synthesis -Werror, [OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"]) AX_CHECK_COMPILER_FLAGS(-Wsign-compare -Werror, [OBJCFLAGS="$OBJCFLAGS -Wsign-compare"]) +AX_CHECK_COMPILER_FLAGS(-Wunreachable-code -Werror, + [OBJCFLAGS="$OBJCFLAGS -Wunreachable-code"]) AC_MSG_CHECKING(whether Objective C compiler supports properties) AC_TRY_COMPILE([ @interface Foo { Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -107,14 +107,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFArray + (void)initialize Index: src/OFBlock.m ================================================================== --- src/OFBlock.m +++ src/OFBlock.m @@ -449,11 +449,8 @@ Block_release(self); } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -102,14 +102,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFConstantString + (void)load @@ -221,14 +218,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } /* * In all following methods, the constant string is converted to an * OFString_UTF8 and the message sent again. Index: src/OFCountedSet.m ================================================================== --- src/OFCountedSet.m +++ src/OFCountedSet.m @@ -94,14 +94,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFCountedSet + (void)initialize Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -118,14 +118,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFDictionary + (void)initialize Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -146,14 +146,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFMutableArray + (void)initialize Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -114,14 +114,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFMutableDictionary + (void)initialize Index: src/OFMutableSet.m ================================================================== --- src/OFMutableSet.m +++ src/OFMutableSet.m @@ -98,14 +98,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFMutableSet + (void)initialize Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -232,14 +232,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFMutableString + (void)initialize Index: src/OFNull.m ================================================================== --- src/OFNull.m +++ src/OFNull.m @@ -131,11 +131,8 @@ return OF_RETAIN_COUNT_MAX; } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end Index: src/OFSet.m ================================================================== --- src/OFSet.m +++ src/OFSet.m @@ -94,14 +94,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFSet + (void)initialize Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -200,11 +200,8 @@ return OF_RETAIN_COUNT_MAX; } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -491,14 +491,11 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } @end @implementation OFString + (void)initialize Index: src/exceptions/OFAllocFailedException.m ================================================================== --- src/exceptions/OFAllocFailedException.m +++ src/exceptions/OFAllocFailedException.m @@ -78,16 +78,13 @@ { } - (void)dealloc { - OF_UNRECOGNIZED_SELECTOR - - /* Get rid of a stupid warning */ - [super dealloc]; + OF_DEALLOC_UNSUPPORTED } - (OFString*)description { return @"Allocating an object failed!"; } @end Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -319,10 +319,27 @@ @throw e; \ } \ \ abort(); #endif +#ifdef __clang__ +# define OF_DEALLOC_UNSUPPORTED \ + [self doesNotRecognizeSelector: _cmd]; \ + \ + abort(); \ + \ + _Pragma("clang diagnostic push ignore \"-Wunreachable-code\""); \ + [super dealloc]; /* Get rid of a stupid warning */ \ + _Pragma("clang diagnostic pop"); +#else +# define OF_DEALLOC_UNSUPPORTED \ + [self doesNotRecognizeSelector: _cmd]; \ + \ + abort(); \ + \ + [super dealloc]; /* Get rid of a stupid warning */ +#endif #ifdef __cplusplus extern "C" { #endif extern id objc_getProperty(id, SEL, ptrdiff_t, BOOL);