Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: tools/gn/args.cc

Issue 40533003: Fix the output of "gn args" for the OS and CPU architecture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn/secondary/build/config/BUILDCONFIG.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/args.cc
diff --git a/tools/gn/args.cc b/tools/gn/args.cc
index 4f746f0c72615c444857905bc396b533b637c42d..2eead427b88349186e2fea5274c2d82d36186104 100644
--- a/tools/gn/args.cc
+++ b/tools/gn/args.cc
@@ -55,10 +55,6 @@ const char kBuildArgs_Help[] =
" arguments to apply to multiple buildfiles.\n";
Args::Args() {
- // These system values are always overridden and won't appear in a
- // declare_args call, so mark them as used to prevent a warning later.
- declared_arguments_[variables::kOs] = Value();
- declared_arguments_[variables::kCpuArch] = Value();
}
Args::Args(const Args& other)
@@ -178,8 +174,6 @@ void Args::SetSystemVars(Scope* dest) const {
Value os_val(NULL, std::string(os));
dest->SetValue(variables::kBuildOs, os_val, NULL);
dest->SetValue(variables::kOs, os_val, NULL);
- declared_arguments_[variables::kBuildOs] = os_val;
- declared_arguments_[variables::kOs] = os_val;
// Host architecture.
static const char kIa32[] = "ia32";
@@ -221,11 +215,17 @@ void Args::SetSystemVars(Scope* dest) const {
Value arch_val(NULL, std::string(arch));
dest->SetValue(variables::kBuildCpuArch, arch_val, NULL);
dest->SetValue(variables::kCpuArch, arch_val, NULL);
- declared_arguments_[variables::kBuildOs] = arch_val;
- declared_arguments_[variables::kOs] = arch_val;
+ // Save the OS and architecture as build arguments that are implicitly
+ // declared. This is so they can be overridden in a toolchain build args
+ // override, and so that they will appear in the "gn args" output.
+ //
+ // Do not declare the build* variants since these shouldn't be changed.
+ //
// Mark these variables used so the build config file can override them
// without geting a warning about overwriting an unused variable.
+ declared_arguments_[variables::kOs] = os_val;
+ declared_arguments_[variables::kCpuArch] = arch_val;
dest->MarkUsed(variables::kCpuArch);
dest->MarkUsed(variables::kOs);
}
« no previous file with comments | « no previous file | tools/gn/secondary/build/config/BUILDCONFIG.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698