Start using "noexcept".

This commit is contained in:
Markus F.X.J. Oberhumer
2020-12-08 00:45:41 +01:00
parent 51899957a9
commit ca0437556d
3 changed files with 26 additions and 27 deletions
+4 -4
View File
@@ -35,7 +35,7 @@
unsigned long Throwable::counter = 0; unsigned long Throwable::counter = 0;
Throwable::Throwable(const char *m, int e, bool w) NOTHROW Throwable::Throwable(const char *m, int e, bool w) noexcept
: super(), msg(NULL), err(e), is_warning(w) : super(), msg(NULL), err(e), is_warning(w)
{ {
if (m) if (m)
@@ -47,7 +47,7 @@ Throwable::Throwable(const char *m, int e, bool w) NOTHROW
} }
Throwable::Throwable(const Throwable &other) NOTHROW Throwable::Throwable(const Throwable &other) noexcept
: super(other), msg(NULL), err(other.err), is_warning(other.is_warning) : super(other), msg(NULL), err(other.err), is_warning(other.is_warning)
{ {
if (other.msg) if (other.msg)
@@ -59,7 +59,7 @@ Throwable::Throwable(const Throwable &other) NOTHROW
} }
Throwable::~Throwable() NOTHROW Throwable::~Throwable() noexcept
{ {
#if 0 #if 0
counter--; counter--;
@@ -187,7 +187,7 @@ void throwEOFException(const char *msg, int e)
// //
**************************************************************************/ **************************************************************************/
const char *prettyName(const char *n) NOTHROW const char *prettyName(const char *n) noexcept
{ {
if (n == NULL) if (n == NULL)
return "(null)"; return "(null)";
+22 -22
View File
@@ -31,7 +31,7 @@
#ifdef __cplusplus #ifdef __cplusplus
const char *prettyName(const char *n) NOTHROW; const char *prettyName(const char *n) noexcept;
/************************************************************************* /*************************************************************************
@@ -42,13 +42,13 @@ class Throwable : public std::exception
{ {
typedef std::exception super; typedef std::exception super;
protected: protected:
Throwable(const char *m = 0, int e = 0, bool w = false) NOTHROW; Throwable(const char *m = 0, int e = 0, bool w = false) noexcept;
public: public:
Throwable(const Throwable &) NOTHROW; Throwable(const Throwable &) noexcept;
virtual ~Throwable() NOTHROW; virtual ~Throwable() noexcept;
const char *getMsg() const NOTHROW { return msg; } const char *getMsg() const noexcept { return msg; }
int getErrno() const NOTHROW { return err; } int getErrno() const noexcept { return err; }
bool isWarning() const NOTHROW { return is_warning; } bool isWarning() const noexcept { return is_warning; }
private: private:
char *msg; char *msg;
int err; int err;
@@ -71,7 +71,7 @@ class Exception : public Throwable
{ {
typedef Throwable super; typedef Throwable super;
public: public:
Exception(const char *m = 0, int e = 0, bool w = false) NOTHROW : super(m,e,w) { } Exception(const char *m = 0, int e = 0, bool w = false) noexcept : super(m,e,w) { }
}; };
@@ -80,7 +80,7 @@ class Error : public Throwable
{ {
typedef Throwable super; typedef Throwable super;
public: public:
Error(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } Error(const char *m = 0, int e = 0) noexcept : super(m,e) { }
}; };
@@ -92,7 +92,7 @@ class OutOfMemoryException : public Exception
{ {
typedef Exception super; typedef Exception super;
public: public:
OutOfMemoryException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } OutOfMemoryException(const char *m = 0, int e = 0) noexcept : super(m,e) { }
}; };
@@ -100,7 +100,7 @@ class IOException : public Exception
{ {
typedef Exception super; typedef Exception super;
public: public:
IOException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } IOException(const char *m = 0, int e = 0) noexcept : super(m,e) { }
}; };
@@ -108,7 +108,7 @@ class EOFException : public IOException
{ {
typedef IOException super; typedef IOException super;
public: public:
EOFException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } EOFException(const char *m = 0, int e = 0) noexcept : super(m,e) { }
}; };
@@ -116,7 +116,7 @@ class FileNotFoundException : public IOException
{ {
typedef IOException super; typedef IOException super;
public: public:
FileNotFoundException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } FileNotFoundException(const char *m = 0, int e = 0) noexcept : super(m,e) { }
}; };
@@ -124,7 +124,7 @@ class FileAlreadyExistsException : public IOException
{ {
typedef IOException super; typedef IOException super;
public: public:
FileAlreadyExistsException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } FileAlreadyExistsException(const char *m = 0, int e = 0) noexcept : super(m,e) { }
}; };
@@ -136,35 +136,35 @@ class OverlayException : public Exception
{ {
typedef Exception super; typedef Exception super;
public: public:
OverlayException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { } OverlayException(const char *m = 0, bool w = false) noexcept : super(m,0,w) { }
}; };
class CantPackException : public Exception class CantPackException : public Exception
{ {
typedef Exception super; typedef Exception super;
public: public:
CantPackException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { } CantPackException(const char *m = 0, bool w = false) noexcept : super(m,0,w) { }
}; };
class UnknownExecutableFormatException : public CantPackException class UnknownExecutableFormatException : public CantPackException
{ {
typedef CantPackException super; typedef CantPackException super;
public: public:
UnknownExecutableFormatException(const char *m = 0, bool w = false) NOTHROW : super(m,w) { } UnknownExecutableFormatException(const char *m = 0, bool w = false) noexcept : super(m,w) { }
}; };
class AlreadyPackedException : public CantPackException class AlreadyPackedException : public CantPackException
{ {
typedef CantPackException super; typedef CantPackException super;
public: public:
AlreadyPackedException(const char *m = 0) NOTHROW : super(m) { is_warning = true; } AlreadyPackedException(const char *m = 0) noexcept : super(m) { is_warning = true; }
}; };
class NotCompressibleException : public CantPackException class NotCompressibleException : public CantPackException
{ {
typedef CantPackException super; typedef CantPackException super;
public: public:
NotCompressibleException(const char *m = 0) NOTHROW : super(m) { } NotCompressibleException(const char *m = 0) noexcept : super(m) { }
}; };
@@ -172,14 +172,14 @@ class CantUnpackException : public Exception
{ {
typedef Exception super; typedef Exception super;
public: public:
CantUnpackException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { } CantUnpackException(const char *m = 0, bool w = false) noexcept : super(m,0,w) { }
}; };
class NotPackedException : public CantUnpackException class NotPackedException : public CantUnpackException
{ {
typedef CantUnpackException super; typedef CantUnpackException super;
public: public:
NotPackedException(const char *m = 0) NOTHROW : super(m,true) { } NotPackedException(const char *m = 0) noexcept : super(m,true) { }
}; };
@@ -191,7 +191,7 @@ class InternalError : public Error
{ {
typedef Error super; typedef Error super;
public: public:
InternalError(const char *m = 0) NOTHROW : super(m,0) { } InternalError(const char *m = 0) noexcept : super(m,0) { }
}; };
-1
View File
@@ -30,7 +30,6 @@
#ifdef __cplusplus #ifdef __cplusplus
#define NOTHROW ACC_CXX_NOTHROW
#define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE #define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE
/************************************************************************* /*************************************************************************