Cleanup visibility macros (#1372)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1372

X-link: https://github.com/facebook/react-native/pull/39375

D18029030 added `-fvisibility-hidden`, and a corresponding `YOGA_EXPORT` macro for defining shared library visibility. This is used inline next to function and class definitions that should be exported out of the binary.

There was already a `WIN_EXPORT` macro doing the same thing when building a DLL, defined in the headers instead of CPP files, and it seems like sometimes folks forgot to add it to new public APIs after?

This reconciles the redundant macros into a single visibility macro, that we always place with declaration instead of definition. We also rename `YOGA_EXPORT` to `YG_EXPORT` to match the naming convention of other Yoga macros.

Reviewed By: rshest

Differential Revision: D49132643

fbshipit-source-id: cafa6de0c300788a72d9a446ce07c5ac89a20a8e
This commit is contained in:
Nick Gerleman
2023-09-11 19:51:40 -07:00
committed by Facebook GitHub Bot
parent 0720e0b22a
commit 241c5e4baf
12 changed files with 286 additions and 366 deletions

View File

@@ -20,7 +20,7 @@
namespace facebook::yoga {
class YOGA_EXPORT Style {
class YG_EXPORT Style {
template <typename Enum>
using Values = std::array<CompactValue, enums::count<Enum>()>;
@@ -224,8 +224,8 @@ public:
Ref<FloatOptional, &Style::aspectRatio_> aspectRatio() { return {*this}; }
};
YOGA_EXPORT bool operator==(const Style& lhs, const Style& rhs);
YOGA_EXPORT inline bool operator!=(const Style& lhs, const Style& rhs) {
YG_EXPORT bool operator==(const Style& lhs, const Style& rhs);
YG_EXPORT inline bool operator!=(const Style& lhs, const Style& rhs) {
return !(lhs == rhs);
}
} // namespace facebook::yoga