From d8f26e8402bbe19820545db90394f657ae42e598 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Jul 2016 10:04:18 +0200 Subject: Save default/hinted ar/ld/rc values as commented out This way, when we, for example, change the C++ compiler (which hinted these values), they will be automatically adjusted as well. --- build2/config/operation.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'build2/config/operation.cxx') diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx index 4a5b39c..c3868ab 100644 --- a/build2/config/operation.cxx +++ b/build2/config/operation.cxx @@ -16,6 +16,7 @@ #include #include +#include using namespace std; using namespace butl; @@ -86,14 +87,16 @@ namespace build2 ofs << "# Created automatically by the config module, but feel " << "free to edit." << endl - << "#" << endl; + << "#" << endl + << endl; if (auto l = root.vars["amalgamation"]) { const dir_path& d (cast (l)); ofs << "# Base configuration inherited from " << d << endl - << "#" << endl; + << "#" << endl + << endl; } // Separate variables for modules with blank lines. @@ -135,6 +138,7 @@ namespace build2 { const auto& p (*i); const variable& var (p.first); + uint64_t sflags (p.second); pair org (root.find_original (var)); pair ovr (var.override == nullptr @@ -249,6 +253,16 @@ namespace build2 if (next_module (var)) ofs << endl; + // Handle the save_commented flag. + // + if (org.first->extra && // Default value. + org.first == ovr.first && // Not overriden. + (sflags & save_commented) == save_commented) + { + ofs << '#' << n << " =" << endl; + continue; + } + if (v) { storage.clear (); -- cgit v1.1