From 9927747d4ea26ee873d5fa57d01408f6b6f1221b Mon Sep 17 00:00:00 2001 From: mogemimi Date: Thu, 15 Dec 2022 14:35:54 +0900 Subject: [PATCH] [C++] Fix clang `-Wnewline-eof` warning (#7711) * Fix clang -Wnewline-eof warning * Enable -Wnewline-eof warning Co-authored-by: Derek Bailey --- CMakeLists.txt | 1 + include/flatbuffers/allocator.h | 2 +- include/flatbuffers/buffer_ref.h | 2 +- include/flatbuffers/default_allocator.h | 2 +- include/flatbuffers/string.h | 2 +- include/flatbuffers/struct.h | 2 +- src/bfbs_gen_lua.cpp | 2 +- src/bfbs_gen_lua.h | 2 +- src/bfbs_namer.h | 2 +- src/binary_annotator.h | 2 +- tests/flexbuffers_test.h | 2 +- tests/json_test.cpp | 2 +- tests/json_test.h | 2 +- tests/monster_test.h | 2 +- tests/optional_scalars_test.cpp | 2 +- tests/parser_test.h | 2 +- tests/proto_test.h | 2 +- 17 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3495b849..525075a31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -426,6 +426,7 @@ else() # This isn't working for some reason: $<$: $<$: + -Wnewline-eof -Wno-unknown-warning-option -Wmissing-declarations -Wzero-as-null-pointer-constant diff --git a/include/flatbuffers/allocator.h b/include/flatbuffers/allocator.h index f4ef22db4..30427190b 100644 --- a/include/flatbuffers/allocator.h +++ b/include/flatbuffers/allocator.h @@ -65,4 +65,4 @@ class Allocator { } // namespace flatbuffers -#endif // FLATBUFFERS_ALLOCATOR_H_ \ No newline at end of file +#endif // FLATBUFFERS_ALLOCATOR_H_ diff --git a/include/flatbuffers/buffer_ref.h b/include/flatbuffers/buffer_ref.h index ce3020733..f70941fc6 100644 --- a/include/flatbuffers/buffer_ref.h +++ b/include/flatbuffers/buffer_ref.h @@ -50,4 +50,4 @@ template struct BufferRef : BufferRefBase { } // namespace flatbuffers -#endif // FLATBUFFERS_BUFFER_REF_H_ \ No newline at end of file +#endif // FLATBUFFERS_BUFFER_REF_H_ diff --git a/include/flatbuffers/default_allocator.h b/include/flatbuffers/default_allocator.h index 8b173af11..d4724122c 100644 --- a/include/flatbuffers/default_allocator.h +++ b/include/flatbuffers/default_allocator.h @@ -61,4 +61,4 @@ inline uint8_t *ReallocateDownward(Allocator *allocator, uint8_t *old_p, } // namespace flatbuffers -#endif // FLATBUFFERS_DEFAULT_ALLOCATOR_H_ \ No newline at end of file +#endif // FLATBUFFERS_DEFAULT_ALLOCATOR_H_ diff --git a/include/flatbuffers/string.h b/include/flatbuffers/string.h index 3db95fce1..97e399fd6 100644 --- a/include/flatbuffers/string.h +++ b/include/flatbuffers/string.h @@ -61,4 +61,4 @@ static inline flatbuffers::string_view GetStringView(const String *str) { } // namespace flatbuffers -#endif // FLATBUFFERS_STRING_H_ \ No newline at end of file +#endif // FLATBUFFERS_STRING_H_ diff --git a/include/flatbuffers/struct.h b/include/flatbuffers/struct.h index d8753c84f..abacc8a9a 100644 --- a/include/flatbuffers/struct.h +++ b/include/flatbuffers/struct.h @@ -50,4 +50,4 @@ class Struct FLATBUFFERS_FINAL_CLASS { } // namespace flatbuffers -#endif // FLATBUFFERS_STRUCT_H_ \ No newline at end of file +#endif // FLATBUFFERS_STRUCT_H_ diff --git a/src/bfbs_gen_lua.cpp b/src/bfbs_gen_lua.cpp index 1d829c758..2c140bb15 100644 --- a/src/bfbs_gen_lua.cpp +++ b/src/bfbs_gen_lua.cpp @@ -630,4 +630,4 @@ std::unique_ptr NewLuaBfbsGenerator( return std::unique_ptr(new LuaBfbsGenerator(flatc_version)); } -} // namespace flatbuffers \ No newline at end of file +} // namespace flatbuffers diff --git a/src/bfbs_gen_lua.h b/src/bfbs_gen_lua.h index 6861282fd..9aa380115 100644 --- a/src/bfbs_gen_lua.h +++ b/src/bfbs_gen_lua.h @@ -30,4 +30,4 @@ std::unique_ptr NewLuaBfbsGenerator( } // namespace flatbuffers -#endif // FLATBUFFERS_BFBS_GEN_LUA_H_ \ No newline at end of file +#endif // FLATBUFFERS_BFBS_GEN_LUA_H_ diff --git a/src/bfbs_namer.h b/src/bfbs_namer.h index ef6c6c5d8..d197574cf 100644 --- a/src/bfbs_namer.h +++ b/src/bfbs_namer.h @@ -48,4 +48,4 @@ class BfbsNamer : public Namer { } // namespace flatbuffers -#endif // FLATBUFFERS_BFBS_NAMER \ No newline at end of file +#endif // FLATBUFFERS_BFBS_NAMER diff --git a/src/binary_annotator.h b/src/binary_annotator.h index f89d0a9ae..7cf820e0f 100644 --- a/src/binary_annotator.h +++ b/src/binary_annotator.h @@ -389,4 +389,4 @@ class BinaryAnnotator { } // namespace flatbuffers -#endif // FLATBUFFERS_BINARY_ANNOTATOR_H_ \ No newline at end of file +#endif // FLATBUFFERS_BINARY_ANNOTATOR_H_ diff --git a/tests/flexbuffers_test.h b/tests/flexbuffers_test.h index 02a10b62e..132098fb3 100644 --- a/tests/flexbuffers_test.h +++ b/tests/flexbuffers_test.h @@ -13,4 +13,4 @@ void ParseFlexbuffersFromJsonWithNullTest(); } // namespace tests } // namespace flatbuffers -#endif // TESTS_FLEXBUFFERS_TEST_H \ No newline at end of file +#endif // TESTS_FLEXBUFFERS_TEST_H diff --git a/tests/json_test.cpp b/tests/json_test.cpp index 6d4064ffc..2224b1a17 100644 --- a/tests/json_test.cpp +++ b/tests/json_test.cpp @@ -171,4 +171,4 @@ void JsonUnsortedArrayTest() { } } // namespace tests -} // namespace flatbuffers \ No newline at end of file +} // namespace flatbuffers diff --git a/tests/json_test.h b/tests/json_test.h index fe6efd45e..a2aa6fba5 100644 --- a/tests/json_test.h +++ b/tests/json_test.h @@ -15,4 +15,4 @@ void JsonUnsortedArrayTest(); } // namespace tests } // namespace flatbuffers -#endif \ No newline at end of file +#endif diff --git a/tests/monster_test.h b/tests/monster_test.h index 5ab968bb5..9a2110a8b 100644 --- a/tests/monster_test.h +++ b/tests/monster_test.h @@ -35,4 +35,4 @@ void UnPackTo(const uint8_t *flatbuf); } // namespace tests } // namespace flatbuffers -#endif \ No newline at end of file +#endif diff --git a/tests/optional_scalars_test.cpp b/tests/optional_scalars_test.cpp index 7d4a87d3d..5dada0291 100644 --- a/tests/optional_scalars_test.cpp +++ b/tests/optional_scalars_test.cpp @@ -98,4 +98,4 @@ void OptionalScalarsTest() { } } -} \ No newline at end of file +} diff --git a/tests/parser_test.h b/tests/parser_test.h index ce6b5e235..d79084912 100644 --- a/tests/parser_test.h +++ b/tests/parser_test.h @@ -30,4 +30,4 @@ void FieldIdentifierTest(); } // namespace tests } // namespace flatbuffers -#endif // TESTS_PARSER_TEST_H \ No newline at end of file +#endif // TESTS_PARSER_TEST_H diff --git a/tests/proto_test.h b/tests/proto_test.h index 9f6137d88..f8c3a727b 100644 --- a/tests/proto_test.h +++ b/tests/proto_test.h @@ -15,4 +15,4 @@ void ParseProtoBufAsciiTest(); } // namespace tests } // namespace flatbuffers -#endif \ No newline at end of file +#endif