Skip to content

Commit 0193af3

Browse files
authored
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. <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> ## Test Plan No testing needed; this only suppresses a compiler warning in a narrow location. <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->
1 parent 5945ce1 commit 0193af3

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)