diff options
Diffstat (limited to 'src/idl_gen_text.cpp')
-rw-r--r-- | src/idl_gen_text.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/idl_gen_text.cpp b/src/idl_gen_text.cpp index 1d0a3caa..4c00472d 100644 --- a/src/idl_gen_text.cpp +++ b/src/idl_gen_text.cpp @@ -167,8 +167,7 @@ bool Print<const void *>(const void *val, Type type, int indent, // Call PrintVector above specifically for each element type: // clang-format off switch (vec_type.base_type) { - #define FLATBUFFERS_TD(ENUM, IDLTYPE, \ - CTYPE, JTYPE, GTYPE, NTYPE, PTYPE, RTYPE, KTYPE) \ + #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \ case BASE_TYPE_ ## ENUM: \ if (!PrintVector<CTYPE>( \ *reinterpret_cast<const Vector<CTYPE> *>(val), \ @@ -187,8 +186,7 @@ bool Print<const void *>(const void *val, Type type, int indent, // Call PrintArray above specifically for each element type: // clang-format off switch (vec_type.base_type) { - #define FLATBUFFERS_TD(ENUM, IDLTYPE, \ - CTYPE, JTYPE, GTYPE, NTYPE, PTYPE, RTYPE, KTYPE) \ + #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \ case BASE_TYPE_ ## ENUM: \ if (!PrintArray<CTYPE>( \ *reinterpret_cast<const Array<CTYPE, 0xFFFF> *>(val), \ @@ -198,6 +196,7 @@ bool Print<const void *>(const void *val, Type type, int indent, } \ break; FLATBUFFERS_GEN_TYPES_SCALAR(FLATBUFFERS_TD) + // Arrays of scalars or structs are only possible. FLATBUFFERS_GEN_TYPES_POINTER(FLATBUFFERS_TD) #undef FLATBUFFERS_TD case BASE_TYPE_ARRAY: FLATBUFFERS_ASSERT(0); @@ -286,19 +285,17 @@ static bool GenStruct(const StructDef &struct_def, const Table *table, text += " "; switch (fd.value.type.base_type) { // clang-format off - #define FLATBUFFERS_TD(ENUM, IDLTYPE, \ - CTYPE, JTYPE, GTYPE, NTYPE, PTYPE, RTYPE, KTYPE) \ - case BASE_TYPE_ ## ENUM: \ - if (!GenField<CTYPE>(fd, table, struct_def.fixed, \ - opts, indent + Indent(opts), _text)) { \ - return false; \ - } \ - break; + #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \ + case BASE_TYPE_ ## ENUM: \ + if (!GenField<CTYPE>(fd, table, struct_def.fixed, \ + opts, indent + Indent(opts), _text)) { \ + return false; \ + } \ + break; FLATBUFFERS_GEN_TYPES_SCALAR(FLATBUFFERS_TD) #undef FLATBUFFERS_TD // Generate drop-thru case statements for all pointer types: - #define FLATBUFFERS_TD(ENUM, IDLTYPE, \ - CTYPE, JTYPE, GTYPE, NTYPE, PTYPE, RTYPE, KTYPE) \ + #define FLATBUFFERS_TD(ENUM, ...) \ case BASE_TYPE_ ## ENUM: FLATBUFFERS_GEN_TYPES_POINTER(FLATBUFFERS_TD) FLATBUFFERS_GEN_TYPE_ARRAY(FLATBUFFERS_TD) |