aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-09-15 17:06:24 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-09-15 17:15:26 +0300
commit3473cc68f59911cb6659634fdc577f882c8128de (patch)
treea49450c846bf4ac8ae6159f35f36406cfe58221a
parent0ce6a95f5fca35888632551181e2c3756e38942c (diff)
Add io_error alias for std::ios_base::failure
-rw-r--r--build2/b.cxx8
-rw-r--r--build2/cc/compile.cxx6
-rw-r--r--build2/cc/gcc.cxx2
-rw-r--r--build2/cc/link.cxx4
-rw-r--r--build2/cc/msvc.cxx2
-rw-r--r--build2/cc/windows-manifest.cxx4
-rw-r--r--build2/cc/windows-rpath.cxx2
-rw-r--r--build2/cli/init.cxx2
-rw-r--r--build2/config/operation.cxx4
-rw-r--r--build2/depdb2
-rw-r--r--build2/file.cxx6
-rw-r--r--build2/parser.cxx6
-rw-r--r--build2/types3
-rw-r--r--build2/utility.txx2
-rw-r--r--tests/lexer/driver.cxx2
15 files changed, 28 insertions, 27 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index 8031559..d16a406 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -9,7 +9,7 @@
#include <sstream>
#include <cstring> // strcmp(), strchr()
#include <typeinfo>
-#include <iostream>
+#include <iostream> // cout
#include <butl/pager>
@@ -195,8 +195,8 @@ main (int argc, char* argv[])
//
return p.wait () ? 0 : 1;
}
- // Catch ios_base::failure as std::system_error together with the
- // pager-specific exceptions.
+ // Catch io_error as std::system_error together with the pager-specific
+ // exceptions.
//
catch (const system_error& e)
{
@@ -273,7 +273,7 @@ main (int argc, char* argv[])
parser p;
bspec = p.parse_buildspec (is, path ("<buildspec>"));
}
- catch (const istringstream::failure&)
+ catch (const io_error&)
{
fail << "unable to parse buildspec '" << args << "'";
}
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index 2dc2a28..6587d8c 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -1201,7 +1201,7 @@ namespace build2
if (is.eof ()) // Trailing newline.
break;
- throw ifdstream::failure ("");
+ throw io_error ("");
}
l6 ([&]{trace << "header dependency line '" << l << "'";});
@@ -1349,7 +1349,7 @@ namespace build2
fail << "expected error exist status from " << x_lang
<< " compiler";
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
pr.wait ();
fail << "unable to read " << x_lang << " compiler header "
@@ -1567,7 +1567,7 @@ namespace build2
is.close ();
}
- catch (const ifdstream::failure&) {} // Assume exits with error.
+ catch (const io_error&) {} // Assume exits with error.
}
if (!pr.wait ())
diff --git a/build2/cc/gcc.cxx b/build2/cc/gcc.cxx
index 4c115b4..a5c8357 100644
--- a/build2/cc/gcc.cxx
+++ b/build2/cc/gcc.cxx
@@ -80,7 +80,7 @@ namespace build2
if (!pr.wait ())
throw failed ();
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
pr.wait ();
fail << "error reading " << x_lang << " compiler -print-search-dirs "
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index d36e5e1..5ab9d91 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -974,7 +974,7 @@ namespace build2
if (!pr.wait ())
throw failed (); // Assume diagnostics issued.
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
if (pr.wait ()) // Ignore if child failed.
fail << "unable to pipe resource file to " << args[0]
@@ -1489,7 +1489,7 @@ namespace build2
is.close ();
}
- catch (const ifdstream::failure&) {} // Assume exits with error.
+ catch (const io_error&) {} // Assume exits with error.
}
if (!pr.wait ())
diff --git a/build2/cc/msvc.cxx b/build2/cc/msvc.cxx
index 80beb09..5261072 100644
--- a/build2/cc/msvc.cxx
+++ b/build2/cc/msvc.cxx
@@ -192,7 +192,7 @@ namespace build2
}
}
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Presumably the child process failed. Let run_finish() deal with
// that.
diff --git a/build2/cc/windows-manifest.cxx b/build2/cc/windows-manifest.cxx
index a3e87fe..da0aaf1 100644
--- a/build2/cc/windows-manifest.cxx
+++ b/build2/cc/windows-manifest.cxx
@@ -110,7 +110,7 @@ namespace build2
if (s == m)
return mf;
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Whatever the reason we failed for , let's rewrite the file.
}
@@ -125,7 +125,7 @@ namespace build2
ofs << m;
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write to " << m << ": " << e.what ();
}
diff --git a/build2/cc/windows-rpath.cxx b/build2/cc/windows-rpath.cxx
index 1bef95c..5c70ff9 100644
--- a/build2/cc/windows-rpath.cxx
+++ b/build2/cc/windows-rpath.cxx
@@ -369,7 +369,7 @@ namespace build2
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write to " << am << ": " << e.what ();
}
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index c14f7cf..b41e095 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -122,7 +122,7 @@ namespace build2
// Presumably issued diagnostics. Fall through.
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
pr.wait ();
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index 83365f7..0aa554f 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -55,7 +55,7 @@ namespace build2
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write " << f << ": " << e.what ();
}
@@ -275,7 +275,7 @@ namespace build2
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write " << f << ": " << e.what ();
}
diff --git a/build2/depdb b/build2/depdb
index 6dec29e..569595c 100644
--- a/build2/depdb
+++ b/build2/depdb
@@ -13,7 +13,7 @@
namespace build2
{
- // Auxiliary dependency database (those .d files). Uses iostream failure and
+ // Auxiliary dependency database (those .d files). Uses io_error and
// system_error exceptions to signal errors.
//
// This is a strange beast: a line-oriented, streaming database that can, at
diff --git a/build2/file.cxx b/build2/file.cxx
index 8239d1f..eaf503d 100644
--- a/build2/file.cxx
+++ b/build2/file.cxx
@@ -104,7 +104,7 @@ namespace build2
parser p (boot);
p.parse_buildfile (is, bf, root, base);
}
- catch (const ifdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to read buildfile " << bf << ": " << e.what ();
}
@@ -303,7 +303,7 @@ namespace build2
//
return make_pair (move (*v), true);
}
- catch (const ifdstream::failure& e)
+ catch (const io_error& e)
{
error << "unable to read buildfile " << bf << ": " << e.what ();
throw failed ();
@@ -1027,7 +1027,7 @@ namespace build2
parser p;
return p.parse_export_stub (ifs, es, iroot, ts);
}
- catch (const ifdstream::failure& e)
+ catch (const io_error& e)
{
fail (loc) << "unable to read buildfile " << es << ": " << e.what ();
}
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 1bc3519..05a2594 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -4,7 +4,7 @@
#include <build2/parser>
-#include <iostream>
+#include <iostream> // cout
#include <build2/version>
@@ -821,7 +821,7 @@ namespace build2
lexer_ = ol;
path_ = op;
}
- catch (const ifdstream::failure& e)
+ catch (const io_error& e)
{
fail (l) << "unable to read buildfile " << p << ": " << e.what ();
}
@@ -957,7 +957,7 @@ namespace build2
lexer_ = ol;
path_ = op;
}
- catch (const ifdstream::failure& e)
+ catch (const io_error& e)
{
fail (l) << "unable to read buildfile " << p << ": " << e.what ();
}
diff --git a/build2/types b/build2/types
index c90b779..19fe888 100644
--- a/build2/types
+++ b/build2/types
@@ -17,7 +17,7 @@
#include <functional> // function, reference_wrapper
#include <initializer_list>
-
+#include <ios> // ios_base::failure
#include <exception> // exception
#include <stdexcept> // logic_error, invalid_argument, runtime_error
#include <system_error>
@@ -70,6 +70,7 @@ namespace build2
using std::invalid_argument;
using std::runtime_error;
using std::system_error;
+ using io_error = std::ios_base::failure;
// <butl/optional>
//
diff --git a/build2/utility.txx b/build2/utility.txx
index 7256547..1c710ee 100644
--- a/build2/utility.txx
+++ b/build2/utility.txx
@@ -34,7 +34,7 @@ namespace build2
r = f (l);
}
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Presumably the child process failed. Let run_finish() deal with that.
}
diff --git a/tests/lexer/driver.cxx b/tests/lexer/driver.cxx
index 8ba71a5..5575956 100644
--- a/tests/lexer/driver.cxx
+++ b/tests/lexer/driver.cxx
@@ -161,7 +161,7 @@ lex (const char* s)
{
r.push_back ("<lexer error>");
}
- catch (const std::ios_base::failure&)
+ catch (const io_error&)
{
r.push_back ("<io error>");
}