Add support for using Yoga from swift on non Darwin platforms. #1690

Open
iainsmith wants to merge 2 commits from iainsmith/main into main
Showing only changes of commit d05d24d384 - Show all commits

View File

@@ -49,7 +49,7 @@
#define YG_ENUM_END(name)
#else
#define YG_ENUM_BEGIN(name) enum name
#define YG_ENUM_END(name) name
#define YG_ENUM_END(name) __attribute__((enum_extensibility(closed))) name
#endif
NickGerleman commented 2024-08-26 08:14:49 -07:00 (Migrated from github.com)
Review

A couple of these are flag enums, which would also need to be declared I think

A couple of these are flag enums, which would also need to be declared I think
iainsmith commented 2024-08-26 15:44:15 -07:00 (Migrated from github.com)
Review

@NickGerleman Are the only bitmask flags YGErrata & YGExperimentalFeature or are there others?

@NickGerleman Are the only bitmask flags `YGErrata & YGExperimentalFeature` or are there others?
iainsmith commented 2024-08-26 15:57:29 -07:00 (Migrated from github.com)
Review

Just realised that enums.py specifies that only Errata is a bitset enum.

How do you feel about us adding a YG_ENUM_FLAG_DECL macro, and then updating enums.py to check BITSET_ENUMS to decide on which macro to use?

Just realised that enums.py specifies that only `Errata` is a bitset enum. How do you feel about us adding a `YG_ENUM_FLAG_DECL` macro, and then updating enums.py to check `BITSET_ENUMS` to decide on which macro to use?
NickGerleman commented 2024-08-27 03:40:38 -07:00 (Migrated from github.com)
Review

That sounds good to me!

That sounds good to me!
iainsmith commented 2024-08-29 01:43:04 -07:00 (Migrated from github.com)
Review

@NickGerleman , I took a quick stab at this on this branch, but I've run into a compiler error I'm not sure how to approach.

~/Developer/personal/yoga/yoga/../yoga/YGEnums.h:61:5: 
error: enumeration value 'YGErrataClassic' is out of range of flags in enumeration type 'YGErrata' [-Werror,-Wflag-enum]
   61 |     YGErrataClassic = 2147483646,
      |     ^
~/Developer/personal/yoga/yoga/../yoga/YGEnums.h:62:5: 
error: enumeration value 'YGErrataAll' is out of range of flags in enumeration type 'YGErrata' [-Werror,-Wflag-enum]
   62 |     YGErrataAll = 2147483647)

Do you have thoughts on the best way to handle that?

@NickGerleman , I took a quick stab at this on [this branch](https://github.com/facebook/yoga/compare/main...iainsmith:yoga:flag_enums?expand=1), but I've run into a compiler error I'm not sure how to approach. ``` ~/Developer/personal/yoga/yoga/../yoga/YGEnums.h:61:5: error: enumeration value 'YGErrataClassic' is out of range of flags in enumeration type 'YGErrata' [-Werror,-Wflag-enum] 61 | YGErrataClassic = 2147483646, | ^ ~/Developer/personal/yoga/yoga/../yoga/YGEnums.h:62:5: error: enumeration value 'YGErrataAll' is out of range of flags in enumeration type 'YGErrata' [-Werror,-Wflag-enum] 62 | YGErrataAll = 2147483647) ``` Do you have thoughts on the best way to handle that?
#ifdef __cplusplus