Explicitly mark some enums as unsigned
This allows casting from and to any unsigned value, previously this was undefined behavior. This fixes ubsan complaining in `TParseContext::layoutQualifierCheck`, where `~EShLangComputeMask` is used.
This commit is contained in:
parent
b5f003d7a3
commit
91ac60fc52
2 changed files with 3 additions and 3 deletions
|
|
@ -52,7 +52,7 @@
|
||||||
// Don't maintain an ordinal set of enums (0,1,2,3...) to avoid all possible
|
// Don't maintain an ordinal set of enums (0,1,2,3...) to avoid all possible
|
||||||
// defects from mixing the two different forms.
|
// defects from mixing the two different forms.
|
||||||
//
|
//
|
||||||
typedef enum {
|
typedef enum : unsigned {
|
||||||
EBadProfile = 0,
|
EBadProfile = 0,
|
||||||
ENoProfile = (1 << 0), // only for desktop, before profiles showed up
|
ENoProfile = (1 << 0), // only for desktop, before profiles showed up
|
||||||
ECoreProfile = (1 << 1),
|
ECoreProfile = (1 << 1),
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ typedef enum {
|
||||||
LAST_ELEMENT_MARKER(EShLangCount),
|
LAST_ELEMENT_MARKER(EShLangCount),
|
||||||
} EShLanguage; // would be better as stage, but this is ancient now
|
} EShLanguage; // would be better as stage, but this is ancient now
|
||||||
|
|
||||||
typedef enum {
|
typedef enum : unsigned {
|
||||||
EShLangVertexMask = (1 << EShLangVertex),
|
EShLangVertexMask = (1 << EShLangVertex),
|
||||||
EShLangTessControlMask = (1 << EShLangTessControl),
|
EShLangTessControlMask = (1 << EShLangTessControl),
|
||||||
EShLangTessEvaluationMask = (1 << EShLangTessEvaluation),
|
EShLangTessEvaluationMask = (1 << EShLangTessEvaluation),
|
||||||
|
|
@ -240,7 +240,7 @@ typedef enum {
|
||||||
//
|
//
|
||||||
// Message choices for what errors and warnings are given.
|
// Message choices for what errors and warnings are given.
|
||||||
//
|
//
|
||||||
enum EShMessages {
|
enum EShMessages : unsigned {
|
||||||
EShMsgDefault = 0, // default is to give all required errors and extra warnings
|
EShMsgDefault = 0, // default is to give all required errors and extra warnings
|
||||||
EShMsgRelaxedErrors = (1 << 0), // be liberal in accepting input
|
EShMsgRelaxedErrors = (1 << 0), // be liberal in accepting input
|
||||||
EShMsgSuppressWarnings = (1 << 1), // suppress all warnings, except those required by the specification
|
EShMsgSuppressWarnings = (1 << 1), // suppress all warnings, except those required by the specification
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue