Skip to content

c++ 20 raises a warning for "bitwise operation between different enumeration types ... deprecated" #15

Description

@MarkCallow

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions