Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Resolves/supresses build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
doovers committed Dec 7, 2020
1 parent 178750f commit d7d61dc
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
F5A7826B1BD0CEF300EC230B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1220;
ORGANIZATIONNAME = "Slack Technologies, Inc.";
TargetAttributes = {
F5A782731BD0CEF300EC230B = {
Expand All @@ -245,6 +245,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -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)";
Expand All @@ -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)";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,11 +40,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -54,14 +51,13 @@
ReferencedContainer = "container:SlackTextViewController.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -77,8 +73,6 @@
ReferencedContainer = "container:SlackTextViewController.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
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 = "0900"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,9 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F5B4E78D1C4DA053005CBBE0"
BuildableName = "SlackTextViewControllerTests.xctest"
BlueprintName = "SlackTextViewControllerTests"
ReferencedContainer = "container:SlackTextViewController.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -41,23 +49,11 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F5B4E78D1C4DA053005CBBE0"
BuildableName = "SlackTextViewControllerTests.xctest"
BlueprintName = "SlackTextViewControllerTests"
ReferencedContainer = "container:SlackTextViewController.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -73,8 +69,6 @@
ReferencedContainer = "container:SlackTextViewController.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
8 changes: 6 additions & 2 deletions Source/SLKTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ - (NSUInteger)numberOfLines
- (NSUInteger)maxNumberOfLines
{
NSUInteger numberOfLines = _maxNumberOfLines;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
if (SLK_IS_LANDSCAPE) {
#pragma clang diagnostic pop
if ((SLK_IS_IPHONE4 || SLK_IS_IPHONE5)) {
numberOfLines = 2.0; // 2 lines max on smaller iPhones
}
Expand Down Expand Up @@ -781,9 +783,11 @@ - (void)slk_presentFormattingMenu:(id)sender
NSLayoutManager *manager = self.layoutManager;
CGRect targetRect = [manager boundingRectForGlyphRange:self.selectedRange inTextContainer:self.textContainer];

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
[menu setTargetRect:targetRect inView:self];

[menu setMenuVisible:YES animated:YES];
#pragma clang diagnostic pop
}

- (NSString *)slk_formattingTitleFromSelector:(SEL)selector
Expand Down
29 changes: 24 additions & 5 deletions Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ - (void)slk_commonInit
self.keyboardPanningEnabled = YES;
self.shouldClearTextAtRightButtonPress = YES;
self.shouldScrollToBottomAfterKeyboardShows = NO;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
self.automaticallyAdjustsScrollViewInsets = YES;
#pragma clang diagnostic pop
self.extendedLayoutIncludesOpaqueBars = YES;
}

Expand Down Expand Up @@ -467,13 +469,18 @@ - (CGFloat)slk_topBarsHeight

CGFloat topBarsHeight = CGRectGetHeight(self.navigationController.navigationBar.frame);

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
if ((SLK_IS_IPHONE && SLK_IS_LANDSCAPE && SLK_IS_IOS8_AND_HIGHER) ||
#pragma clang diagnostic pop
(SLK_IS_IPAD && self.modalPresentationStyle == UIModalPresentationFormSheet) ||
self.isPresentedInPopover) {
return topBarsHeight;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
topBarsHeight += CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
#pragma clang diagnostic pop

return topBarsHeight;
}
Expand Down Expand Up @@ -1170,7 +1177,10 @@ - (void)slk_postKeyboarStatusNotification:(NSNotification *)notification
CGRect endFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];

// Fixes iOS7 oddness with inverted values on landscape orientation
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
if (!SLK_IS_IOS8_AND_HIGHER && SLK_IS_LANDSCAPE) {
#pragma clang diagnostic pop
beginFrame = SLKRectInvert(beginFrame);
endFrame = SLKRectInvert(endFrame);
}
Expand Down Expand Up @@ -1780,13 +1790,13 @@ - (void)slk_processTextForAutoCompletion
if (prefix.length > 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];
}
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Source/SLKUIConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d7d61dc

Please sign in to comment.