Skip to content

Commit

Permalink
Fixed build warnings in Xcode 7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
swisspol committed Mar 28, 2016
1 parent 1947684 commit 3c60cab
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 15 deletions.
4 changes: 4 additions & 0 deletions GitUp/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#define kToolName @"gitup"
#define kToolInstallPath @"/usr/local/bin/" kToolName

@interface NSSavePanel (OSX_10_9)
- (void)setShowsTagField:(BOOL)flag;
@end

@interface WelcomeView : NSView
@end

Expand Down
10 changes: 7 additions & 3 deletions GitUp/Application/Document.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@

#define kMaxProgressRefreshRate 10.0 // Hz

@interface NSWindow (OSX_10_10)
- (void)setTitleVisibility:(NSWindowTitleVisibility)visibility;
@end

@interface Document () <NSToolbarDelegate, NSTextFieldDelegate, GCLiveRepositoryDelegate,
GIWindowControllerDelegate, GIMapViewControllerDelegate, GISnapshotListViewControllerDelegate, GIUnifiedReflogViewControllerDelegate,
GICommitListViewControllerDelegate, GICommitRewriterViewControllerDelegate, GICommitSplitterViewControllerDelegate,
Expand Down Expand Up @@ -282,7 +286,7 @@ - (void)windowControllerDidLoadNib:(NSWindowController*)windowController {
_mainWindow.backgroundColor = [NSColor whiteColor];
[_mainWindow setToolbar:_toolbar];
if (_unifiedToolbar) {
_mainWindow.titleVisibility = NSWindowTitleHidden;
[_mainWindow setTitleVisibility:NSWindowTitleHidden];
}
_contentView.wantsLayer = YES;
_leftView.wantsLayer = YES;
Expand Down Expand Up @@ -545,7 +549,7 @@ - (void)_documentDidOpen:(id)restored {
NSAlert* alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Do you want to initialize submodules?", nil) defaultButton:NSLocalizedString(@"Initialize", nil) alternateButton:NSLocalizedString(@"Cancel", nil) otherButton:nil informativeTextWithFormat:@"One or more submodules in this repository are uninitialized."];
alert.type = kGIAlertType_Caution;
alert.showsSuppressionButton = YES;
[alert beginSheetModalForWindow:_mainWindow withCompletionHandler:^(NSModalResponse returnCode) {
[alert beginSheetModalForWindow:_mainWindow withCompletionHandler:^(NSInteger returnCode) {

if (alert.suppressionButton.state) {
[_repository setUserInfo:@(YES) forKey:kRepositoryUserInfoKey_SkipSubmoduleCheck];
Expand Down Expand Up @@ -1778,7 +1782,7 @@ - (IBAction)resetHard:(id)sender {
alert.accessoryView = _resetView;
[alert addButtonWithTitle:NSLocalizedString(@"Reset", nil)];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
[alert beginSheetModalForWindow:_mainWindow withCompletionHandler:^(NSModalResponse returnCode) {
[alert beginSheetModalForWindow:_mainWindow withCompletionHandler:^(NSInteger returnCode) {

if (returnCode == NSAlertFirstButtonReturn) {
NSError* error;
Expand Down
2 changes: 1 addition & 1 deletion GitUpKit/Components/GIUnifiedReflogViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ - (IBAction)restoreEntry:(id)sender {
alert.accessoryView = _restoreView;
[alert addButtonWithTitle:NSLocalizedString(@"Create Branch", nil)];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
[self presentAlert:alert completionHandler:^(NSModalResponse returnCode) {
[self presentAlert:alert completionHandler:^(NSInteger returnCode) {

if (returnCode == NSAlertFirstButtonReturn) {
NSString* name = [_nameTextField.stringValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
Expand Down
12 changes: 12 additions & 0 deletions GitUpKit/GitUpKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,10 @@
);
PRODUCT_NAME = GitUpTests;
SDKROOT = macosx;
WARNING_CFLAGS = (
"$(inherited)",
"-Wno-partial-availability",
);
};
name = Debug;
};
Expand All @@ -1919,6 +1923,10 @@
);
PRODUCT_NAME = GitUpTests;
SDKROOT = macosx;
WARNING_CFLAGS = (
"$(inherited)",
"-Wno-partial-availability",
);
};
name = Release;
};
Expand Down Expand Up @@ -1951,6 +1959,10 @@
);
PRODUCT_NAME = GitUpTests;
SDKROOT = macosx;
WARNING_CFLAGS = (
"$(inherited)",
"-Wno-partial-availability",
);
};
name = Distribution;
};
Expand Down
2 changes: 1 addition & 1 deletion GitUpKit/Utilities/GIAppKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern NSString* const GICommitMessageViewUserDefaultKey_EnableSpellChecking;
@end

@interface NSAlert (GIAppKit)
- (void)beginSheetModalForWindow:(NSWindow*)window withCompletionHandler:(void (^)(NSModalResponse returnCode))handler; // AppKit version is 10.9+ only
- (void)beginSheetModalForWindow:(NSWindow*)window withCompletionHandler:(void (^)(NSInteger returnCode))handler; // AppKit version is 10.9+ only
- (void)setType:(GIAlertType)type; // Set the alert icon
@end

Expand Down
4 changes: 2 additions & 2 deletions GitUpKit/Utilities/GIAppKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ - (void)appendString:(NSString*)string withAttributes:(NSDictionary*)attributes
@implementation NSAlert (GIAppKit)

+ (void)_alertDidEnd:(NSAlert*)alert returnCode:(NSInteger)returnCode contextInfo:(void*)contextInfo {
void (^handler)(NSModalResponse) = contextInfo ? CFBridgingRelease(contextInfo) : NULL;
void (^handler)(NSInteger) = contextInfo ? CFBridgingRelease(contextInfo) : NULL;
[alert.window orderOut:nil]; // Dismiss the alert window before the handler might chain another one
if (handler) {
handler(returnCode);
}
}

- (void)beginSheetModalForWindow:(NSWindow*)window withCompletionHandler:(void (^)(NSModalResponse returnCode))handler {
- (void)beginSheetModalForWindow:(NSWindow*)window withCompletionHandler:(void (^)(NSInteger returnCode))handler {
[self beginSheetModalForWindow:window modalDelegate:[NSAlert class] didEndSelector:@selector(_alertDidEnd:returnCode:contextInfo:) contextInfo:(handler ? (void*)CFBridgingRetain(handler) : NULL)];
}

Expand Down
2 changes: 1 addition & 1 deletion GitUpKit/Utilities/GIViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@property(nonatomic, readonly, getter=isLiveResizing) BOOL liveResizing;
@property(nonatomic, readonly) GIWindowController* windowController;
- (instancetype)initWithRepository:(GCLiveRepository*)repository;
- (void)presentAlert:(NSAlert*)alert completionHandler:(void (^)(NSModalResponse returnCode))handler;
- (void)presentAlert:(NSAlert*)alert completionHandler:(void (^)(NSInteger returnCode))handler;
@end

@interface GIViewController (Extensions)
Expand Down
4 changes: 2 additions & 2 deletions GitUpKit/Utilities/GIViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ - (GIWindowController*)windowController {
return nil;
}

- (void)presentAlert:(NSAlert*)alert completionHandler:(void (^)(NSModalResponse returnCode))handler {
- (void)presentAlert:(NSAlert*)alert completionHandler:(void (^)(NSInteger returnCode))handler {
[alert beginSheetModalForWindow:self.view.window withCompletionHandler:handler];
}

Expand Down Expand Up @@ -270,7 +270,7 @@ - (void)confirmUserActionWithAlertType:(GIAlertType)type
defaultButton.keyEquivalent = @"";
}
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
[self presentAlert:alert completionHandler:^(NSModalResponse returnCode) {
[self presentAlert:alert completionHandler:^(NSInteger returnCode) {

if (returnCode == NSAlertFirstButtonReturn) {
block();
Expand Down
4 changes: 2 additions & 2 deletions GitUpKit/Views/GIMapViewController+Operations.m
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ - (void)smartMergeCommitOrBranch:(id)commitOrBranch intoLocalBranch:(GCHistoryLo
otherButton:NSLocalizedString(@"Merge", nil)
informativeTextWithFormat:NSLocalizedString(@"Do you want to still create a merge or just fast-forward?", nil)];
alert.type = kGIAlertType_Note;
[self presentAlert:alert completionHandler:^(NSModalResponse returnCode) {
[self presentAlert:alert completionHandler:^(NSInteger returnCode) {

if (returnCode == NSAlertDefaultReturn) {
[self fastForwardLocalBranch:intoBranch toCommitOrBranch:commitOrBranch withUserMessage:userMessage];
Expand Down Expand Up @@ -1200,7 +1200,7 @@ - (void)pullLocalBranchFromUpstream:(GCHistoryLocalBranch*)branch {
otherButton:NSLocalizedString(@"Merge", nil)
informativeTextWithFormat:NSLocalizedString(@"The branch \"%@\" has diverged from its upstream and cannot be fast-forwarded.", nil), branch.name];
alert.type = kGIAlertType_Note;
[self presentAlert:alert completionHandler:^(NSModalResponse returnCode) {
[self presentAlert:alert completionHandler:^(NSInteger returnCode) {

if (returnCode == NSAlertDefaultReturn) {
[self rebaseLocalBranch:branch fromCommit:ancestorCommit ontoCommit:upstream.tipCommit withUserMessage:nil];
Expand Down
4 changes: 2 additions & 2 deletions GitUpKit/Views/GIMapViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ - (IBAction)checkoutSelectedCommit:(id)sender {
otherButton:NSLocalizedString(@"Checkout Commit", nil)
informativeTextWithFormat:NSLocalizedString(@"The selected commit is also the tip of the remote branch \"%@\".", nil), branch.name];
alert.type = kGIAlertType_Note;
[self presentAlert:alert completionHandler:^(NSModalResponse returnCode) {
[self presentAlert:alert completionHandler:^(NSInteger returnCode) {

if (returnCode == NSAlertDefaultReturn) {
[self checkoutRemoteBranch:branch];
Expand Down Expand Up @@ -984,7 +984,7 @@ - (IBAction)deleteSelectedCommit:(id)sender {
otherButton:NSLocalizedString(@"Delete Commit", nil)
informativeTextWithFormat:NSLocalizedString(@"The selected commit is also the tip of the local branch \"%@\".", nil), localBranch.name];
alert.type = kGIAlertType_Note;
[self presentAlert:alert completionHandler:^(NSModalResponse returnCode) {
[self presentAlert:alert completionHandler:^(NSInteger returnCode) {

if (returnCode == NSAlertDefaultReturn) {
[self deleteLocalBranch:localBranch];
Expand Down
2 changes: 1 addition & 1 deletion Xcode-Configurations/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Base"

GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
WARNING_CFLAGS = -Wall -Weverything -Wshadow -Wshorten-64-to-32 -Wbool-conversion -Wconstant-conversion -Wundeclared-selector -Wno-pedantic -Wno-padded -Wno-direct-ivar-access -Wno-documentation-unknown-command -Wno-objc-missing-property-synthesis -Wno-implicit-retain-self -Wno-explicit-ownership-type -Wno-assign-enum -Wno-cast-align -Wno-switch-enum -Wno-gnu-statement-expression -Wno-cstring-format-directive -Wno-cast-qual -Wno-nullable-to-nonnull-conversion -Wno-reserved-id-macro -Wno-nonnull -Wno-property-attribute-mismatch
WARNING_CFLAGS = -Wall -Weverything -Wshadow -Wshorten-64-to-32 -Wbool-conversion -Wconstant-conversion -Wundeclared-selector -Wno-pedantic -Wno-padded -Wno-direct-ivar-access -Wno-documentation-unknown-command -Wno-objc-missing-property-synthesis -Wno-implicit-retain-self -Wno-explicit-ownership-type -Wno-assign-enum -Wno-cast-align -Wno-switch-enum -Wno-gnu-statement-expression -Wno-cstring-format-directive -Wno-cast-qual -Wno-nullable-to-nonnull-conversion -Wno-reserved-id-macro -Wno-nonnull -Wno-property-attribute-mismatch -Wno-double-promotion

ONLY_ACTIVE_ARCH = YES
DEBUG_INFORMATION_FORMAT = dwarf
Expand Down

0 comments on commit 3c60cab

Please sign in to comment.