all: misc and noexcept updates

This commit is contained in:
Markus F.X.J. Oberhumer
2023-07-09 17:36:24 +02:00
parent 300fa29446
commit 7ec0faca1e
41 changed files with 589 additions and 69 deletions
+3 -3
View File
@@ -49,7 +49,7 @@ protected:
public:
inline MemBufferBase() noexcept : ptr(nullptr), size_in_bytes(0) {}
inline ~MemBufferBase() noexcept {}
forceinline ~MemBufferBase() noexcept {}
// IMPORTANT NOTE: automatic conversion to underlying pointer
// HINT: for fully bound-checked pointer use XSPAN_S from xspan.h
@@ -213,8 +213,8 @@ private:
MemBuffer(const MemBuffer &) DELETED_FUNCTION;
MemBuffer &operator=(const MemBuffer &) DELETED_FUNCTION;
#if __cplusplus >= 201103L
MemBuffer(MemBuffer &&) DELETED_FUNCTION;
MemBuffer &operator=(MemBuffer &&) DELETED_FUNCTION;
MemBuffer(MemBuffer &&) noexcept DELETED_FUNCTION;
MemBuffer &operator=(MemBuffer &&) noexcept DELETED_FUNCTION;
#endif
// disable dynamic allocation
ACC_CXX_DISABLE_NEW_DELETE
+1 -2
View File
@@ -27,8 +27,6 @@
#include "../headers.h"
#include <algorithm>
#include "../conf.h"
#define ACC_WANT_ACC_INCI_H 1
#include "../miniacc.h"
#define ACC_WANT_ACCLIB_GETOPT 1
@@ -38,6 +36,7 @@
#define ACC_WANT_ACCLIB_WILDARGV 1
#undef HAVE_MKDIR
#include "../miniacc.h"
#include "../conf.h"
/*************************************************************************
// assert sane memory buffer sizes to protect against integer overflows
+7 -1
View File
@@ -101,7 +101,13 @@ forceinline void assertInvariants() const noexcept {}
public:
#if DEBUG
inline ~CSelf() { invalidate(); }
~CSelf() noexcept {
try {
invalidate();
} catch (...) {
std::terminate();
}
}
#else
forceinline ~CSelf() noexcept {}
#endif
+8 -2
View File
@@ -63,9 +63,15 @@ public:
#endif
#if DEBUG
inline ~CSelf() { invalidate(); }
~CSelf() noexcept {
try {
invalidate();
} catch (...) {
std::terminate();
}
}
#else
inline ~CSelf() noexcept {}
forceinline ~CSelf() noexcept {}
#endif
noinline void invalidate() {
assertInvariants();