From b0e481a653b01e4329bccb1d101d56e3e878e960 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 3 Jun 2016 16:43:46 +0300 Subject: Port to MinGW --- build2/parser.cxx | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'build2/parser.cxx') 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) -- cgit v1.1