aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-06-01 18:25:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-06-01 18:25:52 +0300
commit38775fabb0ba518e323f3bf7c10c7c566b1c4e08 (patch)
tree53d26eb76bd253e195bd0b8827adae688a469049
parentdf58e30c521ebe61897f8960d4914e90e7705419 (diff)
Fix uncaught invalid_path exception
-rw-r--r--build2/cc/compile-rule.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx
index b06b03b..079be88 100644
--- a/build2/cc/compile-rule.cxx
+++ b/build2/cc/compile-rule.cxx
@@ -1083,15 +1083,25 @@ namespace build2
continue;
dir_path d;
- if (o.size () == 2)
+
+ try
{
- if (++i == e)
- break; // Let the compiler complain.
+ if (o.size () == 2)
+ {
+ if (++i == e)
+ break; // Let the compiler complain.
- d = dir_path (*i);
+ d = dir_path (*i);
+ }
+ else
+ d = dir_path (*i, 2, string::npos);
+ }
+ catch (const invalid_path& e)
+ {
+ fail << "invalid -I directory " << e.path
+ << " in variable " << var.name
+ << " for target " << t;
}
- else
- d = dir_path (*i, 2, string::npos);
l6 ([&]{trace << "-I " << d;});