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

Unified Diff: tools/gn/config_values.cc

Issue 1342183003: Allow GN configs to have sub-configs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: tools/gn/config_values.cc
diff --git a/tools/gn/config_values.cc b/tools/gn/config_values.cc
index 53466dfd79180b8c211b9d9202a1db73b9166f36..f320f41bb0d2e5e840dec8dafb93e2644aea51dc 100644
--- a/tools/gn/config_values.cc
+++ b/tools/gn/config_values.cc
@@ -4,8 +4,43 @@
#include "tools/gn/config_values.h"
+namespace {
+
+template<typename T>
+void VectorAppend(std::vector<T>* append_to,
+ const std::vector<T>& append_this) {
+ if (append_this.empty())
+ return;
+ append_to->insert(append_to->end(),append_this.begin(), append_this.end());
+}
+
+} // namespace
+
ConfigValues::ConfigValues() {
}
ConfigValues::~ConfigValues() {
}
+
+void ConfigValues::AppendValues(const ConfigValues& append) {
+ #define APPEND_VALUES(variable) VectorAppend(&variable, append.variable)
+ APPEND_VALUES(cflags_);
+ APPEND_VALUES(cflags_c_);
+ APPEND_VALUES(cflags_cc_);
+ APPEND_VALUES(cflags_objcc_);
+ APPEND_VALUES(defines_);
+ APPEND_VALUES(include_dirs_);
+ APPEND_VALUES(ldflags_);
+ APPEND_VALUES(lib_dirs_);
+ APPEND_VALUES(libs_);
+ #undef APPEND_VALUES
Dirk Pranke 2015/09/15 21:31:31 I'm not sure the macro enhances readability much h
+
+ // Only append precompiled header if there isn't one. It might be nice to
+ // throw an error if there are conflicting precompiled headers, but that
+ // requires piping through some context of the actual configs involved, and
+ // conflicts here should be very unusual. Instead, use the first value.
+ if (!append.precompiled_header_.empty() && !precompiled_header_.empty())
+ precompiled_header_ = append.precompiled_header_;
+ if (!append.precompiled_source_.is_null() && !precompiled_source_.is_null())
+ precompiled_source_ = append.precompiled_source_;
+}

Powered by Google App Engine
This is Rietveld 408576698