From db6ab5f5d0fa881a0b6fefe25ee3d97394cc8d0f Mon Sep 17 00:00:00 2001 From: Erik Schwiebert Date: Wed, 25 Feb 2026 16:06:42 -0800 Subject: [PATCH] fix: suppress warning around a constructor function (#2840) ## Summary: 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. ## Test Plan No testing needed; this only suppresses a compiler warning in a narrow location. --- 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;