diff options
23 files changed, 59 insertions, 23 deletions
diff --git a/src/code_generators.cpp b/src/code_generators.cpp index 7838cedf..3126ce59 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 169acd58..37899044 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 248d57d6..ad91cbe0 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 <algorithm> 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 = "// <auto-generated>\n" + "// " + std::string(FlatBuffersGeneratedWarning()) + "\n" + "// </auto-generated>\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 58a60aae..4cdbf03c 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 a07d5f11..edcb780f 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 a893f98b..7266551f 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 += "<?php\n"; - code = code + "// " + FlatBuffersGeneratedWarning(); + code = code + "// " + FlatBuffersGeneratedWarning() + "\n\n"; code += "namespace " + name_space_name + ";\n\n"; if (needs_imports) { diff --git a/src/idl_gen_python.cpp b/src/idl_gen_python.cpp index 76fea3ed..c16a0117 100644 --- a/src/idl_gen_python.cpp +++ b/src/idl_gen_python.cpp @@ -630,7 +630,7 @@ class PythonGenerator : 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 += "# namespace: " + name_space_name + "\n\n"; if (needs_imports) { code += "import flatbuffers\n\n"; diff --git a/tests/MyGame/Example/Ability.cs b/tests/MyGame/Example/Ability.cs index ec08ed8f..17dce4ef 100644 --- a/tests/MyGame/Example/Ability.cs +++ b/tests/MyGame/Example/Ability.cs @@ -1,4 +1,6 @@ -// automatically generated by the FlatBuffers compiler, do not modify +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example/Any.cs b/tests/MyGame/Example/Any.cs index 8fdc2fca..8393853b 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example/Color.cs b/tests/MyGame/Example/Color.cs index 625d040a..f40d60ba 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs index 6eee25dc..ab4cdfe8 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example/Stat.cs b/tests/MyGame/Example/Stat.cs index 1ea80501..e1fd572e 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example/Test.cs b/tests/MyGame/Example/Test.cs index 406f5f13..18421316 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.cs b/tests/MyGame/Example/TestSimpleTableWithEnum.cs index 3d2a3f44..f24d6eac 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example/Vec3.cs b/tests/MyGame/Example/Vec3.cs index 6ea4b0ee..e1669f9b 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example { diff --git a/tests/MyGame/Example2/Monster.cs b/tests/MyGame/Example2/Monster.cs index 406c4bd8..e880ebbe 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace MyGame.Example2 { diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs Binary files differindex 78871d50..b91ff4db 100644 --- a/tests/monster_test.bfbs +++ b/tests/monster_test.bfbs diff --git a/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.cs index 5f979fe5..1a75ed43 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace NamespaceA.NamespaceB { diff --git a/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs index bb627ad3..397fb89f 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace NamespaceA.NamespaceB { diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs index c33d1fbc..89217449 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace NamespaceA.NamespaceB { diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.cs b/tests/namespace_test/NamespaceA/SecondTableInA.cs index f28ed860..99c82ccb 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace NamespaceA { diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.cs b/tests/namespace_test/NamespaceA/TableInFirstNS.cs index 20f4b4be..48b5b205 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace NamespaceA { diff --git a/tests/namespace_test/NamespaceC/TableInC.cs b/tests/namespace_test/NamespaceC/TableInC.cs index c7f2c8a7..0c454acb 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 +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> namespace NamespaceC { |