Skip to content

Conversation

chiaramooney
Copy link
Contributor

Summary

Changes to MapBuffer code in aaff15c...d287598 broke build for Windows. Errors included incompatible type conversions, the use of __attribute__(__packed__) which is only supported by GCC and Clang, and the usage of designated initializers which are only supported on C++20.

Changes here restore build on Windows.

Changelog

[General] [Fixed] - Fix build break on Windows with ReactCommon

Test Plan

React Native project built on Windows and passes react-native-windows repository pipeline. These edits are currently merged into the main branch of react-native-windows.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 4, 2022
@chiaramooney chiaramooney changed the title Cm fix reactcommon Fix ReactCommon Break forWindows Feb 4, 2022
@chiaramooney chiaramooney changed the title Fix ReactCommon Break forWindows Fix ReactCommon Break for Windows Feb 4, 2022
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 4, 2022
@analysis-bot
Copy link

analysis-bot commented Feb 4, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: cd79317
Branch: main

@NickGerleman NickGerleman requested a review from ShikaSD February 4, 2022 21:31
@ShikaSD
Copy link
Contributor

ShikaSD commented Feb 4, 2022

Oh, wow, thanks for correcting this :)
Just thinking, can we add some checks internally/on CircleCI to make sure we won't break this in the future?


header_.bufferSize = bufferSize;
header_.bufferSize = static_cast<uint32_t>(bufferSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, would it help to have int32_t bufferSize in header to avoid this conversion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tinkered around with it. It looks like the culprit is that the variables are summed to make up bufferSize are of type size_t which size varies (32 or 64) depending on the machine architecture causing the type conversion warning. We could make header.bufferSize of type size_t to avoid the cast but then the header will change size based on the machine architecture which I don't think would be desired.

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,120,972 +651
android hermes armeabi-v7a 7,720,931 -752
android hermes x86 8,490,404 -700
android hermes x86_64 8,442,409 -527
android jsc arm64-v8a 9,787,696 +576
android jsc armeabi-v7a 8,772,529 -842
android jsc x86 9,753,728 -783
android jsc x86_64 10,349,832 -598

Base commit: cd79317
Branch: main

@chiaramooney chiaramooney requested a review from ShikaSD February 8, 2022 20:27
@facebook-github-bot
Copy link
Contributor

@philIip has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @chiaramooney in 42b3917.

When will my fix make it into a release? | Upcoming Releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants