Fix analyzer warnings
This commit is contained in:
parent
baacebc956
commit
ef9a0880ae
|
@ -3906,10 +3906,13 @@
|
|||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = YES;
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
|
||||
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
@ -3972,6 +3975,7 @@
|
|||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = NO;
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
|
||||
|
|
|
@ -76,6 +76,9 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
enableAddressSanitizer = "YES"
|
||||
enableASanStackUseAfterReturn = "YES"
|
||||
enableUBSanitizer = "YES"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -278,6 +278,7 @@ static NSTimeInterval launchStartedAt;
|
|||
}
|
||||
|
||||
OWSBackgroundTask *_Nullable backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
|
||||
SUPPRESS_DEADSTORE_WARNING(backgroundTask);
|
||||
|
||||
if ([NSFileManager.defaultManager fileExistsAtPath:OWSPrimaryStorage.legacyDatabaseFilePath]) {
|
||||
DDLogInfo(@"%@ Legacy Database file size: %@",
|
||||
|
@ -925,7 +926,7 @@ static NSTimeInterval launchStartedAt;
|
|||
- (void)application:(UIApplication *)application
|
||||
handleActionWithIdentifier:(NSString *)identifier
|
||||
forLocalNotification:(UILocalNotification *)notification
|
||||
completionHandler:(void (^)(void))completionHandler
|
||||
completionHandler:(void (^)())completionHandler
|
||||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@
|
|||
// TODO: Always show backup when we go to production.
|
||||
BOOL isBackupEnabled = [OWSBackup.sharedManager isBackupEnabled];
|
||||
BOOL showBackup = isBackupEnabled;
|
||||
SUPPRESS_DEADSTORE_WARNING(showBackup);
|
||||
#ifdef DEBUG
|
||||
showBackup = YES;
|
||||
#endif
|
||||
|
|
|
@ -331,7 +331,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(self.quotedTextLabel);
|
||||
|
||||
UIColor *textColor = self.quotedTextColor;
|
||||
SUPPRESS_DEADSTORE_WARNING(textColor);
|
||||
UIFont *font = self.quotedTextFont;
|
||||
SUPPRESS_DEADSTORE_WARNING(font);
|
||||
NSString *text = @"";
|
||||
|
||||
NSString *_Nullable fileTypeForSnippet = [self fileTypeForSnippet];
|
||||
|
|
|
@ -1413,13 +1413,12 @@ typedef enum : NSUInteger {
|
|||
UIColor *subtitleColor = [UIColor.ows_navbarTitleColor colorWithAlphaComponent:(CGFloat)0.9];
|
||||
if (self.thread.isMuted) {
|
||||
// Show a "mute" icon before the navigation bar subtitle if this thread is muted.
|
||||
[subtitleText
|
||||
appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@"\ue067 "
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_elegantIconsFont:7.f],
|
||||
NSForegroundColorAttributeName : subtitleColor
|
||||
}]];
|
||||
[subtitleText appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:LocalizationNotNeeded(@"\ue067 ")
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_elegantIconsFont:7.f],
|
||||
NSForegroundColorAttributeName : subtitleColor
|
||||
}]];
|
||||
}
|
||||
|
||||
BOOL isVerified = YES;
|
||||
|
@ -1432,13 +1431,12 @@ typedef enum : NSUInteger {
|
|||
}
|
||||
if (isVerified) {
|
||||
// Show a "checkmark" icon before the navigation bar subtitle if this thread is verified.
|
||||
[subtitleText
|
||||
appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@"\uf00c "
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_fontAwesomeFont:10.f],
|
||||
NSForegroundColorAttributeName : subtitleColor,
|
||||
}]];
|
||||
[subtitleText appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:LocalizationNotNeeded(@"\uf00c ")
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_fontAwesomeFont:10.f],
|
||||
NSForegroundColorAttributeName : subtitleColor,
|
||||
}]];
|
||||
}
|
||||
|
||||
if (self.userLeftGroup) {
|
||||
|
|
|
@ -371,7 +371,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
} else {
|
||||
if ([thread isMuted]) {
|
||||
[snippetText appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@"\ue067 "
|
||||
initWithString:LocalizationNotNeeded(@"\ue067 ")
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_elegantIconsFont:9.f],
|
||||
NSForegroundColorAttributeName :
|
||||
|
|
|
@ -329,7 +329,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[alert addAction:[UIAlertAction actionWithTitle:CommonStrings.dismissButton
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[_challengeTextField becomeFirstResponder];
|
||||
[self.challengeTextField becomeFirstResponder];
|
||||
}]];
|
||||
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
|
|
|
@ -354,7 +354,7 @@ typedef void (^CustomLayoutBlock)(void);
|
|||
// Show a "checkmark" if this user is verified.
|
||||
[labelText
|
||||
appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@"\uf00c "
|
||||
initWithString:LocalizationNotNeeded(@"\uf00c ")
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont
|
||||
ows_fontAwesomeFont:self.verificationStateLabel.font.pointSize],
|
||||
|
@ -383,7 +383,7 @@ typedef void (^CustomLayoutBlock)(void);
|
|||
// Show a "checkmark" if this user is not verified.
|
||||
[buttonText
|
||||
appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@"\uf00c "
|
||||
initWithString:LocalizationNotNeeded(@"\uf00c ")
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont
|
||||
ows_fontAwesomeFont:self.verifyUnverifyButtonLabel.font.pointSize],
|
||||
|
|
|
@ -786,7 +786,7 @@ const CGFloat kIconViewLength = 24;
|
|||
NSMutableAttributedString *subtitle = [NSMutableAttributedString new];
|
||||
// "checkmark"
|
||||
[subtitle appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@"\uf00c "
|
||||
initWithString:LocalizationNotNeeded(@"\uf00c ")
|
||||
attributes:@{
|
||||
NSFontAttributeName :
|
||||
[UIFont ows_fontAwesomeFont:kSubtitlePointSize],
|
||||
|
|
|
@ -137,6 +137,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSCFail(_messageFormat, ##__VA_ARGS__); \
|
||||
}
|
||||
|
||||
|
||||
// Avoids Clang analyzer warning:
|
||||
// Value stored to 'x' during it's initialization is never read
|
||||
#define SUPPRESS_DEADSTORE_WARNING(x) \
|
||||
do { \
|
||||
(void)x; \
|
||||
} while (0)
|
||||
|
||||
__attribute__((annotate("returns_localized_nsstring"))) static inline NSString *LocalizationNotNeeded(NSString *s)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
// This function is intended for use in Swift.
|
||||
void SwiftAssertIsOnMainThread(NSString *functionName);
|
||||
|
||||
|
|
Loading…
Reference in New Issue