Skip to content

Commit ebf1c53

Browse files
committed
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.
1 parent 5945ce1 commit ebf1c53

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/react-native/React/Base/RCTBridgeModule.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,13 @@ RCT_EXTERN_C_END
9191
{ \
9292
return @ #js_name; \
9393
} \
94+
_Pragma("clang diagnostic push") \
95+
_Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \
9496
__attribute__((constructor)) static void RCT_CONCAT(initialize_, objc_name)(void) \
9597
{ \
9698
RCTRegisterModule([objc_name class]); \
97-
}
99+
} \
100+
_Pragma("clang diagnostic pop")
98101

99102
// Implemented by RCT_EXPORT_MODULE
100103
+ (NSString *)moduleName;

0 commit comments

Comments
 (0)