From 86bd36121913ae6f05ecdb5700642278fddd7515 Mon Sep 17 00:00:00 2001 From: Simon Evans Date: Tue, 7 Nov 2017 14:20:36 +0000 Subject: [PATCH] Upgrade xcode project to latest (9.1) Recommended Settings - This enables more clang warnings which finds some issues in the CoreFoundation code. Fix some of these. --- CoreFoundation/Base.subproj/ForFoundationOnly.h | 2 +- Foundation.xcodeproj/project.pbxproj | 16 +++++++++++++--- .../xcschemes/CoreFoundation.xcscheme | 4 +++- .../xcschemes/SwiftFoundation.xcscheme | 4 +++- .../xcschemes/TestFoundation.xcscheme | 4 +++- .../xcshareddata/xcschemes/plutil.xcscheme | 4 +++- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/CoreFoundation/Base.subproj/ForFoundationOnly.h b/CoreFoundation/Base.subproj/ForFoundationOnly.h index ce31dd1040..931404c698 100644 --- a/CoreFoundation/Base.subproj/ForFoundationOnly.h +++ b/CoreFoundation/Base.subproj/ForFoundationOnly.h @@ -110,7 +110,7 @@ typedef struct { CFTypeRef _Null_unspecified (*_Null_unspecified fetchValue)(CFTypeRef context, void *domain, CFStringRef key); // Caller releases void (*_Null_unspecified writeValue)(CFTypeRef context, void *domain, CFStringRef key, CFTypeRef value); Boolean (*_Null_unspecified synchronize)(CFTypeRef context, void *domain); - void (*_Null_unspecified getKeysAndValues)(CFAllocatorRef _Nullable alloc, CFTypeRef context, void *domain, void *_Null_unspecified * _Null_unspecified buf[], CFIndex *numKeyValuePairs); + void (*_Null_unspecified getKeysAndValues)(CFAllocatorRef _Nullable alloc, CFTypeRef context, void *domain, void *_Null_unspecified * _Null_unspecified buf[_Nullable], CFIndex *numKeyValuePairs); CFDictionaryRef _Null_unspecified (*_Null_unspecified copyDomainDictionary)(CFTypeRef context, void *domain); /* HACK - see comment on _CFPreferencesDomainSetIsWorldReadable(), below */ void (*setIsWorldReadable)(CFTypeRef context, void *domain, Boolean isWorldReadable); diff --git a/Foundation.xcodeproj/project.pbxproj b/Foundation.xcodeproj/project.pbxproj index 4fff0629c4..8a006af53a 100644 --- a/Foundation.xcodeproj/project.pbxproj +++ b/Foundation.xcodeproj/project.pbxproj @@ -2028,7 +2028,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0830; + LastUpgradeCheck = 0910; ORGANIZATIONNAME = Apple; TargetAttributes = { 5B5D885C1BBC938800234F36 = { @@ -2501,14 +2501,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; CLANG_MODULES_AUTOLINK = NO; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2550,14 +2556,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_LINK_OBJC_RUNTIME = NO; CLANG_MODULES_AUTOLINK = NO; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2763,7 +2775,6 @@ "-DCF_CHARACTERSET_UNICODE_DATA_B=\\\\\"CoreFoundation/CharacterSets/CFUnicodeData-B.mapping\\\\\"", "-DCF_CHARACTERSET_UNICHAR_DB=\\\\\"CoreFoundation/CharacterSets/CFUniCharPropertyDatabase.data\\\\\"", "-DCF_CHARACTERSET_BITMAP=\\\\\"CoreFoundation/CharacterSets/CFCharacterSetBitmaps.bitmap\\\\\"", - "-Wno-nullability-completeness-on-arrays", "-Wno-format-security", ); PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/CoreFoundation; @@ -2805,7 +2816,6 @@ "-DCF_CHARACTERSET_UNICODE_DATA_B=\\\\\"CoreFoundation/CharacterSets/CFUnicodeData-B.mapping\\\\\"", "-DCF_CHARACTERSET_UNICHAR_DB=\\\\\"CoreFoundation/CharacterSets/CFUniCharPropertyDatabase.data\\\\\"", "-DCF_CHARACTERSET_BITMAP=\\\\\"CoreFoundation/CharacterSets/CFCharacterSetBitmaps.bitmap\\\\\"", - "-Wno-nullability-completeness-on-arrays", "-Wno-format-security", ); PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/CoreFoundation; diff --git a/Foundation.xcodeproj/xcshareddata/xcschemes/CoreFoundation.xcscheme b/Foundation.xcodeproj/xcshareddata/xcschemes/CoreFoundation.xcscheme index f1db99b4a5..64e7f7ed5d 100644 --- a/Foundation.xcodeproj/xcshareddata/xcschemes/CoreFoundation.xcscheme +++ b/Foundation.xcodeproj/xcshareddata/xcschemes/CoreFoundation.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Foundation.xcodeproj/xcshareddata/xcschemes/SwiftFoundation.xcscheme b/Foundation.xcodeproj/xcshareddata/xcschemes/SwiftFoundation.xcscheme index 3564f3ac11..ec0d94f872 100644 --- a/Foundation.xcodeproj/xcshareddata/xcschemes/SwiftFoundation.xcscheme +++ b/Foundation.xcodeproj/xcshareddata/xcschemes/SwiftFoundation.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Foundation.xcodeproj/xcshareddata/xcschemes/TestFoundation.xcscheme b/Foundation.xcodeproj/xcshareddata/xcschemes/TestFoundation.xcscheme index 5c822da10c..2915c01678 100644 --- a/Foundation.xcodeproj/xcshareddata/xcschemes/TestFoundation.xcscheme +++ b/Foundation.xcodeproj/xcshareddata/xcschemes/TestFoundation.xcscheme @@ -1,6 +1,6 @@ @@ -87,6 +88,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Foundation.xcodeproj/xcshareddata/xcschemes/plutil.xcscheme b/Foundation.xcodeproj/xcshareddata/xcschemes/plutil.xcscheme index 161f6cdd84..54db9a458d 100644 --- a/Foundation.xcodeproj/xcshareddata/xcschemes/plutil.xcscheme +++ b/Foundation.xcodeproj/xcshareddata/xcschemes/plutil.xcscheme @@ -1,6 +1,6 @@ @@ -59,6 +60,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO"