Prioritize the default toolchain with gn args This ensures the default values for gn args are the ones set in the default toolchain, which will likely be used more than others. Change-Id: Ia12dae95fc3776ad7bee4dc6c090314e90055a7a Reviewed-on: https://gn-review.googlesource.com/c/gn/+/14300 Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/src/gn/args.cc b/src/gn/args.cc index 133eff1..fbc0ee4 100644 --- a/src/gn/args.cc +++ b/src/gn/args.cc
@@ -269,7 +269,8 @@ std::lock_guard<std::mutex> lock(lock_); // Sort the keys from declared_arguments_per_toolchain_ so - // the return value will be deterministic. + // the return value will be deterministic. Always prioritize + // the default toolchain. std::vector<const Settings*> keys; keys.reserve(declared_arguments_per_toolchain_.size()); for (const auto& map_pair : declared_arguments_per_toolchain_) { @@ -277,7 +278,8 @@ } std::sort(keys.begin(), keys.end(), [](const Settings* a, const Settings* b) -> bool { - return a->toolchain_label() < b->toolchain_label(); + return a->is_default() || + a->toolchain_label() < b->toolchain_label(); }); // Default values.