Const correctness in generated code and in code generators. Added missing \reflection\generate_code.bat file. (#4679)

This commit is contained in:
Flaviu
2018-03-23 17:58:07 +02:00
committed by Wouter van Oortmerssen
parent c0a6e5120d
commit 79f62ee353
16 changed files with 306 additions and 270 deletions

View File

@@ -2185,8 +2185,8 @@ enum ElementaryType {
#undef FLATBUFFERS_ET
};
inline const char **ElementaryTypeNames() {
static const char *names[] = {
inline const char * const *ElementaryTypeNames() {
static const char * const names[] = {
#define FLATBUFFERS_ET(E) #E,
FLATBUFFERS_GEN_ELEMENTARY_TYPES(FLATBUFFERS_ET)
#undef FLATBUFFERS_ET
@@ -2207,7 +2207,7 @@ static_assert(sizeof(TypeCode) == 2, "TypeCode");
struct TypeTable;
// Signature of the static method present in each type.
typedef TypeTable *(*TypeFunction)();
typedef const TypeTable *(*TypeFunction)();
struct TypeTable {
SequenceType st;
@@ -2215,7 +2215,7 @@ struct TypeTable {
const TypeCode *type_codes;
const TypeFunction *type_refs;
const int32_t *values; // Only set for non-consecutive enum/union or structs.
const char **names; // Only set if compiled with --reflect-names.
const char * const *names; // Only set if compiled with --reflect-names.
};
// String which identifies the current version of FlatBuffers.