From d7d61dcef8e2d5b68535f9c13f30d7a9f72b584a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colm=20Du=20V=C3=A9?= Date: Mon, 7 Dec 2020 13:57:37 -0800 Subject: [PATCH] Resolves/supresses build warnings --- .../project.pbxproj | 21 ++++++++++---- .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++++ .../SlackTextViewController.xcscheme | 12 ++------ .../SlackTextViewControllerTests.xcscheme | 26 +++++++---------- Source/SLKTextView.m | 8 +++-- Source/SLKTextViewController.m | 29 +++++++++++++++---- Source/SLKUIConstants.h | 3 ++ 7 files changed, 70 insertions(+), 37 deletions(-) create mode 100644 SlackTextViewController/SlackTextViewController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/SlackTextViewController/SlackTextViewController.xcodeproj/project.pbxproj b/SlackTextViewController/SlackTextViewController.xcodeproj/project.pbxproj index 7fdd7780..66de2c7d 100644 --- a/SlackTextViewController/SlackTextViewController.xcodeproj/project.pbxproj +++ b/SlackTextViewController/SlackTextViewController.xcodeproj/project.pbxproj @@ -229,7 +229,7 @@ F5A7826B1BD0CEF300EC230B /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1220; ORGANIZATIONNAME = "Slack Technologies, Inc."; TargetAttributes = { F5A782731BD0CEF300EC230B = { @@ -245,6 +245,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -317,6 +318,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -325,14 +327,17 @@ 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; 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_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -352,13 +357,14 @@ "DEBUG=1", "$(inherited)", ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -372,6 +378,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -380,14 +387,17 @@ 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; 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_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -401,13 +411,14 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -455,7 +466,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = SlackTextViewControllerTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.slack.SlackTextViewControllerTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -466,7 +477,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = SlackTextViewControllerTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.slack.SlackTextViewControllerTests; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/SlackTextViewController/SlackTextViewController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SlackTextViewController/SlackTextViewController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/SlackTextViewController/SlackTextViewController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SlackTextViewController/SlackTextViewController.xcodeproj/xcshareddata/xcschemes/SlackTextViewController.xcscheme b/SlackTextViewController/SlackTextViewController.xcodeproj/xcshareddata/xcschemes/SlackTextViewController.xcscheme index 592f84bd..67941e3a 100644 --- a/SlackTextViewController/SlackTextViewController.xcodeproj/xcshareddata/xcschemes/SlackTextViewController.xcscheme +++ b/SlackTextViewController/SlackTextViewController.xcodeproj/xcshareddata/xcschemes/SlackTextViewController.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - + + + + @@ -41,23 +49,11 @@ - - - - - - - - 0 && word.length > 0) { // Captures the detected symbol prefix - _foundPrefix = prefix; + self->_foundPrefix = prefix; // Removes the found prefix, or not. - _foundWord = [word substringFromIndex:prefix.length]; + self->_foundWord = [word substringFromIndex:prefix.length]; // Used later for replacing the detected range with a new string alias returned in -acceptAutoCompletionWithString: - _foundPrefixRange = NSMakeRange(wordRange.location, prefix.length); + self->_foundPrefixRange = NSMakeRange(wordRange.location, prefix.length); [self slk_handleProcessedWord:word wordRange:wordRange]; } @@ -1873,7 +1883,10 @@ - (void)slk_reloadTextView cachedAttributedText = [[NSAttributedString alloc] initWithString:obj]; } else if ([obj isKindOfClass:[NSData class]]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" cachedAttributedText = [NSKeyedUnarchiver unarchiveObjectWithData:obj]; +#pragma clang diagnostic pop } } @@ -1907,13 +1920,19 @@ - (void)slk_cacheAttributedTextToDisk:(NSAttributedString *)attributedText cachedAttributedText = [[NSAttributedString alloc] initWithString:obj]; } else if ([obj isKindOfClass:[NSData class]]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" cachedAttributedText = [NSKeyedUnarchiver unarchiveObjectWithData:obj]; +#pragma clang diagnostic pop } } // Caches text only if its a valid string and not already cached if (attributedText.length > 0 && ![attributedText isEqualToAttributedString:cachedAttributedText]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" NSData *data = [NSKeyedArchiver archivedDataWithRootObject:attributedText]; +#pragma clang diagnostic pop [[NSUserDefaults standardUserDefaults] setObject:data forKey:key]; } // Clears cache only if it exists diff --git a/Source/SLKUIConstants.h b/Source/SLKUIConstants.h index 9323b12a..a7727903 100644 --- a/Source/SLKUIConstants.h +++ b/Source/SLKUIConstants.h @@ -45,7 +45,10 @@ __unused static CGFloat SLKPointSizeDifferenceForCategory(NSString *category) __unused static CGRect SLKKeyWindowBounds() { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" return [[UIApplication sharedApplication] keyWindow].bounds; +#pragma clang diagnostic pop } __unused static CGRect SLKRectInvert(CGRect rect)