microsoft / react-native-macos

A framework for building native macOS apps with React.
https://microsoft.github.io/react-native-windows/
MIT License
3.37k stars 129 forks source link

Remove dangling semicolons from RCT macros #2096

Closed Saadnajmi closed 3 months ago

Saadnajmi commented 3 months ago

Please select one of the following

Summary:

Internally, we enabled -Wsemicolon-before-method-body which exposed that React Native has a dangling semicolon after some of its macros. This leads to a bunch of code that looks like this to suppress the warning:

// ADO ~~: RCT macros have bad semicolons
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsemicolon-before-method-body"
RCT_EXPORT_METHOD(logError
                  : (NSString *)error)
#pragma clang diagnostic pop
{

This is fixed upstream with https://github.com/facebook/react-native/commit/cf4963feb3acd22755e768bc22c20e3136049999 . Let's pick part of the fix so we can remove the macro supression internally.

Test Plan:

CI should pass