未验证 提交 92c63e84 编写于 作者: C Chris Bracken 提交者: GitHub

Ensure trailing newline before EOF in C++ sources (#11489)

In generated text fixture location lookup code:
When the second argument to write_file() is a list, it is written one
item per line to the path specified by the first argument. This ensures
that we emit a trailing newline at EOF to comply with -Wnewline-eof.

Elsewhere:
Lack of a newline at EOF was undefined behaviour prior to C++11. The
Fuchsia tree sets -Wnewline-eof in its buildroot, so we plan to do the
same. This cleans up remaining first-party C++ sources that don't
include a trailing newline.
上级 1ed1ee7c
......@@ -23,4 +23,4 @@ using JsonValueType = rapidjson::Document;
using JsonValueType = Json::Value;
#endif
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_TYPE_H_
\ No newline at end of file
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_TYPE_H_
......@@ -25,4 +25,4 @@
#endif // FLUTTER_DESKTOP_LIBRARY
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_EXPORT_H_
\ No newline at end of file
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_EXPORT_H_
......@@ -35,4 +35,4 @@
@end
#endif // SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
\ No newline at end of file
#endif // SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
......@@ -20,7 +20,10 @@ template("fixtures_location") {
assert(defined(invoker.assets_dir), "The assets directory.")
location_path = rebase_path(invoker.assets_dir)
location_source = "namespace flutter {namespace testing {const char* GetFixturesPath() {return \"$location_path\";}}}"
# Array of source lines. We use a list to ensure a trailing newline is
# emitted by write_file() to comply with -Wnewline-eof.
location_source = [ "namespace flutter {namespace testing {const char* GetFixturesPath() {return \"$location_path\";}}}" ]
location_source_path = "$target_gen_dir/fixtures_location$target_name.cc"
write_file(location_source_path, location_source)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册