aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-08 14:48:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-08 14:48:31 +0200
commit687e7cac244cd706c7f959f0486ab405d6942cdd (patch)
treee3cb8560ff61e091273addc92c9435a86ec6197d
parent928f59d6722c9d1948ce142f2d7a79027c5430a5 (diff)
Work around VC static initialization order issue
-rw-r--r--build2/config/operation.cxx16
-rw-r--r--build2/operation.cxx4
2 files changed, 14 insertions, 6 deletions
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index d5a1565..14ab38c 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -381,14 +381,18 @@ namespace build2
id < rs->operations.size ();
++id)
{
- const operation_info* oif (rs->operations[id]);
- if (oif == nullptr)
- continue;
+ if (const operation_info* oif = rs->operations[id])
+ {
+ // Skip aliases (e.g., update-for-install).
+ //
+ if (oif->id != id)
+ continue;
- set_current_oif (*oif);
+ set_current_oif (*oif);
- phase_lock pl (run_phase::match);
- match (action (configure_id, id), t);
+ phase_lock pl (run_phase::match);
+ match (action (configure_id, id), t);
+ }
}
configure_project (a, *rs, projects);
diff --git a/build2/operation.cxx b/build2/operation.cxx
index f262321..b242cb3 100644
--- a/build2/operation.cxx
+++ b/build2/operation.cxx
@@ -537,6 +537,10 @@ namespace build2
#ifndef _MSC_VER
constexpr
#else
+ // VC doesn't "see" this can be const-initialized so we have to hack around
+ // to ensure correct initialization order.
+ //
+ #pragma init_seg(lib)
const
#endif
operation_info op_update {