From df5a6ad067bb8e93bb7078f9a7dd4b647cb2cd63 Mon Sep 17 00:00:00 2001 From: Josh Vera Date: Tue, 10 Apr 2012 15:01:47 -0700 Subject: [PATCH 1/2] Adding __attribute__((warn_unused_result)) to tryEditGrouping methods in NSUndoManager+EditingAdditions --- Proton/NSUndoManager+EditingAdditions.h | 8 ++++---- ProtonTests/PRONSUndoManagerAdditionsTests.m | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Proton/NSUndoManager+EditingAdditions.h b/Proton/NSUndoManager+EditingAdditions.h index 925a398..9339a20 100644 --- a/Proton/NSUndoManager+EditingAdditions.h +++ b/Proton/NSUndoManager+EditingAdditions.h @@ -26,7 +26,7 @@ /** * Invokes with a `nil` `actionName`. */ -- (BOOL)tryEditGrouping; +- (BOOL)tryEditGrouping __attribute__((warn_unused_result)); /** * Attempts to open an edit grouping named `actionName` and immediately @@ -36,13 +36,13 @@ * If `actionName` is an empty string, the action name currently associated with the menu * command is removed. The receiver's action name remains unchanged if this is `nil`. */ -- (BOOL)tryEditGroupingWithActionName:(NSString *)actionName; +- (BOOL)tryEditGroupingWithActionName:(NSString *)actionName __attribute__((warn_unused_result)); /** * Invokes with a `nil` * `actionName`. */ -- (BOOL)tryEditGroupingUsingBlock:(void (^)(void))block; +- (BOOL)tryEditGroupingUsingBlock:(void (^)(void))block __attribute__((warn_unused_result)); /** * Attempts to open an edit grouping named `actionName`, executes the @@ -55,7 +55,7 @@ * * @param block The block to execute within the edit grouping. */ -- (BOOL)tryEditGroupingWithActionName:(NSString *)actionName usingBlock:(void (^)(void))block; +- (BOOL)tryEditGroupingWithActionName:(NSString *)actionName usingBlock:(void (^)(void))block __attribute__((warn_unused_result)); /** * Closes a previously opened edit grouping. diff --git a/ProtonTests/PRONSUndoManagerAdditionsTests.m b/ProtonTests/PRONSUndoManagerAdditionsTests.m index bc2eb52..b9736ff 100644 --- a/ProtonTests/PRONSUndoManagerAdditionsTests.m +++ b/ProtonTests/PRONSUndoManagerAdditionsTests.m @@ -457,8 +457,9 @@ - (void)decrementChangeCountWithUndoManager:(NSUndoManager *)undoManager; it(@"opens an edit grouping with a name", ^{ NSString *expectedName = @"foobar"; - [undoManager tryEditGroupingWithActionName:expectedName]; + BOOL success = [undoManager tryEditGroupingWithActionName:expectedName]; + expect(success).toBeTruthy(); expect(undoManager.undoActionName).toEqual(expectedName); block(); From 38a5874c16bab2d68e9efb23579c2a7a670806d9 Mon Sep 17 00:00:00 2001 From: Josh Vera Date: Tue, 10 Apr 2012 15:18:41 -0700 Subject: [PATCH 2/2] Removing __attribute__((warn_unused_result)) from block based tryEditGrouping method variants --- Proton/NSUndoManager+EditingAdditions.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Proton/NSUndoManager+EditingAdditions.h b/Proton/NSUndoManager+EditingAdditions.h index 9339a20..ef15700 100644 --- a/Proton/NSUndoManager+EditingAdditions.h +++ b/Proton/NSUndoManager+EditingAdditions.h @@ -42,7 +42,7 @@ * Invokes with a `nil` * `actionName`. */ -- (BOOL)tryEditGroupingUsingBlock:(void (^)(void))block __attribute__((warn_unused_result)); +- (BOOL)tryEditGroupingUsingBlock:(void (^)(void))block; /** * Attempts to open an edit grouping named `actionName`, executes the @@ -52,10 +52,10 @@ * @param actionName The name of the action associated with undoing the edit grouping. * If `actionName` is an empty string, the action name currently associated with the menu * command is removed. The receiver's action name remains unchanged if this is `nil`. - * + * * @param block The block to execute within the edit grouping. */ -- (BOOL)tryEditGroupingWithActionName:(NSString *)actionName usingBlock:(void (^)(void))block __attribute__((warn_unused_result)); +- (BOOL)tryEditGroupingWithActionName:(NSString *)actionName usingBlock:(void (^)(void))block; /** * Closes a previously opened edit grouping.