diff --git a/src/code_generators.cpp b/src/code_generators.cpp index 7838cedfd..3126ce59d 100644 --- a/src/code_generators.cpp +++ b/src/code_generators.cpp @@ -68,7 +68,7 @@ void CodeWriter::operator+=(std::string text) { const char *BaseGenerator::FlatBuffersGeneratedWarning() { return "automatically generated by the FlatBuffers compiler," - " do not modify\n\n"; + " do not modify"; } std::string BaseGenerator::NamespaceDir(const Parser &parser, diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index 169acd585..378990448 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -88,7 +88,7 @@ class CppGenerator : public BaseGenerator { // structs, and tables) and output them to a single file. bool generate() { code_.Clear(); - code_ += "// " + std::string(FlatBuffersGeneratedWarning()); + code_ += "// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n"; const auto include_guard = GenIncludeGuard(); code_ += "#ifndef " + include_guard; diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp index 248d57d65..ad91cbe0f 100644 --- a/src/idl_gen_general.cpp +++ b/src/idl_gen_general.cpp @@ -20,7 +20,6 @@ #include "flatbuffers/idl.h" #include "flatbuffers/util.h" #include "flatbuffers/code_generators.h" -#include namespace flatbuffers { @@ -204,7 +203,14 @@ class GeneralGenerator : public BaseGenerator { if (!classcode.length()) return true; std::string code; - code = code + "// " + FlatBuffersGeneratedWarning(); + if (lang_.language == IDLOptions::kCSharp) { + code = "// \n" + "// " + std::string(FlatBuffersGeneratedWarning()) + "\n" + "// \n\n"; + } else { + code = "// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n"; + } + std::string namespace_name = FullNamespace(".", ns); if (!namespace_name.empty()) { code += lang_.namespace_ident + namespace_name + lang_.namespace_begin; diff --git a/src/idl_gen_go.cpp b/src/idl_gen_go.cpp index 58a60aae6..4cdbf03c1 100644 --- a/src/idl_gen_go.cpp +++ b/src/idl_gen_go.cpp @@ -773,7 +773,7 @@ class GoGenerator : public BaseGenerator { void BeginFile(const std::string name_space_name, const bool needs_imports, std::string *code_ptr) { std::string &code = *code_ptr; - code = code + "// " + FlatBuffersGeneratedWarning(); + code = code + "// " + FlatBuffersGeneratedWarning() + "\n\n"; code += "package " + name_space_name + "\n\n"; if (needs_imports) { code += "import (\n"; diff --git a/src/idl_gen_js.cpp b/src/idl_gen_js.cpp index a07d5f116..edcb780f0 100644 --- a/src/idl_gen_js.cpp +++ b/src/idl_gen_js.cpp @@ -92,7 +92,7 @@ class JsGenerator : public BaseGenerator { generateImportDependencies(&import_code, imported_files); generateReexports(&import_code, reexports, imported_files); - code = code + "// " + FlatBuffersGeneratedWarning(); + code = code + "// " + FlatBuffersGeneratedWarning() + "\n\n"; // Generate code for all the namespace declarations. GenNamespaces(&code, &exports_code); diff --git a/src/idl_gen_php.cpp b/src/idl_gen_php.cpp index a893f98bf..7266551f6 100644 --- a/src/idl_gen_php.cpp +++ b/src/idl_gen_php.cpp @@ -66,7 +66,7 @@ namespace php { const bool needs_imports, std::string *code_ptr) { std::string &code = *code_ptr; code += " +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example/Any.cs b/tests/MyGame/Example/Any.cs index 8fdc2fca1..8393853b0 100644 --- a/tests/MyGame/Example/Any.cs +++ b/tests/MyGame/Example/Any.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example/Color.cs b/tests/MyGame/Example/Color.cs index 625d040a9..f40d60ba7 100644 --- a/tests/MyGame/Example/Color.cs +++ b/tests/MyGame/Example/Color.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs index 6eee25dc9..ab4cdfe8a 100644 --- a/tests/MyGame/Example/Monster.cs +++ b/tests/MyGame/Example/Monster.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example/Stat.cs b/tests/MyGame/Example/Stat.cs index 1ea805016..e1fd572ed 100644 --- a/tests/MyGame/Example/Stat.cs +++ b/tests/MyGame/Example/Stat.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example/Test.cs b/tests/MyGame/Example/Test.cs index 406f5f137..184213160 100644 --- a/tests/MyGame/Example/Test.cs +++ b/tests/MyGame/Example/Test.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.cs b/tests/MyGame/Example/TestSimpleTableWithEnum.cs index 3d2a3f443..f24d6eac7 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.cs +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example/Vec3.cs b/tests/MyGame/Example/Vec3.cs index 6ea4b0ee7..e1669f9bb 100644 --- a/tests/MyGame/Example/Vec3.cs +++ b/tests/MyGame/Example/Vec3.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example { diff --git a/tests/MyGame/Example2/Monster.cs b/tests/MyGame/Example2/Monster.cs index 406c4bd87..e880ebbed 100644 --- a/tests/MyGame/Example2/Monster.cs +++ b/tests/MyGame/Example2/Monster.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace MyGame.Example2 { diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs index 78871d504..b91ff4db6 100644 Binary files a/tests/monster_test.bfbs and b/tests/monster_test.bfbs differ diff --git a/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.cs index 5f979fe54..1a75ed432 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.cs +++ b/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace NamespaceA.NamespaceB { diff --git a/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs index bb627ad32..397fb89f5 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs +++ b/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace NamespaceA.NamespaceB { diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs index c33d1fbca..892174496 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs +++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace NamespaceA.NamespaceB { diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.cs b/tests/namespace_test/NamespaceA/SecondTableInA.cs index f28ed8604..99c82ccb1 100644 --- a/tests/namespace_test/NamespaceA/SecondTableInA.cs +++ b/tests/namespace_test/NamespaceA/SecondTableInA.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace NamespaceA { diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.cs b/tests/namespace_test/NamespaceA/TableInFirstNS.cs index 20f4b4be3..48b5b205a 100644 --- a/tests/namespace_test/NamespaceA/TableInFirstNS.cs +++ b/tests/namespace_test/NamespaceA/TableInFirstNS.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace NamespaceA { diff --git a/tests/namespace_test/NamespaceC/TableInC.cs b/tests/namespace_test/NamespaceC/TableInC.cs index c7f2c8a78..0c454acb5 100644 --- a/tests/namespace_test/NamespaceC/TableInC.cs +++ b/tests/namespace_test/NamespaceC/TableInC.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// +// automatically generated by the FlatBuffers compiler, do not modify +// namespace NamespaceC {