diff --git a/Core/COCrossPersistentRootDeadRelationshipCache.h b/Core/COCrossPersistentRootDeadRelationshipCache.h index c809b80c1..648f7394e 100644 --- a/Core/COCrossPersistentRootDeadRelationshipCache.h +++ b/Core/COCrossPersistentRootDeadRelationshipCache.h @@ -58,8 +58,8 @@ NS_ASSUME_NONNULL_BEGIN * persistent root incoming relationships from the reloading). * * For referring object graph contexts, when unloaded or finalized, the - * deallocation will trigger their removal of their inner objects from the hash - * tables in the cache on 10.8 or iOS 6 or higher, but not on 10.7. + * deallocation will trigger their removal of their inner objects from the hash + * tables in the cache on 10.8 or iOS 6 or higher, which we require. */ - (void)removePath: (COPath *)aPath; diff --git a/Core/COCrossPersistentRootDeadRelationshipCache.m b/Core/COCrossPersistentRootDeadRelationshipCache.m index 1cdcf6c32..de2e4e8ee 100644 --- a/Core/COCrossPersistentRootDeadRelationshipCache.m +++ b/Core/COCrossPersistentRootDeadRelationshipCache.m @@ -16,11 +16,7 @@ - (instancetype)init { SUPERINIT; _pathToReferringObjects = [NSMutableDictionary new]; -#if TARGET_OS_IPHONE _referringObjectToPaths = [NSMapTable weakToStrongObjectsMapTable]; -#else - _referringObjectToPaths = [NSMapTable mapTableWithWeakToStrongObjects]; -#endif return self; } @@ -32,14 +28,7 @@ - (void)addReferringObject: (COObject *)aReferrer if (referringObjects == nil) { - // FIXME: If we don't ditch 10.7 support, we need a reverse mapping - // from each referringObject to a path set, that can be used to remove - // the referring objects when their object graph context is discarded. -#if TARGET_OS_IPHONE referringObjects = [NSHashTable weakObjectsHashTable]; -#else - referringObjects = [NSHashTable hashTableWithWeakObjects]; -#endif _pathToReferringObjects[aPath] = referringObjects; } diff --git a/Core/COPrimitiveCollection.m b/Core/COPrimitiveCollection.m index babdb042b..d248d3498 100644 --- a/Core/COPrimitiveCollection.m +++ b/Core/COPrimitiveCollection.m @@ -83,11 +83,7 @@ - (BOOL)isMutable - (NSPointerArray *)makeBacking { -#if TARGET_OS_IPHONE return [NSPointerArray strongObjectsPointerArray]; -#else - return [NSPointerArray pointerArrayWithStrongObjects]; -#endif } - (instancetype)init @@ -250,7 +246,7 @@ - (void)insertObject: (id)anObject atIndex: (NSUInteger)index COThrowExceptionIfNotMutable(_permanentlyMutable, _temporaryMutable); COThrowExceptionIfOutOfBounds(self, index, YES); - // NSPointerArray on 10.7 doesn't allow inserting at the end using index == count, so + // NSPointerArray on 10.9 (at least) doesn't allow inserting at the end using index == count, so // call addPointer in that case as a workaround. if (index == _externalIndexToBackingIndex.count) { @@ -366,20 +362,12 @@ @implementation COUnsafeRetainedMutableArray - (NSPointerArray *)makeBacking { -#if TARGET_OS_IPHONE return [NSPointerArray weakObjectsPointerArray]; -#else - return [NSPointerArray pointerArrayWithWeakObjects]; -#endif } - (NSHashTable *)makeBackingHashTable { -#if TARGET_OS_IPHONE return [NSHashTable weakObjectsHashTable]; -#else - return [NSHashTable hashTableWithWeakObjects]; -#endif } - (instancetype)initWithObjects: (const id[])objects count: (NSUInteger)count @@ -672,11 +660,7 @@ @implementation COUnsafeRetainedMutableSet - (NSHashTable *)makeBacking { -#if TARGET_OS_IPHONE return [NSHashTable weakObjectsHashTable]; -#else - return [NSHashTable hashTableWithWeakObjects]; -#endif } @end diff --git a/CoreObject.xcodeproj/project.pbxproj b/CoreObject.xcodeproj/project.pbxproj index b3b08988e..8e465c9db 100644 --- a/CoreObject.xcodeproj/project.pbxproj +++ b/CoreObject.xcodeproj/project.pbxproj @@ -2958,7 +2958,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = ""; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Étoilé"; TargetAttributes = { 60E08C6119792BEA00D1B7AD = { @@ -4248,23 +4248,35 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_GENERATE_TEST_COVERAGE_FILES = YES; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + 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; IPHONEOS_DEPLOYMENT_TARGET = 7.0; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DDEBUG"; SDKROOT = macosx; @@ -4279,18 +4291,30 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + 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; IPHONEOS_DEPLOYMENT_TARGET = 7.0; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = macosx; WARNING_CFLAGS = ( "-Wall", diff --git a/CoreObject.xcodeproj/xcshareddata/xcschemes/BasicPersistence.xcscheme b/CoreObject.xcodeproj/xcshareddata/xcschemes/BasicPersistence.xcscheme index 1049ebc42..c14d49ea1 100644 --- a/CoreObject.xcodeproj/xcshareddata/xcschemes/BasicPersistence.xcscheme +++ b/CoreObject.xcodeproj/xcshareddata/xcschemes/BasicPersistence.xcscheme @@ -1,6 +1,6 @@ COItem attribute value -/* - * Returning the parsed value as a NSNumber rather a NSDecimalNumber to ensure - * the rounding is the same than the serialized NSNumber object. - * - * Without this workaround, 123.456789012 roundtrip doesn't succeed on 10.7 (see - * -testJSONDoubleEquality in TestItem.m)). - * - * For 123.456789012, NSJSONSerialization returns a NSDecimalNumber, but the - * rounding doesn't produce the same internal representation than a NSNumber - * initialized with the same double value. - */ -static inline NSNumber *basicNumberFromDecimalNumber(NSNumber *aValue) -{ - return @(aValue.description.doubleValue); -} - static id valueForPrimitivePlistValue(id aValue, COType aType) { if (aValue == [NSNull null]) @@ -195,7 +179,7 @@ static id valueForPrimitivePlistValue(id aValue, COType aType) case kCOTypeInt64: return aValue; case kCOTypeDouble: - return basicNumberFromDecimalNumber(aValue); + return aValue; case kCOTypeString: return aValue; case kCOTypeAttachment: diff --git a/Store/COSQLiteStore.m b/Store/COSQLiteStore.m index 4a03a79bf..71d597f5a 100644 --- a/Store/COSQLiteStore.m +++ b/Store/COSQLiteStore.m @@ -125,12 +125,12 @@ - (void)dealloc db_ = nil; }); -#if !(TARGET_OS_IPHONE) - // N.B.: We are using deployment target 10.7, so ARC does not manage libdispatch objects. - // If we switch to deployment target 10.8, ARC will manage libdispatch objects automatically. - // For GNUstep, ARC doesn't manage libdispatch objects since libobjc2 doesn't support it +#if defined(GNUSTEP) + // N.B.: We are using deployment target 10.8, so ARC will manage + // libdispatch objects automatically. For GNUstep, ARC doesn't + // manage libdispatch objects since libobjc2 doesn't support it // currently (we compile CoreObject with -DOS_OBJECT_USE_OBJC=0). - dispatch_release(queue_); + dispatch_release(_queue); #endif } diff --git a/Tests/StorageDataModel/TestItem.m b/Tests/StorageDataModel/TestItem.m index 6904b7e9f..3a1a49ed8 100644 --- a/Tests/StorageDataModel/TestItem.m +++ b/Tests/StorageDataModel/TestItem.m @@ -82,16 +82,12 @@ - (void)testJSONDoubleEquality NSNumber *newValueFromDesc = @(roundTripValue.description.doubleValue); #ifndef GNUSTEP - // NOTE: Doesn't matter on GNUstep since newValue is not a NSDecimalNumber, - // and we don't have to convert it into a NSDoubleNumber (unlike on 10.7). + // NOTE: Doesn't matter on GNUstep since newValue is not a NSDecimalNumber. UKTrue([[NSDecimalNumber defaultBehavior] scale] == NSDecimalNoScale); #endif NSLog(@"Double representation in JSON: %@", [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]); - - /* Rounding is visible in the ouput for numbers that contain more than two - decimals on 10.7 (e.g. 123.45 output is the same for all numbers). */ NSLog(@"value doubleValue: %.20f, description: %@, class: %@", value.doubleValue, value, [value class]); NSLog(@"decimalValue doubleValue: %.20f, description: %@, class: %@", diff --git a/Tests/TestCommon.m b/Tests/TestCommon.m index 1e0052398..22fffeb47 100644 --- a/Tests/TestCommon.m +++ b/Tests/TestCommon.m @@ -91,8 +91,6 @@ - (instancetype)init - (void)dealloc { #ifdef DELETE_STORE_AFTER_EACH_TEST_METHOD - // FIXME: For Mac OS X 10.7, this is unsupported, SQLite disk errors - // (DB Error: 10 "disk I/O error") appear in TestStoreSQLite.m. [[self class] deleteStores]; #endif } diff --git a/Undo/COUndoTrackStore+Private.h b/Undo/COUndoTrackStore+Private.h index 67d63afc7..5dc3bd061 100644 --- a/Undo/COUndoTrackStore+Private.h +++ b/Undo/COUndoTrackStore+Private.h @@ -11,22 +11,22 @@ @class FMDatabase; @class ETUUID; -NSString *const COUndoTrackStoreTrackDidChangeNotification; +extern NSString *const COUndoTrackStoreTrackDidChangeNotification; // User info keys for COUndoTrackStoreTrackDidChangeNotification -NSString *const COUndoTrackStoreTrackName; +extern NSString *const COUndoTrackStoreTrackName; /** * UUID string */ -NSString *const COUndoTrackStoreTrackHeadCommandUUID; +extern NSString *const COUndoTrackStoreTrackHeadCommandUUID; /** * NSNull or UUID string */ -NSString *const COUndoTrackStoreTrackCurrentCommandUUID; +extern NSString *const COUndoTrackStoreTrackCurrentCommandUUID; /** * NSNumber boolean */ -NSString *const COUndoTrackStoreTrackCompacted; +extern NSString *const COUndoTrackStoreTrackCompacted; @interface COUndoTrackSerializedCommand : NSObject diff --git a/Undo/COUndoTrackStore.m b/Undo/COUndoTrackStore.m index 7303a0361..312dd32d4 100644 --- a/Undo/COUndoTrackStore.m +++ b/Undo/COUndoTrackStore.m @@ -204,10 +204,9 @@ - (void)dealloc [_db close]; }); -#if !(TARGET_OS_IPHONE) - // N.B.: We are using deployment target 10.7, so ARC does not manage libdispatch objects. - // If we switch to deployment target 10.8, ARC will manage libdispatch objects automatically. - // For GNUstep, ARC doesn't manage libdispatch objects since libobjc2 doesn't support it +#if defined(GNUSTEP) + // N.B.: We are using deployment target 10.8, so ARC will manage libdispatch objects automatically. + // For GNUstep, ARC doesn't manage libdispatch objects since libobjc2 doesn't support it // currently (we compile CoreObject with -DOS_OBJECT_USE_OBJC=0). dispatch_release(_queue); dispatch_release(_transactionLock);