1
0
mirror of https://github.com/upx/upx synced 2025-10-26 23:36:41 +08:00

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

View File

@@ -35,7 +35,7 @@
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)
{
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)
{
if (other.msg)
@@ -59,7 +59,7 @@ Throwable::Throwable(const Throwable &other) NOTHROW
}
Throwable::~Throwable() NOTHROW
Throwable::~Throwable() noexcept
{
#if 0
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)
return "(null)";

View File

@@ -31,7 +31,7 @@
#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;
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:
Throwable(const Throwable &) NOTHROW;
virtual ~Throwable() NOTHROW;
const char *getMsg() const NOTHROW { return msg; }
int getErrno() const NOTHROW { return err; }
bool isWarning() const NOTHROW { return is_warning; }
Throwable(const Throwable &) noexcept;
virtual ~Throwable() noexcept;
const char *getMsg() const noexcept { return msg; }
int getErrno() const noexcept { return err; }
bool isWarning() const noexcept { return is_warning; }
private:
char *msg;
int err;
@@ -71,7 +71,7 @@ class Exception : public Throwable
{
typedef Throwable super;
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;
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;
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;
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;
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;
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;
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;
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
{
typedef Exception super;
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
{
typedef CantPackException super;
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
{
typedef CantPackException super;
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
{
typedef CantPackException super;
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;
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
{
typedef CantUnpackException super;
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;
public:
InternalError(const char *m = 0) NOTHROW : super(m,0) { }
InternalError(const char *m = 0) noexcept : super(m,0) { }
};

View File

@@ -30,7 +30,6 @@
#ifdef __cplusplus
#define NOTHROW ACC_CXX_NOTHROW
#define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE
/*************************************************************************