Commit 40a52033 authored by Kenton Varda's avatar Kenton Varda

Mark every destructor "noexcept(false)" unless it is very clearly noexcept. The…

Mark every destructor "noexcept(false)" unless it is very clearly noexcept.  The change in C++11 making destructors default-noexcept was a mistake.
parent af6bb032
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
namespace capnp { namespace capnp {
namespace _ { // private namespace _ { // private
Arena::~Arena() {} Arena::~Arena() noexcept(false) {}
void ReadLimiter::unread(WordCount64 amount) { void ReadLimiter::unread(WordCount64 amount) {
// Be careful not to overflow here. Since ReadLimiter has no thread-safety, it's possible that // Be careful not to overflow here. Since ReadLimiter has no thread-safety, it's possible that
...@@ -51,7 +51,7 @@ ReaderArena::ReaderArena(MessageReader* message) ...@@ -51,7 +51,7 @@ ReaderArena::ReaderArena(MessageReader* message)
readLimiter(message->getOptions().traversalLimitInWords * WORDS), readLimiter(message->getOptions().traversalLimitInWords * WORDS),
segment0(this, SegmentId(0), message->getSegment(0), &readLimiter) {} segment0(this, SegmentId(0), message->getSegment(0), &readLimiter) {}
ReaderArena::~ReaderArena() {} ReaderArena::~ReaderArena() noexcept(false) {}
SegmentReader* ReaderArena::tryGetSegment(SegmentId id) { SegmentReader* ReaderArena::tryGetSegment(SegmentId id) {
if (id == SegmentId(0)) { if (id == SegmentId(0)) {
...@@ -103,7 +103,7 @@ void ReaderArena::reportReadLimitReached() { ...@@ -103,7 +103,7 @@ void ReaderArena::reportReadLimitReached() {
BuilderArena::BuilderArena(MessageBuilder* message) BuilderArena::BuilderArena(MessageBuilder* message)
: message(message), segment0(nullptr, SegmentId(0), nullptr, nullptr) {} : message(message), segment0(nullptr, SegmentId(0), nullptr, nullptr) {}
BuilderArena::~BuilderArena() {} BuilderArena::~BuilderArena() noexcept(false) {}
SegmentBuilder* BuilderArena::getSegment(SegmentId id) { SegmentBuilder* BuilderArena::getSegment(SegmentId id) {
// This method is allowed to fail if the segment ID is not valid. // This method is allowed to fail if the segment ID is not valid.
......
...@@ -134,7 +134,7 @@ private: ...@@ -134,7 +134,7 @@ private:
class Arena { class Arena {
public: public:
virtual ~Arena(); virtual ~Arena() noexcept(false);
virtual SegmentReader* tryGetSegment(SegmentId id) = 0; virtual SegmentReader* tryGetSegment(SegmentId id) = 0;
// Gets the segment with the given ID, or return nullptr if no such segment exists. // Gets the segment with the given ID, or return nullptr if no such segment exists.
...@@ -150,7 +150,7 @@ public: ...@@ -150,7 +150,7 @@ public:
class ReaderArena final: public Arena { class ReaderArena final: public Arena {
public: public:
ReaderArena(MessageReader* message); ReaderArena(MessageReader* message);
~ReaderArena(); ~ReaderArena() noexcept(false);
KJ_DISALLOW_COPY(ReaderArena); KJ_DISALLOW_COPY(ReaderArena);
// implements Arena ------------------------------------------------ // implements Arena ------------------------------------------------
...@@ -171,7 +171,7 @@ private: ...@@ -171,7 +171,7 @@ private:
class BuilderArena final: public Arena { class BuilderArena final: public Arena {
public: public:
BuilderArena(MessageBuilder* message); BuilderArena(MessageBuilder* message);
~BuilderArena(); ~BuilderArena() noexcept(false);
KJ_DISALLOW_COPY(BuilderArena); KJ_DISALLOW_COPY(BuilderArena);
SegmentBuilder* getSegment(SegmentId id); SegmentBuilder* getSegment(SegmentId id);
......
...@@ -183,7 +183,7 @@ struct UseScratch { ...@@ -183,7 +183,7 @@ struct UseScratch {
KJ_REQUIRE(scratchCounter < 6, "Too many scratch spaces needed at once."); KJ_REQUIRE(scratchCounter < 6, "Too many scratch spaces needed at once.");
words = scratchSpace + scratchCounter++ * SCRATCH_SIZE; words = scratchSpace + scratchCounter++ * SCRATCH_SIZE;
} }
~ScratchSpace() { ~ScratchSpace() noexcept {
--scratchCounter; --scratchCounter;
} }
}; };
......
...@@ -100,8 +100,6 @@ int32_t evaluateExpression(Expression::Reader exp) { ...@@ -100,8 +100,6 @@ int32_t evaluateExpression(Expression::Reader exp) {
class ExpressionTestCase { class ExpressionTestCase {
public: public:
~ExpressionTestCase() {}
typedef Expression Request; typedef Expression Request;
typedef EvaluationResult Response; typedef EvaluationResult Response;
typedef int32_t Expectation; typedef int32_t Expectation;
......
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
sem_init(&semaphore, 0, 0); sem_init(&semaphore, 0, 0);
} }
~ProducerConsumerQueue() { ~ProducerConsumerQueue() noexcept(false) {
while (front != nullptr) { while (front != nullptr) {
Node* oldFront = front; Node* oldFront = front;
front = front->next; front = front->next;
......
...@@ -62,7 +62,7 @@ _::StructReader MessageReader::getRootInternal() { ...@@ -62,7 +62,7 @@ _::StructReader MessageReader::getRootInternal() {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
MessageBuilder::MessageBuilder(): allocatedArena(false) {} MessageBuilder::MessageBuilder(): allocatedArena(false) {}
MessageBuilder::~MessageBuilder() { MessageBuilder::~MessageBuilder() noexcept(false) {
if (allocatedArena) { if (allocatedArena) {
arena()->~BuilderArena(); arena()->~BuilderArena();
} }
...@@ -121,7 +121,7 @@ SegmentArrayMessageReader::SegmentArrayMessageReader( ...@@ -121,7 +121,7 @@ SegmentArrayMessageReader::SegmentArrayMessageReader(
kj::ArrayPtr<const kj::ArrayPtr<const word>> segments, ReaderOptions options) kj::ArrayPtr<const kj::ArrayPtr<const word>> segments, ReaderOptions options)
: MessageReader(options), segments(segments) {} : MessageReader(options), segments(segments) {}
SegmentArrayMessageReader::~SegmentArrayMessageReader() {} SegmentArrayMessageReader::~SegmentArrayMessageReader() noexcept(false) {}
kj::ArrayPtr<const word> SegmentArrayMessageReader::getSegment(uint id) { kj::ArrayPtr<const word> SegmentArrayMessageReader::getSegment(uint id) {
if (id < segments.size()) { if (id < segments.size()) {
...@@ -153,7 +153,7 @@ MallocMessageBuilder::MallocMessageBuilder( ...@@ -153,7 +153,7 @@ MallocMessageBuilder::MallocMessageBuilder(
"First segment must be zeroed."); "First segment must be zeroed.");
} }
MallocMessageBuilder::~MallocMessageBuilder() { MallocMessageBuilder::~MallocMessageBuilder() noexcept(false) {
if (returnedFirstSegment) { if (returnedFirstSegment) {
if (ownFirstSegment) { if (ownFirstSegment) {
free(firstSegment); free(firstSegment);
...@@ -220,7 +220,7 @@ kj::ArrayPtr<word> MallocMessageBuilder::allocateSegment(uint minimumSize) { ...@@ -220,7 +220,7 @@ kj::ArrayPtr<word> MallocMessageBuilder::allocateSegment(uint minimumSize) {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
FlatMessageBuilder::FlatMessageBuilder(kj::ArrayPtr<word> array): array(array), allocated(false) {} FlatMessageBuilder::FlatMessageBuilder(kj::ArrayPtr<word> array): array(array), allocated(false) {}
FlatMessageBuilder::~FlatMessageBuilder() {} FlatMessageBuilder::~FlatMessageBuilder() noexcept(false) {}
void FlatMessageBuilder::requireFilled() { void FlatMessageBuilder::requireFilled() {
KJ_REQUIRE(getSegmentsForOutput()[0].end() == array.end(), KJ_REQUIRE(getSegmentsForOutput()[0].end() == array.end(),
......
...@@ -122,7 +122,7 @@ private: ...@@ -122,7 +122,7 @@ private:
class MessageBuilder { class MessageBuilder {
public: public:
MessageBuilder(); MessageBuilder();
virtual ~MessageBuilder(); virtual ~MessageBuilder() noexcept(false);
virtual kj::ArrayPtr<word> allocateSegment(uint minimumSize) = 0; virtual kj::ArrayPtr<word> allocateSegment(uint minimumSize) = 0;
// Allocates an array of at least the given number of words, throwing an exception or crashing if // Allocates an array of at least the given number of words, throwing an exception or crashing if
...@@ -225,7 +225,7 @@ public: ...@@ -225,7 +225,7 @@ public:
// segments. All arrays passed in must remain valid until the MessageReader is destroyed. // segments. All arrays passed in must remain valid until the MessageReader is destroyed.
KJ_DISALLOW_COPY(SegmentArrayMessageReader); KJ_DISALLOW_COPY(SegmentArrayMessageReader);
~SegmentArrayMessageReader(); ~SegmentArrayMessageReader() noexcept(false);
virtual kj::ArrayPtr<const word> getSegment(uint id) override; virtual kj::ArrayPtr<const word> getSegment(uint id) override;
...@@ -282,7 +282,7 @@ public: ...@@ -282,7 +282,7 @@ public:
// over any space that was used so that it can be reused. // over any space that was used so that it can be reused.
KJ_DISALLOW_COPY(MallocMessageBuilder); KJ_DISALLOW_COPY(MallocMessageBuilder);
virtual ~MallocMessageBuilder(); virtual ~MallocMessageBuilder() noexcept(false);
virtual kj::ArrayPtr<word> allocateSegment(uint minimumSize) override; virtual kj::ArrayPtr<word> allocateSegment(uint minimumSize) override;
...@@ -306,7 +306,7 @@ class FlatMessageBuilder: public MessageBuilder { ...@@ -306,7 +306,7 @@ class FlatMessageBuilder: public MessageBuilder {
public: public:
explicit FlatMessageBuilder(kj::ArrayPtr<word> array); explicit FlatMessageBuilder(kj::ArrayPtr<word> array);
KJ_DISALLOW_COPY(FlatMessageBuilder); KJ_DISALLOW_COPY(FlatMessageBuilder);
virtual ~FlatMessageBuilder(); virtual ~FlatMessageBuilder() noexcept(false);
void requireFilled(); void requireFilled();
// Throws an exception if the flat array is not exactly full. // Throws an exception if the flat array is not exactly full.
......
...@@ -1111,7 +1111,7 @@ kj::Array<Schema> SchemaLoader::Impl::getAllLoaded() const { ...@@ -1111,7 +1111,7 @@ kj::Array<Schema> SchemaLoader::Impl::getAllLoaded() const {
// ======================================================================================= // =======================================================================================
SchemaLoader::SchemaLoader(): impl(kj::heap<Impl>()) {} SchemaLoader::SchemaLoader(): impl(kj::heap<Impl>()) {}
SchemaLoader::~SchemaLoader() {} SchemaLoader::~SchemaLoader() noexcept(false) {}
Schema SchemaLoader::get(uint64_t id) const { Schema SchemaLoader::get(uint64_t id) const {
_::RawSchema* raw = impl->tryGet(id); _::RawSchema* raw = impl->tryGet(id);
......
...@@ -32,7 +32,7 @@ namespace capnp { ...@@ -32,7 +32,7 @@ namespace capnp {
class SchemaLoader { class SchemaLoader {
public: public:
SchemaLoader(); SchemaLoader();
~SchemaLoader(); ~SchemaLoader() noexcept(false);
KJ_DISALLOW_COPY(SchemaLoader); KJ_DISALLOW_COPY(SchemaLoader);
Schema get(uint64_t id) const; Schema get(uint64_t id) const;
......
...@@ -31,7 +31,7 @@ namespace capnp { ...@@ -31,7 +31,7 @@ namespace capnp {
namespace _ { // private namespace _ { // private
PackedInputStream::PackedInputStream(kj::BufferedInputStream& inner): inner(inner) {} PackedInputStream::PackedInputStream(kj::BufferedInputStream& inner): inner(inner) {}
PackedInputStream::~PackedInputStream() {} PackedInputStream::~PackedInputStream() noexcept(false) {}
size_t PackedInputStream::read(void* dst, size_t minBytes, size_t maxBytes) { size_t PackedInputStream::read(void* dst, size_t minBytes, size_t maxBytes) {
if (maxBytes == 0) { if (maxBytes == 0) {
...@@ -302,7 +302,7 @@ void PackedInputStream::skip(size_t bytes) { ...@@ -302,7 +302,7 @@ void PackedInputStream::skip(size_t bytes) {
PackedOutputStream::PackedOutputStream(kj::BufferedOutputStream& inner) PackedOutputStream::PackedOutputStream(kj::BufferedOutputStream& inner)
: inner(inner) {} : inner(inner) {}
PackedOutputStream::~PackedOutputStream() {} PackedOutputStream::~PackedOutputStream() noexcept(false) {}
void PackedOutputStream::write(const void* src, size_t size) { void PackedOutputStream::write(const void* src, size_t size) {
kj::ArrayPtr<byte> buffer = inner.getWriteBuffer(); kj::ArrayPtr<byte> buffer = inner.getWriteBuffer();
...@@ -438,7 +438,7 @@ PackedMessageReader::PackedMessageReader( ...@@ -438,7 +438,7 @@ PackedMessageReader::PackedMessageReader(
: PackedInputStream(inputStream), : PackedInputStream(inputStream),
InputStreamMessageReader(static_cast<PackedInputStream&>(*this), options, scratchSpace) {} InputStreamMessageReader(static_cast<PackedInputStream&>(*this), options, scratchSpace) {}
PackedMessageReader::~PackedMessageReader() {} PackedMessageReader::~PackedMessageReader() noexcept(false) {}
PackedFdMessageReader::PackedFdMessageReader( PackedFdMessageReader::PackedFdMessageReader(
int fd, ReaderOptions options, kj::ArrayPtr<word> scratchSpace) int fd, ReaderOptions options, kj::ArrayPtr<word> scratchSpace)
...@@ -454,7 +454,7 @@ PackedFdMessageReader::PackedFdMessageReader( ...@@ -454,7 +454,7 @@ PackedFdMessageReader::PackedFdMessageReader(
PackedMessageReader(static_cast<BufferedInputStreamWrapper&>(*this), PackedMessageReader(static_cast<BufferedInputStreamWrapper&>(*this),
options, scratchSpace) {} options, scratchSpace) {}
PackedFdMessageReader::~PackedFdMessageReader() {} PackedFdMessageReader::~PackedFdMessageReader() noexcept(false) {}
void writePackedMessage(kj::BufferedOutputStream& output, void writePackedMessage(kj::BufferedOutputStream& output,
kj::ArrayPtr<const kj::ArrayPtr<const word>> segments) { kj::ArrayPtr<const kj::ArrayPtr<const word>> segments) {
......
...@@ -37,7 +37,7 @@ class PackedInputStream: public kj::InputStream { ...@@ -37,7 +37,7 @@ class PackedInputStream: public kj::InputStream {
public: public:
explicit PackedInputStream(kj::BufferedInputStream& inner); explicit PackedInputStream(kj::BufferedInputStream& inner);
KJ_DISALLOW_COPY(PackedInputStream); KJ_DISALLOW_COPY(PackedInputStream);
~PackedInputStream(); ~PackedInputStream() noexcept(false);
// implements InputStream ------------------------------------------ // implements InputStream ------------------------------------------
size_t read(void* buffer, size_t minBytes, size_t maxBytes) override; size_t read(void* buffer, size_t minBytes, size_t maxBytes) override;
...@@ -51,7 +51,7 @@ class PackedOutputStream: public kj::OutputStream { ...@@ -51,7 +51,7 @@ class PackedOutputStream: public kj::OutputStream {
public: public:
explicit PackedOutputStream(kj::BufferedOutputStream& inner); explicit PackedOutputStream(kj::BufferedOutputStream& inner);
KJ_DISALLOW_COPY(PackedOutputStream); KJ_DISALLOW_COPY(PackedOutputStream);
~PackedOutputStream(); ~PackedOutputStream() noexcept(false);
// implements OutputStream ----------------------------------------- // implements OutputStream -----------------------------------------
void write(const void* buffer, size_t bytes) override; void write(const void* buffer, size_t bytes) override;
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
PackedMessageReader(kj::BufferedInputStream& inputStream, ReaderOptions options = ReaderOptions(), PackedMessageReader(kj::BufferedInputStream& inputStream, ReaderOptions options = ReaderOptions(),
kj::ArrayPtr<word> scratchSpace = nullptr); kj::ArrayPtr<word> scratchSpace = nullptr);
KJ_DISALLOW_COPY(PackedMessageReader); KJ_DISALLOW_COPY(PackedMessageReader);
~PackedMessageReader(); ~PackedMessageReader() noexcept(false);
}; };
class PackedFdMessageReader: private kj::FdInputStream, private kj::BufferedInputStreamWrapper, class PackedFdMessageReader: private kj::FdInputStream, private kj::BufferedInputStreamWrapper,
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
KJ_DISALLOW_COPY(PackedFdMessageReader); KJ_DISALLOW_COPY(PackedFdMessageReader);
~PackedFdMessageReader(); ~PackedFdMessageReader() noexcept(false);
}; };
void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder); void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder);
......
...@@ -34,7 +34,7 @@ class SnappyInputStream::InputStreamSnappySource: public snappy::Source { ...@@ -34,7 +34,7 @@ class SnappyInputStream::InputStreamSnappySource: public snappy::Source {
public: public:
inline InputStreamSnappySource(BufferedInputStream& inputStream) inline InputStreamSnappySource(BufferedInputStream& inputStream)
: inputStream(inputStream) {} : inputStream(inputStream) {}
inline ~InputStreamSnappySource() {}; inline ~InputStreamSnappySource() noexcept {};
// implements snappy::Source --------------------------------------- // implements snappy::Source ---------------------------------------
...@@ -66,7 +66,7 @@ SnappyInputStream::SnappyInputStream(BufferedInputStream& inner, kj::ArrayPtr<by ...@@ -66,7 +66,7 @@ SnappyInputStream::SnappyInputStream(BufferedInputStream& inner, kj::ArrayPtr<by
this->buffer = buffer; this->buffer = buffer;
} }
SnappyInputStream::~SnappyInputStream() {} SnappyInputStream::~SnappyInputStream() noexcept(false) {}
kj::ArrayPtr<const byte> SnappyInputStream::getReadBuffer() { kj::ArrayPtr<const byte> SnappyInputStream::getReadBuffer() {
if (bufferAvailable.size() == 0) { if (bufferAvailable.size() == 0) {
...@@ -193,7 +193,7 @@ SnappyPackedMessageReader::SnappyPackedMessageReader( ...@@ -193,7 +193,7 @@ SnappyPackedMessageReader::SnappyPackedMessageReader(
: SnappyInputStream(inputStream, buffer), : SnappyInputStream(inputStream, buffer),
PackedMessageReader(static_cast<SnappyInputStream&>(*this), options, scratchSpace) {} PackedMessageReader(static_cast<SnappyInputStream&>(*this), options, scratchSpace) {}
SnappyPackedMessageReader::~SnappyPackedMessageReader() {} SnappyPackedMessageReader::~SnappyPackedMessageReader() noexcept(false) {}
void writeSnappyPackedMessage(kj::OutputStream& output, void writeSnappyPackedMessage(kj::OutputStream& output,
kj::ArrayPtr<const kj::ArrayPtr<const word>> segments, kj::ArrayPtr<const kj::ArrayPtr<const word>> segments,
......
...@@ -36,7 +36,7 @@ class SnappyInputStream: public kj::BufferedInputStream { ...@@ -36,7 +36,7 @@ class SnappyInputStream: public kj::BufferedInputStream {
public: public:
explicit SnappyInputStream(BufferedInputStream& inner, kj::ArrayPtr<byte> buffer = nullptr); explicit SnappyInputStream(BufferedInputStream& inner, kj::ArrayPtr<byte> buffer = nullptr);
KJ_DISALLOW_COPY(SnappyInputStream); KJ_DISALLOW_COPY(SnappyInputStream);
~SnappyInputStream(); ~SnappyInputStream() noexcept(false);
// implements BufferedInputStream ---------------------------------- // implements BufferedInputStream ----------------------------------
kj::ArrayPtr<const byte> getReadBuffer() override; kj::ArrayPtr<const byte> getReadBuffer() override;
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
SnappyPackedMessageReader( SnappyPackedMessageReader(
BufferedInputStream& inputStream, ReaderOptions options = ReaderOptions(), BufferedInputStream& inputStream, ReaderOptions options = ReaderOptions(),
kj::ArrayPtr<word> scratchSpace = nullptr, kj::ArrayPtr<byte> buffer = nullptr); kj::ArrayPtr<word> scratchSpace = nullptr, kj::ArrayPtr<byte> buffer = nullptr);
~SnappyPackedMessageReader(); ~SnappyPackedMessageReader() noexcept(false);
}; };
void writeSnappyPackedMessage(kj::OutputStream& output, MessageBuilder& builder, void writeSnappyPackedMessage(kj::OutputStream& output, MessageBuilder& builder,
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
namespace kj { namespace kj {
ArrayDisposer::~ArrayDisposer() {} ArrayDisposer::~ArrayDisposer() noexcept(false) {}
namespace _ { // private namespace _ { // private
...@@ -42,7 +42,7 @@ struct HeapArrayDisposer::ExceptionGuard { ...@@ -42,7 +42,7 @@ struct HeapArrayDisposer::ExceptionGuard {
elementSize(elementSize), elementCount(elementCount), elementSize(elementSize), elementCount(elementCount),
destroyElement(destroyElement) {} destroyElement(destroyElement) {}
~ExceptionGuard() { ~ExceptionGuard() noexcept(false) {
if (pos != nullptr) { if (pos != nullptr) {
destroyAll(); destroyAll();
operator delete(pos); operator delete(pos);
......
...@@ -37,7 +37,7 @@ class ArrayDisposer { ...@@ -37,7 +37,7 @@ class ArrayDisposer {
// Much like Disposer from memory.h. // Much like Disposer from memory.h.
protected: protected:
virtual ~ArrayDisposer(); virtual ~ArrayDisposer() noexcept(false);
virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount,
size_t capacity, void (*destroyElement)(void*)) const = 0; size_t capacity, void (*destroyElement)(void*)) const = 0;
...@@ -231,7 +231,7 @@ public: ...@@ -231,7 +231,7 @@ public:
other.endPtr = nullptr; other.endPtr = nullptr;
} }
KJ_DISALLOW_COPY(ArrayBuilder); KJ_DISALLOW_COPY(ArrayBuilder);
inline ~ArrayBuilder() { dispose(); } inline ~ArrayBuilder() noexcept(false) { dispose(); }
inline operator ArrayPtr<T>() { inline operator ArrayPtr<T>() {
return arrayPtr(ptr, pos); return arrayPtr(ptr, pos);
...@@ -506,7 +506,7 @@ struct CopyConstructArray_<T, Iterator, false> { ...@@ -506,7 +506,7 @@ struct CopyConstructArray_<T, Iterator, false> {
T* start; T* start;
T* pos; T* pos;
inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {} inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {}
~ExceptionGuard() { ~ExceptionGuard() noexcept(false) {
while (pos > start) { while (pos > start) {
dtor(*--pos); dtor(*--pos);
} }
......
...@@ -340,7 +340,7 @@ public: ...@@ -340,7 +340,7 @@ public:
ctor(value, other.value); ctor(value, other.value);
} }
} }
inline ~NullableValue() { inline ~NullableValue() noexcept(noexcept(instance<T&>().~T())) {
if (isSet) { if (isSet) {
dtor(value); dtor(value);
} }
......
...@@ -228,7 +228,7 @@ int Debug::getOsErrorNumber() { ...@@ -228,7 +228,7 @@ int Debug::getOsErrorNumber() {
} }
Debug::Context::Context(): logged(false) {} Debug::Context::Context(): logged(false) {}
Debug::Context::~Context() {} Debug::Context::~Context() noexcept(false) {}
Debug::Context::Value Debug::Context::ensureInitialized() { Debug::Context::Value Debug::Context::ensureInitialized() {
KJ_IF_MAYBE(v, value) { KJ_IF_MAYBE(v, value) {
......
...@@ -220,7 +220,7 @@ public: ...@@ -220,7 +220,7 @@ public:
public: public:
Context(); Context();
KJ_DISALLOW_COPY(Context); KJ_DISALLOW_COPY(Context);
virtual ~Context(); virtual ~Context() noexcept(false);
struct Value { struct Value {
const char* file; const char* file;
......
...@@ -253,7 +253,7 @@ ExceptionCallback::ExceptionCallback(): next(getExceptionCallback()) { ...@@ -253,7 +253,7 @@ ExceptionCallback::ExceptionCallback(): next(getExceptionCallback()) {
ExceptionCallback::ExceptionCallback(ExceptionCallback& next): next(next) {} ExceptionCallback::ExceptionCallback(ExceptionCallback& next): next(next) {}
ExceptionCallback::~ExceptionCallback() { ExceptionCallback::~ExceptionCallback() noexcept(false) {
if (&next != this) { if (&next != this) {
threadLocalCallback = &next; threadLocalCallback = &next;
} }
...@@ -375,7 +375,7 @@ class RecoverableExceptionCatcher: public ExceptionCallback { ...@@ -375,7 +375,7 @@ class RecoverableExceptionCatcher: public ExceptionCallback {
// -fno-exceptions. // -fno-exceptions.
public: public:
virtual ~RecoverableExceptionCatcher() {} virtual ~RecoverableExceptionCatcher() noexcept(false) {}
void onRecoverableException(Exception&& exception) override { void onRecoverableException(Exception&& exception) override {
if (caught == nullptr) { if (caught == nullptr) {
......
...@@ -141,7 +141,7 @@ class ExceptionCallback { ...@@ -141,7 +141,7 @@ class ExceptionCallback {
public: public:
ExceptionCallback(); ExceptionCallback();
KJ_DISALLOW_COPY(ExceptionCallback); KJ_DISALLOW_COPY(ExceptionCallback);
virtual ~ExceptionCallback(); virtual ~ExceptionCallback() noexcept(false);
virtual void onRecoverableException(Exception&& exception); virtual void onRecoverableException(Exception&& exception);
// Called when an exception has been raised, but the calling code has the ability to continue by // Called when an exception has been raised, but the calling code has the ability to continue by
......
...@@ -172,7 +172,7 @@ void BufferedOutputStreamWrapper::write(const void* src, size_t size) { ...@@ -172,7 +172,7 @@ void BufferedOutputStreamWrapper::write(const void* src, size_t size) {
// ======================================================================================= // =======================================================================================
ArrayInputStream::ArrayInputStream(ArrayPtr<const byte> array): array(array) {} ArrayInputStream::ArrayInputStream(ArrayPtr<const byte> array): array(array) {}
ArrayInputStream::~ArrayInputStream() {} ArrayInputStream::~ArrayInputStream() noexcept(false) {}
ArrayPtr<const byte> ArrayInputStream::getReadBuffer() { ArrayPtr<const byte> ArrayInputStream::getReadBuffer() {
return array; return array;
...@@ -201,7 +201,7 @@ void ArrayInputStream::skip(size_t bytes) { ...@@ -201,7 +201,7 @@ void ArrayInputStream::skip(size_t bytes) {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
ArrayOutputStream::ArrayOutputStream(ArrayPtr<byte> array): array(array), fillPos(array.begin()) {} ArrayOutputStream::ArrayOutputStream(ArrayPtr<byte> array): array(array), fillPos(array.begin()) {}
ArrayOutputStream::~ArrayOutputStream() {} ArrayOutputStream::~ArrayOutputStream() noexcept(false) {}
ArrayPtr<byte> ArrayOutputStream::getWriteBuffer() { ArrayPtr<byte> ArrayOutputStream::getWriteBuffer() {
return arrayPtr(fillPos, array.end()); return arrayPtr(fillPos, array.end());
......
...@@ -179,7 +179,7 @@ class ArrayInputStream: public BufferedInputStream { ...@@ -179,7 +179,7 @@ class ArrayInputStream: public BufferedInputStream {
public: public:
explicit ArrayInputStream(ArrayPtr<const byte> array); explicit ArrayInputStream(ArrayPtr<const byte> array);
KJ_DISALLOW_COPY(ArrayInputStream); KJ_DISALLOW_COPY(ArrayInputStream);
~ArrayInputStream(); ~ArrayInputStream() noexcept(false);
// implements BufferedInputStream ---------------------------------- // implements BufferedInputStream ----------------------------------
ArrayPtr<const byte> getReadBuffer() override; ArrayPtr<const byte> getReadBuffer() override;
...@@ -194,7 +194,7 @@ class ArrayOutputStream: public BufferedOutputStream { ...@@ -194,7 +194,7 @@ class ArrayOutputStream: public BufferedOutputStream {
public: public:
explicit ArrayOutputStream(ArrayPtr<byte> array); explicit ArrayOutputStream(ArrayPtr<byte> array);
KJ_DISALLOW_COPY(ArrayOutputStream); KJ_DISALLOW_COPY(ArrayOutputStream);
~ArrayOutputStream(); ~ArrayOutputStream() noexcept(false);
ArrayPtr<byte> getArray() { ArrayPtr<byte> getArray() {
// Get the portion of the array which has been filled in. // Get the portion of the array which has been filled in.
......
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
namespace kj { namespace kj {
Disposer::~Disposer() {} Disposer::~Disposer() noexcept(false) {}
} // namespace kj } // namespace kj
...@@ -40,7 +40,7 @@ class Disposer { ...@@ -40,7 +40,7 @@ class Disposer {
// custom memory allocators. // custom memory allocators.
protected: protected:
virtual ~Disposer(); virtual ~Disposer() noexcept(false);
virtual void disposeImpl(void* pointer) const = 0; virtual void disposeImpl(void* pointer) const = 0;
// Disposes of the object, given a pointer to the beginning of the object. If the object is // Disposes of the object, given a pointer to the beginning of the object. If the object is
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
} }
inline Own(T* ptr, const Disposer& disposer) noexcept: disposer(&disposer), ptr(ptr) {} inline Own(T* ptr, const Disposer& disposer) noexcept: disposer(&disposer), ptr(ptr) {}
~Own() noexcept { dispose(); } ~Own() noexcept(false) { dispose(); }
inline Own& operator=(Own&& other) { inline Own& operator=(Own&& other) {
dispose(); dispose();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment