Commit 41e79062 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

Make InstanceType enum a uint8_t

This enforces that its enumeration values fit in a byte, as required
by Map's {instance_type} field (and probably other parts of the
system).

Clang helpfully emits this error message if an enum value goes out
of range:

   enumerator value 256 is not representable in the underlying type 'uint8_t' (aka 'unsigned char')

Change-Id: I533cd5afc755e7163c2fd40f7b00d9adfd960895
Reviewed-on: https://chromium-review.googlesource.com/565892Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46544}
parent c44228b7
...@@ -615,7 +615,7 @@ static inline bool IsShortcutCandidate(int type) { ...@@ -615,7 +615,7 @@ static inline bool IsShortcutCandidate(int type) {
return ((type & kShortcutTypeMask) == kShortcutTypeTag); return ((type & kShortcutTypeMask) == kShortcutTypeTag);
} }
enum InstanceType { enum InstanceType : uint8_t {
// String types. // String types.
INTERNALIZED_STRING_TYPE = kTwoByteStringTag | kSeqStringTag | INTERNALIZED_STRING_TYPE = kTwoByteStringTag | kSeqStringTag |
kInternalizedTag, // FIRST_PRIMITIVE_TYPE kInternalizedTag, // FIRST_PRIMITIVE_TYPE
......
...@@ -370,7 +370,7 @@ def load_objects_from_file(objfilename, checktypes): ...@@ -370,7 +370,7 @@ def load_objects_from_file(objfilename, checktypes):
# do so without the embedded newlines. # do so without the embedded newlines.
# #
for line in objfile: for line in objfile:
if (line.startswith('enum InstanceType {')): if (line.startswith('enum InstanceType : uint8_t {')):
in_insttype = True; in_insttype = True;
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment