From ebf1c536c1e55d3868b66df47fb7df7f2966bcb5 Mon Sep 17 00:00:00 2001 From: Erik Schwiebert Date: Wed, 25 Feb 2026 10:48:28 -0800 Subject: [PATCH] Suppress warning around a constructor function Xcode 26.4 now warns about functions annotated as constructors if the -Wglobal-constructors flag is enabled. We want that on as an error by default so that we don't trivially get new ones added, but we need to suppress the warning around existing code. Add this to ReactNative. --- packages/react-native/React/Base/RCTBridgeModule.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/React/Base/RCTBridgeModule.h b/packages/react-native/React/Base/RCTBridgeModule.h index 76f64602786b..fc86dc806f76 100644 --- a/packages/react-native/React/Base/RCTBridgeModule.h +++ b/packages/react-native/React/Base/RCTBridgeModule.h @@ -91,10 +91,13 @@ RCT_EXTERN_C_END { \ return @ #js_name; \ } \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \ __attribute__((constructor)) static void RCT_CONCAT(initialize_, objc_name)(void) \ { \ RCTRegisterModule([objc_name class]); \ - } + } \ + _Pragma("clang diagnostic pop") // Implemented by RCT_EXPORT_MODULE + (NSString *)moduleName;