From 694617ef3fd649444ed21e7e6e638b1dd6927d23 Mon Sep 17 00:00:00 2001 From: Kirk Beitz Date: Mon, 15 Jan 2018 14:11:25 -0800 Subject: [PATCH] update to Xcode 9.2, including recommendations .xcodeproj/project.pbxproj accepting the following recommendations to be fully consistent with Xcode recommendations and eliminate existing warnings when upgrading Xcode major/minor versions CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; NOS_Project.h a change required by enabling CLANG_WARN_STRICT_PROTOTYPES NOZUnzipper.m NOZUtils.m NOZZipper.m changes required by enabling CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING .xcscheme files the 'language = ""' changes are just auto-added now in Xcode 9 --- ZipUtilities.xcodeproj/project.pbxproj | 10 +++++++++- .../xcschemes/ZipUtilities Framework.xcscheme | 4 +++- .../xcschemes/ZipUtilities OSX Framework.xcscheme | 4 +++- .../xcshareddata/xcschemes/ZipUtilities.xcscheme | 4 +++- .../xcshareddata/xcschemes/ZipUtilitiesApp.xcscheme | 4 +++- .../xcschemes/libZipUtilities-mac.xcscheme | 4 +++- .../xcshareddata/xcschemes/libbrotli-mac.xcscheme | 4 +++- .../xcshareddata/xcschemes/libbrotli.xcscheme | 4 +++- .../xcshareddata/xcschemes/libzstd-mac.xcscheme | 4 +++- .../xcshareddata/xcschemes/libzstd.xcscheme | 4 +++- .../xcshareddata/xcschemes/noz.xcscheme | 4 +++- ZipUtilities/NOZUnzipper.m | 10 +++++----- ZipUtilities/NOZUtils.m | 8 ++++---- ZipUtilities/NOZZipper.m | 10 +++++----- ZipUtilities/NOZ_Project.h | 2 +- 15 files changed, 54 insertions(+), 26 deletions(-) diff --git a/ZipUtilities.xcodeproj/project.pbxproj b/ZipUtilities.xcodeproj/project.pbxproj index c86e655..17278ba 100644 --- a/ZipUtilities.xcodeproj/project.pbxproj +++ b/ZipUtilities.xcodeproj/project.pbxproj @@ -1652,7 +1652,7 @@ attributes = { CLASSPREFIX = NOZ; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0830; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = NSProgrammer; TargetAttributes = { 1C6BF76F1B74086000969629 = { @@ -2194,7 +2194,9 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -2206,6 +2208,8 @@ CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; @@ -2255,7 +2259,9 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -2267,6 +2273,8 @@ CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; diff --git a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/ZipUtilities Framework.xcscheme b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/ZipUtilities Framework.xcscheme index 5e75537..acd3048 100644 --- a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/ZipUtilities Framework.xcscheme +++ b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/ZipUtilities Framework.xcscheme @@ -1,6 +1,6 @@ @@ -45,6 +46,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libZipUtilities-mac.xcscheme b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libZipUtilities-mac.xcscheme index bcb065d..bcf3c38 100644 --- a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libZipUtilities-mac.xcscheme +++ b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libZipUtilities-mac.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/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli-mac.xcscheme b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli-mac.xcscheme index f0ecc49..c7f48e5 100644 --- a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli-mac.xcscheme +++ b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli-mac.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/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli.xcscheme b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli.xcscheme index b8f7e23..388989c 100644 --- a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli.xcscheme +++ b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libbrotli.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/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd-mac.xcscheme b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd-mac.xcscheme index 0a57e58..f0935b7 100644 --- a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd-mac.xcscheme +++ b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd-mac.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/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd.xcscheme b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd.xcscheme index feadd22..7f064cd 100644 --- a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd.xcscheme +++ b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/libzstd.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/ZipUtilities.xcodeproj/xcshareddata/xcschemes/noz.xcscheme b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/noz.xcscheme index 1a8b745..9719084 100644 --- a/ZipUtilities.xcodeproj/xcshareddata/xcschemes/noz.xcscheme +++ b/ZipUtilities.xcodeproj/xcshareddata/xcschemes/noz.xcscheme @@ -1,6 +1,6 @@ @@ -45,6 +46,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/ZipUtilities/NOZUnzipper.m b/ZipUtilities/NOZUnzipper.m index f1c1bb4..36e94ce 100644 --- a/ZipUtilities/NOZUnzipper.m +++ b/ZipUtilities/NOZUnzipper.m @@ -147,7 +147,7 @@ - (BOOL)closeAndReturnError:(out NSError **)error return YES; } -- (NOZCentralDirectory *)readCentralDirectoryAndReturnError:(out NSError **)error +- (NOZCentralDirectory *)readCentralDirectoryAndReturnError:(out NSError * __autoreleasing * )error { __block NSError *stackError = nil; noz_defer(^{ @@ -207,7 +207,7 @@ - (void)enumerateManifestEntriesUsingBlock:(NOZUnzipRecordEnumerationBlock)block - (BOOL)enumerateByteRangesOfRecord:(NOZCentralDirectoryRecord *)record progressBlock:(NOZProgressBlock)progressBlock usingBlock:(NOZUnzipByteRangeEnumerationBlock)block - error:(out NSError **)error + error:(out NSError * __autoreleasing *)error { __block NSError *stackError = nil; noz_defer(^{ @@ -330,7 +330,7 @@ - (BOOL)saveRecord:(NOZCentralDirectoryRecord *)record toDirectory:(NSString *)destinationRootDirectory options:(NOZUnzipperSaveRecordOptions)options progressBlock:(NOZProgressBlock)progressBlock - error:(out NSError **)error + error:(out NSError * __autoreleasing *)error { __block NSError *stackError = nil; noz_defer(^{ @@ -544,7 +544,7 @@ - (BOOL)private_locateCompressedDataOfRecord:(NOZCentralDirectoryRecord *)record - (BOOL)private_deflateWithProgressBlock:(NOZProgressBlock)progressBlock usingBlock:(NOZUnzipByteRangeEnumerationBlock)block - error:(out NSError **)error + error:(out NSError * __autoreleasing *)error { __block BOOL success = YES; noz_defer(^{ @@ -784,7 +784,7 @@ - (NSUInteger)indexForRecordWithName:(NSString *)name return _records; } -- (BOOL)validateCentralDirectoryAndReturnError:(NSError **)error +- (BOOL)validateCentralDirectoryAndReturnError:(NSError * __autoreleasing *)error { __block NOZErrorCode code = 0; __block NSDictionary *userInfo = nil; diff --git a/ZipUtilities/NOZUtils.m b/ZipUtilities/NOZUtils.m index 58a164e..cda348d 100644 --- a/ZipUtilities/NOZUtils.m +++ b/ZipUtilities/NOZUtils.m @@ -85,8 +85,8 @@ void NOZFileEntryCleanFree(NOZFileEntryT* entry) } } -static BOOL _NOZOpenInputOutputFiles(NSString * __nonnull sourceFilePath, FILE * __nullable * __nonnull sourceFile, NSString * __nonnull destinationFilePath, FILE * __nonnull * __nullable destinationFile, NSError * __nullable * __nullable error); -static BOOL _NOZOpenInputOutputFiles(NSString *sourceFilePath, FILE **sourceFile, NSString *destinationFilePath, FILE **destinationFile, NSError **error) +static BOOL _NOZOpenInputOutputFiles(NSString * __nonnull sourceFilePath, FILE * __nullable * __nonnull sourceFile, NSString * __nonnull destinationFilePath, FILE * __nonnull * __nullable destinationFile, NSError * __autoreleasing __nullable * __nullable error); +static BOOL _NOZOpenInputOutputFiles(NSString *sourceFilePath, FILE **sourceFile, NSString *destinationFilePath, FILE **destinationFile, NSError * __autoreleasing * error) { NSFileManager *fm = [NSFileManager defaultManager]; __block FILE *inFile = NULL; @@ -138,7 +138,7 @@ static BOOL _NOZOpenInputOutputFiles(NSString *sourceFilePath, FILE **sourceFile return YES; } -BOOL NOZEncodeFile(NSString *sourceFile, NSString *destinationFile, id encoder, NOZCompressionLevel level, NSError **error) +BOOL NOZEncodeFile(NSString *sourceFile, NSString *destinationFile, id encoder, NOZCompressionLevel level, NSError * __autoreleasing * error) { NSFileManager *fm = [NSFileManager defaultManager]; __block FILE *uncompressedFile = NULL; @@ -208,7 +208,7 @@ BOOL NOZEncodeFile(NSString *sourceFile, NSString *destinationFile, id decoder, NSError **error) +BOOL NOZDecodeFile(NSString *sourceFile, NSString *destinationFile, id decoder, NSError * __autoreleasing * error) { NSFileManager *fm = [NSFileManager defaultManager]; __block FILE *uncompressedFile = NULL; diff --git a/ZipUtilities/NOZZipper.m b/ZipUtilities/NOZZipper.m index 68d9866..ce5413b 100644 --- a/ZipUtilities/NOZZipper.m +++ b/ZipUtilities/NOZZipper.m @@ -120,7 +120,7 @@ - (void)dealloc [self private_freeLinkedList]; } -- (BOOL)openWithMode:(NOZZipperMode)mode error:(out NSError **)error +- (BOOL)openWithMode:(NOZZipperMode)mode error:(out NSError * __autoreleasing *)error { if (_internal.file) { return YES; @@ -211,7 +211,7 @@ - (BOOL)forciblyCloseAndReturnError:(out NSError **)error - (BOOL)addEntry:(id)entry progressBlock:(__attribute__((noescape)) NOZProgressBlock)progressBlock - error:(out NSError **)error + error:(out NSError * __autoreleasing *)error { __block NSError *stackError = nil; noz_defer(^{ @@ -247,7 +247,7 @@ - (BOOL)addEntry:(id)entry @implementation NOZZipper (Private) -- (BOOL)private_forciblyClose:(BOOL)forceClose error:(out NSError **)error +- (BOOL)private_forciblyClose:(BOOL)forceClose error:(out NSError * __autoreleasing *)error { if (!_internal.file) { return YES; @@ -299,7 +299,7 @@ - (BOOL)private_forciblyClose:(BOOL)forceClose error:(out NSError **)error } - (BOOL)private_openEntry:(id)entry - error:(out NSError **)error + error:(out NSError * __autoreleasing *)error { __block BOOL errorEncountered = NO; noz_defer(^{ if (errorEncountered && error) { *error = NOZErrorCreate(NOZErrorCodeZipCannotOpenNewEntry, nil); } }); @@ -380,7 +380,7 @@ - (BOOL)private_openEntry:(id)entry - (BOOL)private_writeEntry:(id)entry progressBlock:(NOZProgressBlock)progressBlock - error:(out NSError **)error + error:(out NSError * __autoreleasing *)error abortRef:(BOOL *)abort { __block BOOL success = YES; diff --git a/ZipUtilities/NOZ_Project.h b/ZipUtilities/NOZ_Project.h index c5d0eaf..a438d38 100644 --- a/ZipUtilities/NOZ_Project.h +++ b/ZipUtilities/NOZ_Project.h @@ -72,7 +72,7 @@ #define noz_defer(deferBlock) \ __strong noz_defer_block_t noz_macro_concat(__noz_stack_defer_block_, __LINE__) __attribute__((cleanup(noz_deferFunc), unused)) = deferBlock -typedef void(^noz_defer_block_t)(); +typedef void(^noz_defer_block_t)(void); NS_INLINE void noz_deferFunc(__strong noz_defer_block_t __nonnull * __nonnull blockRef) { noz_defer_block_t actualBlock = *blockRef;