all: assorted cleanups
This commit is contained in:
+22
-34
@@ -27,11 +27,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
const char *prettyName(const char *n) noexcept;
|
||||
|
||||
noinline void assertFailed(const char *expr, const char *file, int line, const char *func) noexcept;
|
||||
noinline void throwAssertFailed(const char *expr, const char *file, int line, const char *func);
|
||||
|
||||
/*************************************************************************
|
||||
// exceptions
|
||||
**************************************************************************/
|
||||
@@ -50,7 +45,7 @@ public:
|
||||
bool isWarning() const noexcept { return is_warning; }
|
||||
|
||||
private:
|
||||
char *msg = nullptr;
|
||||
OwningPointer(char) msg = nullptr;
|
||||
int err = 0;
|
||||
protected:
|
||||
bool is_warning = false; // can be set by subclasses
|
||||
@@ -84,7 +79,7 @@ public:
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
// system exception
|
||||
// system exceptions
|
||||
**************************************************************************/
|
||||
|
||||
class OutOfMemoryException final : public Exception {
|
||||
@@ -178,44 +173,37 @@ public:
|
||||
// util
|
||||
**************************************************************************/
|
||||
|
||||
#undef NORET
|
||||
#if 1 && defined(__GNUC__)
|
||||
#define NORET noinline __attribute__((__noreturn__))
|
||||
#else
|
||||
#define NORET noinline
|
||||
#endif
|
||||
const char *prettyName(const char *n) noexcept;
|
||||
|
||||
NORET void throwCantPack(const char *msg) may_throw;
|
||||
NORET void throwCantPackExact() may_throw;
|
||||
NORET void throwUnknownExecutableFormat(const char *msg = nullptr, bool warn = false) may_throw;
|
||||
NORET void throwNotCompressible(const char *msg = nullptr) may_throw;
|
||||
NORET void throwAlreadyPacked(const char *msg = nullptr) may_throw;
|
||||
NORET void throwAlreadyPackedByUPX(const char *msg = nullptr) may_throw;
|
||||
NORET void throwCantUnpack(const char *msg) may_throw;
|
||||
NORET void throwNotPacked(const char *msg = nullptr) may_throw;
|
||||
NORET void throwFilterException() may_throw;
|
||||
NORET void throwBadLoader() may_throw;
|
||||
NORET void throwChecksumError() may_throw;
|
||||
NORET void throwCompressedDataViolation() may_throw;
|
||||
NORET void throwInternalError(const char *msg) may_throw;
|
||||
NORET void throwOutOfMemoryException(const char *msg = nullptr) may_throw;
|
||||
NORET void throwIOException(const char *msg = nullptr, int e = 0) may_throw;
|
||||
NORET void throwEOFException(const char *msg = nullptr, int e = 0) may_throw;
|
||||
noreturn void throwCantPack(const char *msg) may_throw;
|
||||
noreturn void throwCantPackExact() may_throw;
|
||||
noreturn void throwUnknownExecutableFormat(const char *msg = nullptr, bool warn = false) may_throw;
|
||||
noreturn void throwNotCompressible(const char *msg = nullptr) may_throw;
|
||||
noreturn void throwAlreadyPacked(const char *msg = nullptr) may_throw;
|
||||
noreturn void throwAlreadyPackedByUPX(const char *msg = nullptr) may_throw;
|
||||
noreturn void throwCantUnpack(const char *msg) may_throw;
|
||||
noreturn void throwNotPacked(const char *msg = nullptr) may_throw;
|
||||
noreturn void throwFilterException() may_throw;
|
||||
noreturn void throwBadLoader() may_throw;
|
||||
noreturn void throwChecksumError() may_throw;
|
||||
noreturn void throwCompressedDataViolation() may_throw;
|
||||
noreturn void throwInternalError(const char *msg) may_throw;
|
||||
noreturn void throwOutOfMemoryException(const char *msg = nullptr) may_throw;
|
||||
noreturn void throwIOException(const char *msg = nullptr, int e = 0) may_throw;
|
||||
noreturn void throwEOFException(const char *msg = nullptr, int e = 0) may_throw;
|
||||
|
||||
// some C++ template wizardry is needed to overload throwCantPack() for varargs
|
||||
template <class T>
|
||||
void throwCantPack(const T *, ...) DELETED_FUNCTION;
|
||||
template <>
|
||||
NORET void throwCantPack(const char *format, ...) may_throw attribute_format(1, 2);
|
||||
noreturn void throwCantPack(const char *format, ...) may_throw attribute_format(1, 2);
|
||||
template <class T>
|
||||
void throwCantUnpack(const T *, ...) DELETED_FUNCTION;
|
||||
template <>
|
||||
NORET void throwCantUnpack(const char *format, ...) may_throw attribute_format(1, 2);
|
||||
noreturn void throwCantUnpack(const char *format, ...) may_throw attribute_format(1, 2);
|
||||
template <class T>
|
||||
void throwInternalError(const T *, ...) DELETED_FUNCTION;
|
||||
template <>
|
||||
NORET void throwInternalError(const char *format, ...) may_throw attribute_format(1, 2);
|
||||
|
||||
#undef NORET
|
||||
noreturn void throwInternalError(const char *format, ...) may_throw attribute_format(1, 2);
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
|
||||
Reference in New Issue
Block a user