Fix the output of "gn args" for the OS and CPU architecture.

The internal declarations of these weren't getting set correctly. This only affects the output of "gn args".

BUG=
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/40533003

Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: dbd915b46e952364ad911640fef194b6f36076f9
diff --git a/tools/gn/args.cc b/tools/gn/args.cc
index 4f746f0..2eead42 100644
--- a/tools/gn/args.cc
+++ b/tools/gn/args.cc
@@ -55,10 +55,6 @@
     "  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 @@
   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 @@
   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);
 }
diff --git a/tools/gn/secondary/build/config/BUILDCONFIG.gn b/tools/gn/secondary/build/config/BUILDCONFIG.gn
index 1ae5e55..78a3f27 100644
--- a/tools/gn/secondary/build/config/BUILDCONFIG.gn
+++ b/tools/gn/secondary/build/config/BUILDCONFIG.gn
@@ -34,10 +34,13 @@
   is_clang = false
 
   # ASH is enabled.
+  # TODO(brettw) this should be moved out of the main build config file.
   use_ash = false
   # Aura is enabled.
+  # TODO(brettw) this should be moved out of the main build config file.
   use_aura = false
   # Ozone is enabled.
+  # TODO(brettw) this should be moved out of the main build config file.
   use_ozone = false
 }