Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for 10.7 #74

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Core/COCrossPersistentRootDeadRelationshipCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep this comment, but change the end to

10.8 or iOS 6 or higher, which we require.

*/
- (void)removePath: (COPath *)aPath;

Expand Down
11 changes: 0 additions & 11 deletions Core/COCrossPersistentRootDeadRelationshipCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ - (instancetype)init
{
SUPERINIT;
_pathToReferringObjects = [NSMutableDictionary new];
#if TARGET_OS_IPHONE
_referringObjectToPaths = [NSMapTable weakToStrongObjectsMapTable];
#else
_referringObjectToPaths = [NSMapTable mapTableWithWeakToStrongObjects];
#endif
return self;
}

Expand All @@ -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;
}
Expand Down
18 changes: 1 addition & 17 deletions Core/COPrimitiveCollection.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ - (BOOL)isMutable

- (NSPointerArray *)makeBacking
{
#if TARGET_OS_IPHONE
return [NSPointerArray strongObjectsPointerArray];
#else
return [NSPointerArray pointerArrayWithStrongObjects];
#endif
}

- (instancetype)init
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -672,11 +660,7 @@ @implementation COUnsafeRetainedMutableSet

- (NSHashTable *)makeBacking
{
#if TARGET_OS_IPHONE
return [NSHashTable weakObjectsHashTable];
#else
return [NSHashTable hashTableWithWeakObjects];
#endif
}

@end
Expand Down
30 changes: 27 additions & 3 deletions CoreObject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2958,7 +2958,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = "";
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Étoilé";
TargetAttributes = {
60E08C6119792BEA00D1B7AD = {
Expand Down Expand Up @@ -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;
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 3 additions & 5 deletions Debugging/COSQLiteStore+Graphviz.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,9 @@ void COViewDOTGraphFile(NSString *dotFilePath)
continue;
}

// NOTE: Using NSTask rather than system() breaks 'po [objectGraphContext showGraph]' in LLDB on 10.7
system([[NSString stringWithFormat: @"%@ -Tpdf '%@' -o '%@'",
executablePath,
dotFilePath,
pdfPath] UTF8String]);
NSTask *task = [NSTask launchedTaskWithLaunchPath:executablePath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A space is missing between launchedTaskWithLaunchPath: and executablePath. Same right after arguments:.

arguments:@[@"-Tpdf", dotFilePath, @"-o", pdfPath]];
[task waitUntilExit];
[[NSWorkspace sharedWorkspace] openFile: pdfPath];
break;
}
Expand Down
18 changes: 1 addition & 17 deletions StorageDataModel/COItem+JSON.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,6 @@ static id plistValueForValue(id aValue, COType aType)

// JSON-compatible plist -> 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])
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions Store/COSQLiteStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should change to #if defined(GNUSTEP)
and the start of the comment should be changed to We are using deployment target 10.8, so ARC will manage libdispatch objects automatically. For 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
}

Expand Down
6 changes: 1 addition & 5 deletions Tests/StorageDataModel/TestItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -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: %@",
Expand Down
2 changes: 0 additions & 2 deletions Tests/TestCommon.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ - (instancetype)init
- (void)dealloc
{
#ifdef DELETE_STORE_AFTER_EACH_TEST_METHOD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DELETE_STORE_AFTER_EACH_TEST_METHOD should now be defined by default or removed. @ericwa, what's your take on this?

// 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
}
Expand Down
10 changes: 5 additions & 5 deletions Undo/COUndoTrackStore+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions Undo/COUndoTrackStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should change to #if defined(GNUSTEP)
and the start of the comment should be changed to We are using deployment target 10.8, so ARC will manage libdispatch objects automatically. For 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);
Expand Down