From b67f1ad6d055ecb526533df814b6902fc96cc676 Mon Sep 17 00:00:00 2001 From: Derek Bailey Date: Wed, 17 May 2023 21:13:16 -0700 Subject: don't emit flatbuffers include in bfbs generated output (#7968) --- src/idl_gen_cpp.cpp | 6 ++---- tests/64bit/test_64bit_bfbs_generated.h | 11 ++--------- tests/monster_test_bfbs_generated.h | 11 ++--------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index ff8382be..b602724f 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -377,10 +377,8 @@ class CppGenerator : public BaseGenerator { code_ += "#pragma clang system_header\n\n"; } - code_ += "#include \"flatbuffers/flatbuffers.h\""; - code_ += ""; - GenFlatbuffersVersionCheck(); - code_ += ""; + code_ += "#include "; + code_ += "#include "; SetNameSpace(struct_def.defined_namespace); auto name = Name(struct_def); diff --git a/tests/64bit/test_64bit_bfbs_generated.h b/tests/64bit/test_64bit_bfbs_generated.h index 999ce188..9afa58a3 100644 --- a/tests/64bit/test_64bit_bfbs_generated.h +++ b/tests/64bit/test_64bit_bfbs_generated.h @@ -4,15 +4,8 @@ #ifndef FLATBUFFERS_GENERATED_TEST64BIT_BFBS_H_ #define FLATBUFFERS_GENERATED_TEST64BIT_BFBS_H_ -#include "flatbuffers/flatbuffers.h" - -// Ensure the included flatbuffers.h is the same version as when this file was -// generated, otherwise it may not be compatible. -static_assert(FLATBUFFERS_VERSION_MAJOR == 23 && - FLATBUFFERS_VERSION_MINOR == 5 && - FLATBUFFERS_VERSION_REVISION == 9, - "Non-compatible flatbuffers version included"); - +#include +#include struct RootTableBinarySchema { static const uint8_t *data() { // Buffer containing the binary schema. diff --git a/tests/monster_test_bfbs_generated.h b/tests/monster_test_bfbs_generated.h index 58adf629..3a4c0010 100644 --- a/tests/monster_test_bfbs_generated.h +++ b/tests/monster_test_bfbs_generated.h @@ -4,15 +4,8 @@ #ifndef FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_BFBS_H_ #define FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_BFBS_H_ -#include "flatbuffers/flatbuffers.h" - -// Ensure the included flatbuffers.h is the same version as when this file was -// generated, otherwise it may not be compatible. -static_assert(FLATBUFFERS_VERSION_MAJOR == 23 && - FLATBUFFERS_VERSION_MINOR == 5 && - FLATBUFFERS_VERSION_REVISION == 9, - "Non-compatible flatbuffers version included"); - +#include +#include namespace MyGame { namespace Example { -- cgit v1.2.3