diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-06-03 16:43:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-06-18 15:17:29 +0300 |
commit | b0e481a653b01e4329bccb1d101d56e3e878e960 (patch) | |
tree | bba1a4cae73ec4ece95f408e079a15d664e49927 /build2/parser.cxx | |
parent | 0d692ec857340a0f16a03d6a7ef38fe864a83cfc (diff) |
Port to MinGW
Diffstat (limited to 'build2/parser.cxx')
-rw-r--r-- | build2/parser.cxx | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx index 6351cae..9d11d74 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -31,15 +31,26 @@ namespace build2 class parser::enter_scope { public: - enter_scope (): p_ (nullptr) {} + enter_scope (): p_ (nullptr), r_ (nullptr), s_ (nullptr) {} + enter_scope (parser& p, dir_path&& d): p_ (&p), r_ (p.root_), s_ (p.scope_) { - // Relative scopes are opened relative to out, not src. + // Check for the global scope as a special case. While on POSIX the + // check is redundant, on Windows the path completion/normalization + // would otherwise transform it to the out path of the current scope + // since "/" is a relative path on Windows (and we use "/" even on + // Windows for that gloabl scope). // - if (d.relative ()) - d = p.scope_->out_path () / d; + if (d != dir_path ("/")) + { + // Relative scopes are opened relative to out, not src. + // + if (d.relative ()) + d = p.scope_->out_path () / d; + + d.normalize (); + } - d.normalize (); p.switch_scope (d); } @@ -70,7 +81,8 @@ namespace build2 class parser::enter_target { public: - enter_target (): p_ (nullptr) {} + enter_target (): p_ (nullptr), t_ (nullptr) {} + enter_target (parser& p, name&& n, const location& loc, tracer& tr) : p_ (&p), t_ (p.target_) { @@ -1074,7 +1086,8 @@ namespace build2 try {iv = to_version (v);} catch (const invalid_argument& e) { - fail (l) << "invalid version '" << v << "': " << e.what (); + error (l) << "invalid version '" << v << "': " << e.what (); + throw failed (); } if (iv > BUILD2_VERSION) |