Use noexcept instead of exception specifications
This commit is contained in:
parent
5d0f6e6f73
commit
5eac13a969
|
@ -56,7 +56,7 @@ string for that error code.
|
|||
class XArchEval {
|
||||
public:
|
||||
XArchEval() { }
|
||||
virtual ~XArchEval() _NOEXCEPT { }
|
||||
virtual ~XArchEval() noexcept { }
|
||||
|
||||
virtual std::string eval() const = 0;
|
||||
};
|
||||
|
@ -66,7 +66,7 @@ class XArch : public std::runtime_error {
|
|||
public:
|
||||
XArch(XArchEval* adopted) : std::runtime_error(adopted->eval()) { delete adopted; }
|
||||
XArch(const std::string& msg) : std::runtime_error(msg) { }
|
||||
virtual ~XArch() _NOEXCEPT { }
|
||||
virtual ~XArch() noexcept { }
|
||||
};
|
||||
|
||||
// Macro to declare XArch derived types
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
class XArchEvalUnix : public XArchEval {
|
||||
public:
|
||||
XArchEvalUnix(int error) : m_error(error) { }
|
||||
virtual ~XArchEvalUnix() _NOEXCEPT { }
|
||||
virtual ~XArchEvalUnix() noexcept { }
|
||||
|
||||
virtual std::string eval() const;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
//
|
||||
|
||||
std::string
|
||||
XArchEvalWindows::eval() const throw()
|
||||
XArchEvalWindows::eval() const noexcept
|
||||
{
|
||||
char* cmsg;
|
||||
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
|
@ -50,7 +50,7 @@ XArchEvalWindows::eval() const throw()
|
|||
//
|
||||
|
||||
std::string
|
||||
XArchEvalWinsock::eval() const throw()
|
||||
XArchEvalWinsock::eval() const noexcept
|
||||
{
|
||||
// built-in windows function for looking up error message strings
|
||||
// may not look up network error messages correctly. we'll have
|
||||
|
|
|
@ -539,7 +539,7 @@ ProtocolUtil::read(barrier::IStream* stream, void* vbuffer, UInt32 count)
|
|||
//
|
||||
|
||||
String
|
||||
XIOReadMismatch::getWhat() const throw()
|
||||
XIOReadMismatch::getWhat() const noexcept
|
||||
{
|
||||
return format("XIOReadMismatch", "ProtocolUtil::readf() mismatch");
|
||||
}
|
||||
|
|
|
@ -92,5 +92,5 @@ match the format.
|
|||
class XIOReadMismatch : public XIO {
|
||||
public:
|
||||
// XBase overrides
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
};
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
// XBadClient
|
||||
//
|
||||
|
||||
String
|
||||
XBadClient::getWhat() const throw()
|
||||
String XBadClient::getWhat() const noexcept
|
||||
{
|
||||
return "XBadClient";
|
||||
}
|
||||
|
@ -41,20 +40,17 @@ XIncompatibleClient::XIncompatibleClient(int major, int minor) :
|
|||
// do nothing
|
||||
}
|
||||
|
||||
int
|
||||
XIncompatibleClient::getMajor() const throw()
|
||||
int XIncompatibleClient::getMajor() const noexcept
|
||||
{
|
||||
return m_major;
|
||||
}
|
||||
|
||||
int
|
||||
XIncompatibleClient::getMinor() const throw()
|
||||
int XIncompatibleClient::getMinor() const noexcept
|
||||
{
|
||||
return m_minor;
|
||||
}
|
||||
|
||||
String
|
||||
XIncompatibleClient::getWhat() const throw()
|
||||
String XIncompatibleClient::getWhat() const noexcept
|
||||
{
|
||||
return format("XIncompatibleClient", "incompatible client %{1}.%{2}",
|
||||
barrier::string::sprintf("%d", m_major).c_str(),
|
||||
|
@ -72,14 +68,12 @@ XDuplicateClient::XDuplicateClient(const String& name) :
|
|||
// do nothing
|
||||
}
|
||||
|
||||
const String&
|
||||
XDuplicateClient::getName() const throw()
|
||||
const String& XDuplicateClient::getName() const noexcept
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
String
|
||||
XDuplicateClient::getWhat() const throw()
|
||||
String XDuplicateClient::getWhat() const noexcept
|
||||
{
|
||||
return format("XDuplicateClient", "duplicate client %{1}", m_name.c_str());
|
||||
}
|
||||
|
@ -95,14 +89,12 @@ XUnknownClient::XUnknownClient(const String& name) :
|
|||
// do nothing
|
||||
}
|
||||
|
||||
const String&
|
||||
XUnknownClient::getName() const throw()
|
||||
const String& XUnknownClient::getName() const noexcept
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
String
|
||||
XUnknownClient::getWhat() const throw()
|
||||
String XUnknownClient::getWhat() const noexcept
|
||||
{
|
||||
return format("XUnknownClient", "unknown client %{1}", m_name.c_str());
|
||||
}
|
||||
|
@ -118,14 +110,12 @@ XExitApp::XExitApp(int code) :
|
|||
// do nothing
|
||||
}
|
||||
|
||||
int
|
||||
XExitApp::getCode() const throw()
|
||||
int XExitApp::getCode() const noexcept
|
||||
{
|
||||
return m_code;
|
||||
}
|
||||
|
||||
String
|
||||
XExitApp::getWhat() const throw()
|
||||
String XExitApp::getWhat() const noexcept
|
||||
{
|
||||
return format(
|
||||
"XExitApp", "exiting with code %{1}",
|
||||
|
|
|
@ -47,14 +47,14 @@ public:
|
|||
//@{
|
||||
|
||||
//! Get client's major version number
|
||||
int getMajor() const throw();
|
||||
int getMajor() const noexcept;
|
||||
//! Get client's minor version number
|
||||
int getMinor() const throw();
|
||||
int getMinor() const noexcept;
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
|
||||
private:
|
||||
int m_major;
|
||||
|
@ -69,18 +69,18 @@ a client that is already connected.
|
|||
class XDuplicateClient : public XBarrier {
|
||||
public:
|
||||
XDuplicateClient(const std::string& name);
|
||||
virtual ~XDuplicateClient() _NOEXCEPT { }
|
||||
virtual ~XDuplicateClient() noexcept { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Get client's name
|
||||
virtual const std::string& getName() const throw();
|
||||
virtual const std::string& getName() const noexcept;
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
|
@ -94,18 +94,18 @@ unknown to the server.
|
|||
class XUnknownClient : public XBarrier {
|
||||
public:
|
||||
XUnknownClient(const std::string& name);
|
||||
virtual ~XUnknownClient() _NOEXCEPT { }
|
||||
virtual ~XUnknownClient() noexcept { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Get the client's name
|
||||
virtual const std::string& getName() const throw();
|
||||
virtual const std::string& getName() const noexcept;
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
|
@ -120,13 +120,13 @@ exit(int).
|
|||
class XExitApp : public XBarrier {
|
||||
public:
|
||||
XExitApp(int code);
|
||||
virtual ~XExitApp() _NOEXCEPT { }
|
||||
virtual ~XExitApp() noexcept { }
|
||||
|
||||
//! Get the exit code
|
||||
int getCode() const throw();
|
||||
int getCode() const noexcept;
|
||||
|
||||
protected:
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
|
||||
private:
|
||||
int m_code;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// XScreenOpenFailure
|
||||
//
|
||||
|
||||
std::string XScreenOpenFailure::getWhat() const throw()
|
||||
std::string XScreenOpenFailure::getWhat() const noexcept
|
||||
{
|
||||
return format("XScreenOpenFailure", "unable to open screen");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ std::string XScreenOpenFailure::getWhat() const throw()
|
|||
// XScreenXInputFailure
|
||||
//
|
||||
|
||||
std::string XScreenXInputFailure::getWhat() const throw()
|
||||
std::string XScreenXInputFailure::getWhat() const noexcept
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ XScreenUnavailable::XScreenUnavailable(double timeUntilRetry) :
|
|||
// do nothing
|
||||
}
|
||||
|
||||
XScreenUnavailable::~XScreenUnavailable() _NOEXCEPT
|
||||
XScreenUnavailable::~XScreenUnavailable() noexcept
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ XScreenUnavailable::getRetryTime() const
|
|||
return m_timeUntilRetry;
|
||||
}
|
||||
|
||||
std::string XScreenUnavailable::getWhat() const throw()
|
||||
std::string XScreenUnavailable::getWhat() const noexcept
|
||||
{
|
||||
return format("XScreenUnavailable", "unable to open screen");
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
trying to open the screen again.
|
||||
*/
|
||||
XScreenUnavailable(double timeUntilRetry);
|
||||
virtual ~XScreenUnavailable() _NOEXCEPT;
|
||||
virtual ~XScreenUnavailable() noexcept;
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
//@}
|
||||
|
||||
protected:
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
|
||||
private:
|
||||
double m_timeUntilRetry;
|
||||
|
|
|
@ -38,13 +38,13 @@ XBase::XBase(const std::string& msg) :
|
|||
// do nothing
|
||||
}
|
||||
|
||||
XBase::~XBase() _NOEXCEPT
|
||||
XBase::~XBase() noexcept
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
const char*
|
||||
XBase::what() const _NOEXCEPT
|
||||
XBase::what() const noexcept
|
||||
{
|
||||
const char* what = std::runtime_error::what();
|
||||
if (strlen(what) == 0) {
|
||||
|
@ -54,8 +54,7 @@ XBase::what() const _NOEXCEPT
|
|||
return what;
|
||||
}
|
||||
|
||||
std::string
|
||||
XBase::format(const char* /*id*/, const char* fmt, ...) const throw()
|
||||
std::string XBase::format(const char* /*id*/, const char* fmt, ...) const noexcept
|
||||
{
|
||||
// FIXME -- lookup message string using id as an index. set
|
||||
// fmt to that string if it exists.
|
||||
|
|
|
@ -31,14 +31,14 @@ public:
|
|||
XBase();
|
||||
//! Use \c msg as the result of what()
|
||||
XBase(const std::string& msg);
|
||||
virtual ~XBase() _NOEXCEPT;
|
||||
virtual ~XBase() noexcept;
|
||||
|
||||
//! Reason for exception
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
virtual const char* what() const noexcept;
|
||||
|
||||
protected:
|
||||
//! Get a human readable string describing the exception
|
||||
virtual std::string getWhat() const throw() { return ""; }
|
||||
virtual std::string getWhat() const noexcept { return ""; }
|
||||
|
||||
//! Format a string
|
||||
/*!
|
||||
|
@ -46,7 +46,7 @@ protected:
|
|||
no format can be found, then replaces positional parameters in
|
||||
the format string and returns the result.
|
||||
*/
|
||||
virtual std::string format(const char* id, const char* defaultFormat, ...) const throw();
|
||||
virtual std::string format(const char* id, const char* defaultFormat, ...) const noexcept;
|
||||
private:
|
||||
mutable std::string m_what;
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ class name_ : public super_ { \
|
|||
public: \
|
||||
name_() : super_() { } \
|
||||
name_(const std::string& msg) : super_(msg) { } \
|
||||
virtual ~name_() _NOEXCEPT { } \
|
||||
virtual ~name_() noexcept { } \
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -76,10 +76,10 @@ class name_ : public super_ { \
|
|||
public: \
|
||||
name_() : super_() { } \
|
||||
name_(const std::string& msg) : super_(msg) { } \
|
||||
virtual ~name_() _NOEXCEPT { } \
|
||||
virtual ~name_() noexcept { } \
|
||||
\
|
||||
protected: \
|
||||
virtual std::string getWhat() const throw(); \
|
||||
virtual std::string getWhat() const noexcept; \
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -98,9 +98,9 @@ private: \
|
|||
public: \
|
||||
name_() : super_(), m_state(kDone) { } \
|
||||
name_(const std::string& msg) : super_(msg), m_state(kFirst) { } \
|
||||
virtual ~name_() _NOEXCEPT { } \
|
||||
virtual ~name_() noexcept { } \
|
||||
\
|
||||
virtual const char* what() const _NOEXCEPT \
|
||||
virtual const char* what() const noexcept \
|
||||
{ \
|
||||
if (m_state == kFirst) { \
|
||||
m_state = kFormat; \
|
||||
|
@ -116,7 +116,7 @@ public: \
|
|||
} \
|
||||
\
|
||||
protected: \
|
||||
virtual std::string getWhat() const throw(); \
|
||||
virtual std::string getWhat() const noexcept; \
|
||||
\
|
||||
private: \
|
||||
mutable EState m_state; \
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
|
||||
// apple declares _NOEXCEPT
|
||||
#ifndef _NOEXCEPT
|
||||
# define _NOEXCEPT throw()
|
||||
# define _NOEXCEPT noexcept
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// XIOClosed
|
||||
//
|
||||
|
||||
std::string XIOClosed::getWhat() const throw()
|
||||
std::string XIOClosed::getWhat() const noexcept
|
||||
{
|
||||
return format("XIOClosed", "already closed");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ std::string XIOClosed::getWhat() const throw()
|
|||
// XIOEndOfStream
|
||||
//
|
||||
|
||||
std::string XIOEndOfStream::getWhat() const throw()
|
||||
std::string XIOEndOfStream::getWhat() const noexcept
|
||||
{
|
||||
return format("XIOEndOfStream", "reached end of stream");
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ std::string XIOEndOfStream::getWhat() const throw()
|
|||
// XIOWouldBlock
|
||||
//
|
||||
|
||||
std::string XIOWouldBlock::getWhat() const throw()
|
||||
std::string XIOWouldBlock::getWhat() const noexcept
|
||||
{
|
||||
return format("XIOWouldBlock", "stream operation would block");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// XMTThreadUnavailable
|
||||
//
|
||||
|
||||
std::string XMTThreadUnavailable::getWhat() const throw()
|
||||
std::string XMTThreadUnavailable::getWhat() const noexcept
|
||||
{
|
||||
return format("XMTThreadUnavailable", "cannot create thread");
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// XSocketAddress
|
||||
//
|
||||
|
||||
XSocketAddress::XSocketAddress(EError error, const std::string& hostname, int port) _NOEXCEPT :
|
||||
XSocketAddress::XSocketAddress(EError error, const std::string& hostname, int port) noexcept :
|
||||
m_error(error),
|
||||
m_hostname(hostname),
|
||||
m_port(port)
|
||||
|
@ -31,25 +31,22 @@ XSocketAddress::XSocketAddress(EError error, const std::string& hostname, int po
|
|||
// do nothing
|
||||
}
|
||||
|
||||
XSocketAddress::EError
|
||||
XSocketAddress::getError() const throw()
|
||||
XSocketAddress::EError XSocketAddress::getError() const noexcept
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
std::string
|
||||
XSocketAddress::getHostname() const throw()
|
||||
std::string XSocketAddress::getHostname() const noexcept
|
||||
{
|
||||
return m_hostname;
|
||||
}
|
||||
|
||||
int
|
||||
XSocketAddress::getPort() const throw()
|
||||
int XSocketAddress::getPort() const noexcept
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
std::string XSocketAddress::getWhat() const throw()
|
||||
std::string XSocketAddress::getWhat() const noexcept
|
||||
{
|
||||
static const char* s_errorID[] = {
|
||||
"XSocketAddressUnknown",
|
||||
|
@ -75,7 +72,7 @@ std::string XSocketAddress::getWhat() const throw()
|
|||
// XSocketIOClose
|
||||
//
|
||||
|
||||
std::string XSocketIOClose::getWhat() const throw()
|
||||
std::string XSocketIOClose::getWhat() const noexcept
|
||||
{
|
||||
return format("XSocketIOClose", "close: %{1}", what());
|
||||
}
|
||||
|
@ -85,7 +82,7 @@ std::string XSocketIOClose::getWhat() const throw()
|
|||
// XSocketBind
|
||||
//
|
||||
|
||||
std::string XSocketBind::getWhat() const throw()
|
||||
std::string XSocketBind::getWhat() const noexcept
|
||||
{
|
||||
return format("XSocketBind", "cannot bind address: %{1}", what());
|
||||
}
|
||||
|
@ -95,7 +92,7 @@ std::string XSocketBind::getWhat() const throw()
|
|||
// XSocketConnect
|
||||
//
|
||||
|
||||
std::string XSocketConnect::getWhat() const throw()
|
||||
std::string XSocketConnect::getWhat() const noexcept
|
||||
{
|
||||
return format("XSocketConnect", "cannot connect socket: %{1}", what());
|
||||
}
|
||||
|
@ -105,7 +102,7 @@ std::string XSocketConnect::getWhat() const throw()
|
|||
// XSocketCreate
|
||||
//
|
||||
|
||||
std::string XSocketCreate::getWhat() const throw()
|
||||
std::string XSocketCreate::getWhat() const noexcept
|
||||
{
|
||||
return format("XSocketCreate", "cannot create socket: %{1}", what());
|
||||
}
|
||||
|
|
|
@ -40,24 +40,24 @@ public:
|
|||
kBadPort //!< The port is invalid
|
||||
};
|
||||
|
||||
XSocketAddress(EError, const std::string& hostname, int port) _NOEXCEPT;
|
||||
virtual ~XSocketAddress() _NOEXCEPT { }
|
||||
XSocketAddress(EError, const std::string& hostname, int port) noexcept;
|
||||
virtual ~XSocketAddress() noexcept { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Get the error code
|
||||
EError getError() const throw();
|
||||
EError getError() const noexcept;
|
||||
//! Get the hostname
|
||||
std::string getHostname() const throw();
|
||||
std::string getHostname() const noexcept;
|
||||
//! Get the port
|
||||
int getPort() const throw();
|
||||
int getPort() const noexcept;
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
// XBase overrides
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
|
||||
private:
|
||||
EError m_error;
|
||||
|
|
|
@ -88,5 +88,5 @@ public:
|
|||
XMSWindowsWatchdogError(const std::string& msg) : XBarrier(msg) { }
|
||||
|
||||
// XBase overrides
|
||||
virtual std::string getWhat() const throw() { return what(); }
|
||||
virtual std::string getWhat() const noexcept { return what(); }
|
||||
};
|
||||
|
|
|
@ -2271,12 +2271,12 @@ XConfigRead::XConfigRead(const ConfigReadContext& context, const char* errorFmt,
|
|||
// do nothing
|
||||
}
|
||||
|
||||
XConfigRead::~XConfigRead() _NOEXCEPT
|
||||
XConfigRead::~XConfigRead() noexcept
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
std::string XConfigRead::getWhat() const throw()
|
||||
std::string XConfigRead::getWhat() const noexcept
|
||||
{
|
||||
return format("XConfigRead", "read error: %{1}", m_error.c_str());
|
||||
}
|
||||
|
|
|
@ -521,11 +521,11 @@ class XConfigRead : public XBase {
|
|||
public:
|
||||
XConfigRead(const ConfigReadContext& context, const std::string&);
|
||||
XConfigRead(const ConfigReadContext& contex, const char* errorFmt, const std::string& arg);
|
||||
virtual ~XConfigRead() _NOEXCEPT;
|
||||
virtual ~XConfigRead() noexcept;
|
||||
|
||||
protected:
|
||||
// XBase overrides
|
||||
virtual std::string getWhat() const throw();
|
||||
virtual std::string getWhat() const noexcept;
|
||||
|
||||
private:
|
||||
std::string m_error;
|
||||
|
|
Loading…
Reference in New Issue