From 92c63e848a5efcc6064686f8cfc1913072681ff2 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 27 Aug 2019 00:13:00 -0700 Subject: [PATCH] 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. --- .../common/cpp/client_wrapper/include/flutter/json_type.h | 2 +- shell/platform/common/cpp/public/flutter_export.h | 2 +- .../macos/framework/Source/FlutterDartProject_Internal.h | 2 +- testing/testing.gni | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h b/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h index 476cee7bfb9..24baf1328d6 100644 --- a/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h @@ -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_ diff --git a/shell/platform/common/cpp/public/flutter_export.h b/shell/platform/common/cpp/public/flutter_export.h index 2f380915f95..ed1660c4398 100644 --- a/shell/platform/common/cpp/public/flutter_export.h +++ b/shell/platform/common/cpp/public/flutter_export.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_ diff --git a/shell/platform/darwin/macos/framework/Source/FlutterDartProject_Internal.h b/shell/platform/darwin/macos/framework/Source/FlutterDartProject_Internal.h index 9bd27904b4e..ecc6388af31 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterDartProject_Internal.h +++ b/shell/platform/darwin/macos/framework/Source/FlutterDartProject_Internal.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_ diff --git a/testing/testing.gni b/testing/testing.gni index 2356f45bfa7..30c6c715518 100644 --- a/testing/testing.gni +++ b/testing/testing.gni @@ -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)