gn: fix build with GCC 5
Technically, this code is correct, but practically a problem as it
makes it hard to read and comprehend for people that have not
completely memorised the C++ standard and its scoping rules.
It also triggers a compiler bug in GCC 5.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54430
https://bugs.gentoo.org/show_bug.cgi?id=605828
tools/gn/xcode_writer.cc:173:29: error: use of ‘target’ before deduction of ‘auto’
for (const auto& target : target->public_deps()) {
Review-Url: https://codereview.chromium.org/2632113003
Cr-Original-Commit-Position: refs/heads/master@{#444083}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6d75d94d4a41eab2f2963e5ae0cdc0cfad4706c9
diff --git a/tools/gn/xcode_writer.cc b/tools/gn/xcode_writer.cc
index 242f0b0..a780d80 100644
--- a/tools/gn/xcode_writer.cc
+++ b/tools/gn/xcode_writer.cc
@@ -170,18 +170,18 @@
}
// Call recursively on public and private deps.
- for (const auto& target : target->public_deps()) {
- SearchXCTestFiles(target.ptr, xctest_files_per_target);
+ for (const auto& t : target->public_deps()) {
+ SearchXCTestFiles(t.ptr, xctest_files_per_target);
const Target::FileList& deps_xctest_files =
- (*xctest_files_per_target)[target.ptr];
+ (*xctest_files_per_target)[t.ptr];
xctest_files.insert(xctest_files.end(), deps_xctest_files.begin(),
deps_xctest_files.end());
}
- for (const auto& target : target->private_deps()) {
- SearchXCTestFiles(target.ptr, xctest_files_per_target);
+ for (const auto& t : target->private_deps()) {
+ SearchXCTestFiles(t.ptr, xctest_files_per_target);
const Target::FileList& deps_xctest_files =
- (*xctest_files_per_target)[target.ptr];
+ (*xctest_files_per_target)[t.ptr];
xctest_files.insert(xctest_files.end(), deps_xctest_files.begin(),
deps_xctest_files.end());
}