You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pegl uses aenum for its extensible enums, which are used to support different EGL versions and extensions that add new values to existing enumerations.
Code and tests were generally written for aenum 2.2.6, but Pegl is no longer pinned to this version as of d3c6eff. That commit also fixed one resulting bug, but another issue has arisen and others may yet arise.
Current aenum versions (namely 3.1.8) will no longer accept unknown values when constructing an IntFlag instance from an int. Trying to do so doesn't give an error, but returns the int itself. I don't know if this is an intended behaviour change or not.
The difference currently causes problems in tests that load an EGL version lower than the native library actually supports. As a result, enums like ClientAPIFlag aren't extended with newer options... but the library can still use them in values that it returns. This causes tests to fail when they expect a value to be an instance of the enum, but they receive a plain int.
Options:
Be prepared to deal with a plain int. This would affect both tests and user code, and probably means giving up some advantages of enums (like "in" testing for flags).
Add all known flags to all enums regardless of which version is actually loaded. This won't solve the problem for unknown extensions, though.
Define placeholder flags for unused bits on flag enums. Later EGL versions and extensions then add aliases for them.
Report an issue on aenum and hope its behaviour will change back.
Stop depending on aenum and make my own extensible enums.
Of these, option 3 seems like the most practical.
The text was updated successfully, but these errors were encountered:
Two problems with option 3: it doesn't solve the issue for non-flag enums where unknown values might be passed back from the native library, and it pollutes the namespace of all enums, possibly making the default name for a flag something generic like BIT_2 instead of WINDOW_BIT.
Pegl uses aenum for its extensible enums, which are used to support different EGL versions and extensions that add new values to existing enumerations.
Code and tests were generally written for aenum 2.2.6, but Pegl is no longer pinned to this version as of d3c6eff. That commit also fixed one resulting bug, but another issue has arisen and others may yet arise.
Current aenum versions (namely 3.1.8) will no longer accept unknown values when constructing an
IntFlag
instance from anint
. Trying to do so doesn't give an error, but returns theint
itself. I don't know if this is an intended behaviour change or not.Before:
After:
The difference currently causes problems in tests that load an EGL version lower than the native library actually supports. As a result, enums like
ClientAPIFlag
aren't extended with newer options... but the library can still use them in values that it returns. This causes tests to fail when they expect a value to be an instance of the enum, but they receive a plainint
.Options:
int
. This would affect both tests and user code, and probably means giving up some advantages of enums (like "in" testing for flags).Of these, option 3 seems like the most practical.
The text was updated successfully, but these errors were encountered: