Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yoga/YGMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Author

@iainsmith iainsmith Aug 26, 2024

Choose a reason for hiding this comment

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

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

Copy link
Author

@iainsmith iainsmith Aug 26, 2024

Choose a reason for hiding this comment

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

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds good to me!

Copy link
Author

Choose a reason for hiding this comment

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

@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?

#endif

#ifdef __cplusplus
Expand Down