Commit baa4c665 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Use noexcept in IOBuf, supporting -fno-exceptions

Summary: [Folly] Use `noexcept` in `IOBuf` v.s. reimplementing it via explicit `catch` and `abort`, with the intended side-effect of adding support for `-fno-exceptions`.

Reviewed By: simpkins

Differential Revision: D15208427

fbshipit-source-id: bcf9d7b0f1a556e43d996c84b1df43ff891da974
parent 846587f4
......@@ -1523,7 +1523,7 @@ class IOBuf {
struct DeleterBase {
virtual ~DeleterBase() {}
virtual void dispose(void* p) = 0;
virtual void dispose(void* p) noexcept = 0;
};
template <class UniquePtr>
......@@ -1532,13 +1532,9 @@ class IOBuf {
typedef typename UniquePtr::deleter_type Deleter;
explicit UniquePtrDeleter(Deleter deleter) : deleter_(std::move(deleter)) {}
void dispose(void* p) override {
try {
void dispose(void* p) noexcept override {
deleter_(static_cast<Pointer>(p));
delete this;
} catch (...) {
abort();
}
}
private:
......
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