diff options
author | Tim King <taking@cs.nyu.edu> | 2018-01-09 22:05:02 -0800 |
---|---|---|
committer | Andres Noetzli <andres.noetzli@gmail.com> | 2018-01-09 22:05:02 -0800 |
commit | 2e5cc613d280fab1be89d8360250cbc3a1635ac9 (patch) | |
tree | ced7d813eec67a32fd3f1b4a1174f5ff00ab1767 /src/base | |
parent | ff9d2c84dae5eb21a7ef77f5931673fb23129730 (diff) |
Cleaning up throw specifiers on Exception and subclasses. (#1475)
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/exception.h | 29 | ||||
-rw-r--r-- | src/base/exception.i | 4 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/base/exception.h b/src/base/exception.h index 01a054b19..04b155571 100644 --- a/src/base/exception.h +++ b/src/base/exception.h @@ -32,24 +32,24 @@ namespace CVC4 { class CVC4_PUBLIC Exception : public std::exception { -protected: + protected: std::string d_msg; -public: + public: // Constructors - Exception() throw() : d_msg("Unknown exception") {} - Exception(const std::string& msg) throw() : d_msg(msg) {} - Exception(const char* msg) throw() : d_msg(msg) {} + Exception() : d_msg("Unknown exception") {} + Exception(const std::string& msg) : d_msg(msg) {} + Exception(const char* msg) : d_msg(msg) {} // Destructor - virtual ~Exception() throw() {} + virtual ~Exception() {} // NON-VIRTUAL METHOD for setting and printing the error message - void setMessage(const std::string& msg) throw() { d_msg = msg; } - std::string getMessage() const throw() { return d_msg; } + void setMessage(const std::string& msg) { d_msg = msg; } + std::string getMessage() const { return d_msg; } // overridden from base class std::exception - virtual const char* what() const throw() { return d_msg.c_str(); } + const char* what() const noexcept override { return d_msg.c_str(); } /** * Get this exception as a string. Note that @@ -63,7 +63,8 @@ public: * toString(), there is no stream, so the parameters are default * and you'll get exprs and types printed using the AST language. */ - std::string toString() const throw() { + std::string toString() const + { std::stringstream ss; toStream(ss); return ss.str(); @@ -74,7 +75,7 @@ public: * a derived class, it's recommended that this method print the * type of exception before the actual message. */ - virtual void toStream(std::ostream& os) const throw() { os << d_msg; } + virtual void toStream(std::ostream& os) const { os << d_msg; } };/* class Exception */ @@ -116,8 +117,10 @@ public: static std::string formatVariadic(const char* format, ...); };/* class IllegalArgumentException */ -inline std::ostream& operator<<(std::ostream& os, const Exception& e) throw() CVC4_PUBLIC; -inline std::ostream& operator<<(std::ostream& os, const Exception& e) throw() { +inline std::ostream& operator<<(std::ostream& os, + const Exception& e) CVC4_PUBLIC; +inline std::ostream& operator<<(std::ostream& os, const Exception& e) +{ e.toStream(os); return os; } diff --git a/src/base/exception.i b/src/base/exception.i index 083670567..429d13a63 100644 --- a/src/base/exception.i +++ b/src/base/exception.i @@ -2,8 +2,8 @@ #include "base/exception.h" %} -%ignore CVC4::operator<<(std::ostream&, const Exception&) throw(); -%ignore CVC4::Exception::Exception(const char*) throw(); +%ignore CVC4::operator<<(std::ostream&, const Exception&); +%ignore CVC4::Exception::Exception(const char*); %typemap(javabase) CVC4::Exception "java.lang.RuntimeException"; %rename(CVC4IllegalArgumentException) CVC4::IllegalArgumentException; |