From acdddef48eb60b002c954d7d2447cb9c2883c8b3 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Sun, 16 Feb 2025 10:16:22 -0800 Subject: [PATCH] Enable `-Wunused-variable` in js/PACKAGE (#49454) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49454 This diff enables compilation warning flags for the directory in question. Further details are in [this workplace post](https://fb.workplace.com/permalink.php?story_fbid=pfbid02XaWNiCVk69r1ghfvDVpujB8Hr9Y61uDvNakxiZFa2jwiPHscVdEQwCBHrmWZSyMRl&id=100051201402394). This is a low-risk diff. There are **no run-time effects** and the diff has already been observed to compile locally. **If the code compiles, it work; test errors are spurious.** Differential Revision: D68513114 fbshipit-source-id: 219e2b9f2961da76cec4d08cc9f77787e08a0a1e --- packages/react-native/React/Base/RCTModuleData.mm | 2 +- packages/react-native/React/Base/RCTUtils.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/React/Base/RCTModuleData.mm b/packages/react-native/React/Base/RCTModuleData.mm index 2b6e15878af..eec30be066f 100644 --- a/packages/react-native/React/Base/RCTModuleData.mm +++ b/packages/react-native/React/Base/RCTModuleData.mm @@ -468,7 +468,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init); - (dispatch_queue_t)methodQueue { if (_bridge.valid) { - id instance = self.instance; + __unused id instance = self.instance; RCTAssert(_methodQueue != nullptr, @"Module %@ has no methodQueue (instance: %@)", self, instance); } return _methodQueue; diff --git a/packages/react-native/React/Base/RCTUtils.m b/packages/react-native/React/Base/RCTUtils.m index 59b84ede93a..7a3172bccbd 100644 --- a/packages/react-native/React/Base/RCTUtils.m +++ b/packages/react-native/React/Base/RCTUtils.m @@ -1097,7 +1097,7 @@ RCT_EXTERN BOOL RCTValidateTypeOfViewCommandArgument( const NSString *argPos) { if (![obj isKindOfClass:expectedClass]) { - NSString *kindOfClass = RCTHumanReadableType(obj); + __unused NSString *kindOfClass = RCTHumanReadableType(obj); RCTLogError( @"%@ command %@ received %@ argument of type %@, expected %@.",