summaryrefslogtreecommitdiff
path: root/src/binary.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/binary.h')
-rw-r--r--src/binary.h38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/binary.h b/src/binary.h
index 04059c54..31c1dd54 100644
--- a/src/binary.h
+++ b/src/binary.h
@@ -27,34 +27,38 @@
#define WABT_BINARY_SECTION_RELOC "reloc"
#define WABT_FOREACH_BINARY_SECTION(V) \
- V(CUSTOM, custom, 0) \
- V(TYPE, type, 1) \
- V(IMPORT, import, 2) \
- V(FUNCTION, function, 3) \
- V(TABLE, table, 4) \
- V(MEMORY, memory, 5) \
- V(GLOBAL, global, 6) \
- V(EXPORT, export, 7) \
- V(START, start, 8) \
- V(ELEM, elem, 9) \
- V(CODE, code, 10) \
- V(DATA, data, 11)
+ V(Custom, custom, 0) \
+ V(Type, type, 1) \
+ V(Import, import, 2) \
+ V(Function, function, 3) \
+ V(Table, table, 4) \
+ V(Memory, memory, 5) \
+ V(Global, global, 6) \
+ V(Export, export, 7) \
+ V(Start, start, 8) \
+ V(Elem, elem, 9) \
+ V(Code, code, 10) \
+ V(Data, data, 11)
/* clang-format off */
-enum WabtBinarySection {
-#define V(NAME, name, code) WABT_BINARY_SECTION_##NAME = code,
+enum class WabtBinarySection {
+#define V(Name, name, code) Name = code,
WABT_FOREACH_BINARY_SECTION(V)
#undef V
- WABT_NUM_BINARY_SECTIONS
+ Invalid,
+
+ First = Custom,
+ Last = Data,
};
/* clang-format on */
+static const int kWabtBinarySectionCount = WABT_ENUM_COUNT(WabtBinarySection);
WABT_EXTERN_C_BEGIN
extern const char* g_wabt_section_name[];
static WABT_INLINE const char* wabt_get_section_name(WabtBinarySection sec) {
- assert(sec < WABT_NUM_BINARY_SECTIONS);
- return g_wabt_section_name[sec];
+ assert(static_cast<int>(sec) < kWabtBinarySectionCount);
+ return g_wabt_section_name[static_cast<size_t>(sec)];
}
WABT_EXTERN_C_END