Fix bitfield enums to not trigger upcoming Clang warning

Fix bitfield enums to not trigger upcoming Clang warning regarding
non-unsigned enum bitfields producing non-portable code.

For more details, see the patch here: https://reviews.llvm.org/D24289

BUG=648462

Review-Url: https://codereview.chromium.org/2349153002
Cr-Commit-Position: refs/heads/master@{#39649}
This commit is contained in:
sashab 2016-09-22 19:08:41 -07:00 committed by Commit bot
parent 1ca44a0a28
commit a81e00d533
3 changed files with 5 additions and 6 deletions

View File

@ -90,7 +90,7 @@ struct StaticDstRangeRelationToSrcRange<Dst,
static const NumericRangeRepresentation value = NUMERIC_RANGE_NOT_CONTAINED; static const NumericRangeRepresentation value = NUMERIC_RANGE_NOT_CONTAINED;
}; };
enum RangeConstraint { enum RangeConstraint : unsigned char {
RANGE_VALID = 0x0, // Value can be represented by the destination type. RANGE_VALID = 0x0, // Value can be represented by the destination type.
RANGE_UNDERFLOW = 0x1, // Value would overflow. RANGE_UNDERFLOW = 0x1, // Value would overflow.
RANGE_OVERFLOW = 0x2, // Value would underflow. RANGE_OVERFLOW = 0x2, // Value would underflow.

View File

@ -1058,8 +1058,7 @@ enum InitializationFlag : uint8_t { kNeedsInitialization, kCreatedInitialized };
enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned }; enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned };
// Serialized in PreparseData, so numeric values should not be changed. // Serialized in PreparseData, so numeric values should not be changed.
enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 }; enum ParseErrorType : uint8_t { kSyntaxError = 0, kReferenceError = 1 };
enum MinusZeroMode { enum MinusZeroMode {
TREAT_MINUS_ZERO_AS_ZERO, TREAT_MINUS_ZERO_AS_ZERO,

View File

@ -649,7 +649,7 @@ class ErrorUtils : public AllStatic {
class MessageTemplate { class MessageTemplate {
public: public:
enum Template { enum Template : unsigned {
#define TEMPLATE(NAME, STRING) k##NAME, #define TEMPLATE(NAME, STRING) k##NAME,
MESSAGE_TEMPLATES(TEMPLATE) MESSAGE_TEMPLATES(TEMPLATE)
#undef TEMPLATE #undef TEMPLATE