aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-09-04 15:01:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-09-04 15:01:38 +0200
commitfb5954f7b08c98eee41a2b59a1e89ab10569510a (patch)
treeecdd257cbec93284fb1a9469f10feb7acdb73939
parent4a1b4181b4995c1ca6dec84c3bd59821a20af241 (diff)
Fix initializer list lifetime issues
-rw-r--r--build2/cc/compile.cxx8
-rw-r--r--build2/cc/link.cxx24
2 files changed, 12 insertions, 20 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index 39856df..c4df30f 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -1576,14 +1576,10 @@ namespace build2
{
file& t (static_cast<file&> (xt));
- initializer_list<const char*> e;
-
if (cid == "msvc")
- e = {".d", ".idb", ".pdb"};
+ return clean_extra (a, t, {".d", ".idb", ".pdb"});
else
- e = {".d"};
-
- return clean_extra (a, t, e);
+ return clean_extra (a, t, {".d"});
}
}
}
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index 29a46b4..5a8dcb7 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -1606,7 +1606,6 @@ namespace build2
file& t (static_cast<file&> (xt));
libs_paths paths;
- initializer_list<initializer_list<const char*>> e {{".d"}}; // Default.
switch (link_type (t))
{
@@ -1617,16 +1616,14 @@ namespace build2
if (tclass == "windows")
{
if (tsys == "mingw32")
- {
- e = {{".d", ".dlls/", ".manifest.o", ".manifest"}};
- }
+ return clean_extra (
+ a, t, {".d", ".dlls/", ".manifest.o", ".manifest"});
else
- {
// Assuming it's VC or alike. Clean up .ilk in case the user
// enabled incremental linking (note that .ilk replaces .exe).
//
- e = {{".d", ".dlls/", ".manifest", "-.ilk"}};
- }
+ return clean_extra (
+ a, t, {".d", ".dlls/", ".manifest", "-.ilk"});
}
break;
@@ -1641,7 +1638,7 @@ namespace build2
// versioning their bases may not be the same.
//
if (tsys != "mingw32")
- e = {{".d", "-.ilk"}, {"-.exp"}};
+ return clean_extra (a, t, {{".d", "-.ilk"}, {"-.exp"}});
}
else
{
@@ -1649,18 +1646,17 @@ namespace build2
// the paths are empty, then they will be ignored.
//
paths = derive_libs_paths (t);
-
- e = {{".d",
- paths.link.string ().c_str (),
- paths.soname.string ().c_str (),
- paths.interm.string ().c_str ()}};
+ return clean_extra (a, t, {".d",
+ paths.link.string ().c_str (),
+ paths.soname.string ().c_str (),
+ paths.interm.string ().c_str ()});
}
break;
}
}
- return clean_extra (a, t, e);
+ return clean_extra (a, t, {".d"});
}
}
}