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.
This commit is contained in:
Chris Bracken 2019-08-27 00:13:00 -07:00 committed by GitHub
parent 1ed1ee7c2a
commit 92c63e848a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -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_
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_TYPE_H_

View File

@ -25,4 +25,4 @@
#endif // FLUTTER_DESKTOP_LIBRARY
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_EXPORT_H_
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_EXPORT_H_

View File

@ -35,4 +35,4 @@
@end
#endif // SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_
#endif // SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERDARTPROJECT_INTERNAL_H_

View File

@ -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)