Fixup Enum Generator
Summary: https://github.com/facebook/yoga/pull/1116 adds a new enum. The enum generator is out of date with copyright header, and some codemods, but it also looks like there were manual changes, types added, etc since generation. I fixed up the script to incorporate generating the changes folks made manually, and also added an enum that was previously only added manually to the C ABI. Changelog: [General][Fixed] - Fixup Yoga Enum Generator Reviewed By: yungsters Differential Revision: D39922252 fbshipit-source-id: b678fa9a43a896873d8c434745bdaf3f16fd991f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fd180de774
commit
5a18ccdbe2
@@ -40,6 +40,49 @@
|
||||
#define YG_ENUM_END(name) name
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace facebook {
|
||||
namespace yoga {
|
||||
namespace enums {
|
||||
|
||||
template <typename T>
|
||||
constexpr int count(); // can't use `= delete` due to a defect in clang < 3.9
|
||||
|
||||
namespace detail {
|
||||
template <int... xs>
|
||||
constexpr int n() {
|
||||
return sizeof...(xs);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
} // namespace enums
|
||||
} // namespace yoga
|
||||
} // namespace facebook
|
||||
#endif
|
||||
|
||||
#define YG_ENUM_DECL(NAME, ...) \
|
||||
typedef YG_ENUM_BEGIN(NAME){__VA_ARGS__} YG_ENUM_END(NAME); \
|
||||
WIN_EXPORT const char* NAME##ToString(NAME);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define YG_ENUM_SEQ_DECL(NAME, ...) \
|
||||
YG_ENUM_DECL(NAME, __VA_ARGS__) \
|
||||
YG_EXTERN_C_END \
|
||||
namespace facebook { \
|
||||
namespace yoga { \
|
||||
namespace enums { \
|
||||
template <> \
|
||||
constexpr int count<NAME>() { \
|
||||
return detail::n<__VA_ARGS__>(); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
YG_EXTERN_C_BEGIN
|
||||
#else
|
||||
#define YG_ENUM_SEQ_DECL YG_ENUM_DECL
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define YG_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
|
Reference in New Issue
Block a user