aboutsummaryrefslogtreecommitdiff
path: root/build2/parser.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-22 12:47:21 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-23 20:13:21 +0300
commit2d9579da2144b2a8d67ea1d05fde96ec9d365944 (patch)
treeb4e033f0e8284309efeecd68ba1e9cd70dc75220 /build2/parser.cxx
parent3425432752d362341b8e39cd319d7f3c56aef169 (diff)
Adapt to fdstream extension
Diffstat (limited to 'build2/parser.cxx')
-rw-r--r--build2/parser.cxx23
1 files changed, 6 insertions, 17 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 04accd2..99e4227 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -5,7 +5,6 @@
#include <build2/parser>
#include <cctype> // is{alpha alnum}()
-#include <fstream>
#include <iostream>
#include <build2/version>
@@ -735,12 +734,7 @@ namespace build2
try
{
- ifstream ifs (p.string ());
-
- if (!ifs.is_open ())
- fail (l) << "unable to open " << p;
-
- ifs.exceptions (ifstream::failbit | ifstream::badbit);
+ ifdstream ifs (p);
l5 ([&]{trace (t) << "entering " << p;});
@@ -766,9 +760,9 @@ namespace build2
lexer_ = ol;
path_ = op;
}
- catch (const ifstream::failure&)
+ catch (const ifdstream::failure& e)
{
- fail (l) << "unable to read buildfile " << p;
+ fail (l) << "unable to read buildfile " << p << ": " << e.what ();
}
}
@@ -871,12 +865,7 @@ namespace build2
try
{
- ifstream ifs (p.string ());
-
- if (!ifs.is_open ())
- fail (l) << "unable to open " << p;
-
- ifs.exceptions (ifstream::failbit | ifstream::badbit);
+ ifdstream ifs (p);
l5 ([&]{trace (t) << "entering " << p;});
@@ -908,9 +897,9 @@ namespace build2
lexer_ = ol;
path_ = op;
}
- catch (const ifstream::failure&)
+ catch (const ifdstream::failure& e)
{
- fail (l) << "unable to read buildfile " << p;
+ fail (l) << "unable to read buildfile " << p << ": " << e.what ();
}
scope_ = ocs;