KhronosGroup / KhronosGroup/dfdutils
c++ 20 raises a warning for "bitwise operation between different enumeration types ... deprecated"
- Dominant language
- C++
- Stars
- 8
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
The macros in `khr_df.h` were fixed some time ago to prevent this warning by the addition of `uint32_t` casts.
The dfd tests in KTX-Software's `unittests` (which should be moved to dfdutils after the cmake build and CI is set up), have several instances of code like
```
KHR_DF_CHANNEL_RGBSDA_ALPHA | KHR_DF_SAMPLE_DATATYPE_LINEAR
```
which triggers the warning. The code uses this pattern when setting the channel type parameter to a constructor used for building test DFDs. I do not know how common this pattern is in the wider world. If it is thought to be a common pattern then it will be helpful to add the following macro to `khr_df.h`
```cpp
#define KHR_DF_CHANNEL_TYPE(id, q) \
((uint32_t)KHR_DF_CHANNEL_##id | (uint32_t)KHR_DF_SAMPLE_DATATYPE_##q)
```
This avoids having to remember to add casts everywhere.
@fluppeteer is this a worthwhile addition?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the macro definitions in khr_df.h, then inspect the DFD tests in KTX-Software's unittests for repeated channel-type expressions that trigger the C++20 warning. Decide whether the proposed helper fits the wider usage, and consider the existing plan to move these tests to dfdutils. Done means the relevant test code avoids the warning without repeated manual casts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100