Permalink
Browse files

Add Xcode's recommended warnings settings and fix up a few 64-bit rel…

…ated warnings
  • Loading branch information...
1 parent 3603491 commit 75695a814eb76b4ccc386b62e814f5f9b29a04c3 @mikeash committed Mar 19, 2014
Showing with 27 additions and 4 deletions.
  1. +3 −3 Source/MAZeroingWeakRef.m
  2. +1 −1 Source/main.m
  3. +23 −0 ZeroingWeakRef.xcodeproj/project.pbxproj
@@ -502,8 +502,8 @@ static BOOL IsTollFreeBridged(Class class, id obj)
static BOOL IsConstantObject(id obj)
{
- unsigned int retainCount = [obj retainCount];
- return retainCount == UINT_MAX || retainCount == INT_MAX;
+ NSUInteger retainCount = [obj retainCount];
+ return retainCount == NSUIntegerMax || retainCount == NSIntegerMax;
}
#if COREFOUNDATION_HACK_LEVEL >= 3
@@ -600,7 +600,7 @@ static BOOL CanNativeZWRClass(Class c)
const char *name = class_getName(c);
unsigned char hash[CC_SHA1_DIGEST_LENGTH];
- CC_SHA1(name, strlen(name), hash);
+ CC_SHA1(name, (CC_LONG)strlen(name), hash);
if(HashPresentInTable(hash, CC_SHA1_DIGEST_LENGTH, _MAZeroingWeakRefClassNativeWeakReferenceNotAllowedTable))
return NO;
View
@@ -273,7 +273,7 @@ static void TestCFCleanup(void)
MAZeroingWeakRef *ref = [[MAZeroingWeakRef alloc] initWithTarget: obj];
[ref setCleanupBlock: ^(id target) { cleanedUp = YES; }];
[obj release];
- TEST_ASSERT(WaitForNil(^{ return (id)!cleanedUp; })
+ TEST_ASSERT(WaitForNil(^{ return (id)(intptr_t)!cleanedUp; })
);
[ref release];
}
@@ -229,6 +229,9 @@
/* Begin PBXProject section */
C2D753FC11E2588500816068 /* Project object */ = {
isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0510;
+ };
buildConfigurationList = C2D753FF11E2588500816068 /* Build configuration list for PBXProject "ZeroingWeakRef" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
@@ -386,11 +389,21 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
@@ -401,9 +414,19 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
};

0 comments on commit 75695a8

Please sign in to comment.