From 0efcd8c8283cdfc57d83594637dcb8b5fec09288 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Fri, 12 Jun 2015 14:44:21 -0700 Subject: [PATCH] Get *=default*ed default constructors Summary: Defaulted (*=default*ed) default constructors are better because they can be constexpr and/or noexcept when C++ Standard thinks it is right to do so. And they remain user-declared rather than user-provided. Regarding *=default*ed default constructor, benifit is that the work might be done during compilation and we might not need to worry about exception paths. And for destructors, apart from that that =defaulted definition is in sync with defaulted default constructor we might discover that in some cases "() {}" might be ill-formed when "= default;" compiltion indicates so. If =defaulted definition for destructor doesn't do any harm then why not go for it. Closes #216 Reviewed By: @yfeldblum Differential Revision: D2145322 Pulled By: @sgolemon --- folly/Arena.h | 4 +- folly/AtomicHashArray.h | 4 +- folly/AtomicHashMap.h | 2 +- folly/ExceptionWrapper.h | 2 +- folly/GroupVarint.h | 2 +- folly/MPMCPipeline.h | 2 +- folly/MemoryMapping.h | 2 +- folly/Singleton.h | 2 +- folly/SmallLocks.h | 2 +- folly/SocketAddress.h | 2 +- folly/Subprocess.h | 4 +- folly/ThreadLocal.h | 2 +- folly/dynamic.cpp | 2 +- folly/experimental/JSONSchema.cpp | 6 +- folly/experimental/StringKeyedUnorderedMap.h | 2 +- folly/gen/Base-inl.h | 66 +++++++++---------- folly/gen/Combine-inl.h | 2 +- folly/gen/Core-inl.h | 2 +- folly/gen/Parallel-inl.h | 2 +- folly/gen/ParallelMap-inl.h | 2 +- folly/io/async/AsyncSSLSocket.h | 2 +- folly/io/async/AsyncServerSocket.h | 4 +- folly/io/async/AsyncSocket.cpp | 2 +- folly/io/async/AsyncSocket.h | 2 +- folly/io/async/AsyncTransport.h | 6 +- folly/io/async/AsyncUDPServerSocket.h | 2 +- folly/io/async/AsyncUDPSocket.h | 2 +- folly/io/async/DelayedDestruction.h | 2 +- folly/io/async/EventBase.h | 4 +- folly/io/async/Request.h | 2 +- folly/io/async/SSLContext.h | 2 +- folly/io/async/TimeoutManager.h | 2 +- folly/small_vector.h | 2 +- folly/wangle/acceptor/ConnectionCounter.h | 4 +- folly/wangle/acceptor/ConnectionManager.h | 4 +- folly/wangle/acceptor/LoadShedConfiguration.h | 4 +- folly/wangle/acceptor/ManagedConnection.h | 2 +- folly/wangle/bootstrap/ClientBootstrap.h | 2 +- folly/wangle/bootstrap/ServerBootstrap-inl.h | 2 +- folly/wangle/bootstrap/ServerBootstrap.h | 2 +- folly/wangle/channel/Handler.h | 8 +-- folly/wangle/channel/HandlerContext-inl.h | 14 ++-- folly/wangle/channel/HandlerContext.h | 6 +- folly/wangle/channel/Pipeline.h | 6 +- folly/wangle/concurrent/BlockingQueue.h | 2 +- folly/wangle/concurrent/IOExecutor.h | 2 +- folly/wangle/concurrent/ThreadFactory.h | 2 +- folly/wangle/concurrent/ThreadPoolExecutor.h | 2 +- folly/wangle/rx/Subscription.h | 2 +- folly/wangle/service/Service.h | 6 +- folly/wangle/ssl/SSLCacheProvider.h | 2 +- folly/wangle/ssl/SSLContextConfig.h | 4 +- folly/wangle/ssl/SSLContextManager.cpp | 2 +- 53 files changed, 113 insertions(+), 113 deletions(-) diff --git a/folly/Arena.h b/folly/Arena.h index f2af34e4..5121e380 100644 --- a/folly/Arena.h +++ b/folly/Arena.h @@ -148,8 +148,8 @@ class Arena { } private: - Block() { } - ~Block() { } + Block() = default; + ~Block() = default; } __attribute__((__aligned__)); // This should be alignas(std::max_align_t) but neither alignas nor // max_align_t are supported by gcc 4.6.2. diff --git a/folly/AtomicHashArray.h b/folly/AtomicHashArray.h index 87f8b060..bbb3cdd4 100644 --- a/folly/AtomicHashArray.h +++ b/folly/AtomicHashArray.h @@ -232,7 +232,7 @@ class AtomicHashArray : boost::noncopyable { struct SimpleRetT { size_t idx; bool success; SimpleRetT(size_t i, bool s) : idx(i), success(s) {} - SimpleRetT() {} + SimpleRetT() = default; }; template @@ -277,7 +277,7 @@ class AtomicHashArray : boost::noncopyable { AtomicHashArray(size_t capacity, KeyT emptyKey, KeyT lockedKey, KeyT erasedKey, double maxLoadFactor, size_t cacheSize); - ~AtomicHashArray() {} + ~AtomicHashArray() = default; inline void unlockCell(value_type* const cell, KeyT newKey) { cellKeyPtr(*cell)->store(newKey, std::memory_order_release); diff --git a/folly/AtomicHashMap.h b/folly/AtomicHashMap.h index f0b04a56..5b58feea 100644 --- a/folly/AtomicHashMap.h +++ b/folly/AtomicHashMap.h @@ -389,7 +389,7 @@ class AtomicHashMap : boost::noncopyable { struct SimpleRetT { uint32_t i; size_t j; bool success; SimpleRetT(uint32_t ii, size_t jj, bool s) : i(ii), j(jj), success(s) {} - SimpleRetT() {} + SimpleRetT() = default; }; template diff --git a/folly/ExceptionWrapper.h b/folly/ExceptionWrapper.h index 3f9f9688..a99e84d9 100644 --- a/folly/ExceptionWrapper.h +++ b/folly/ExceptionWrapper.h @@ -434,7 +434,7 @@ class try_and_catch : template<> class try_and_catch<> : public exception_wrapper { public: - try_and_catch() {} + try_and_catch() = default; protected: template diff --git a/folly/GroupVarint.h b/folly/GroupVarint.h index d7ebd0dd..f50617cb 100644 --- a/folly/GroupVarint.h +++ b/folly/GroupVarint.h @@ -512,7 +512,7 @@ class GroupVarintDecoder { typedef GroupVarint Base; typedef T type; - GroupVarintDecoder() { } + GroupVarintDecoder() = default; explicit GroupVarintDecoder(StringPiece data, size_t maxCount = (size_t)-1) diff --git a/folly/MPMCPipeline.h b/folly/MPMCPipeline.h index dc422441..d480c167 100644 --- a/folly/MPMCPipeline.h +++ b/folly/MPMCPipeline.h @@ -176,7 +176,7 @@ template class MPMCPipeline { * Default-construct pipeline. Useful to move-assign later, * just like MPMCQueue, see MPMCQueue.h for more details. */ - MPMCPipeline() { } + MPMCPipeline() = default; /** * Construct a pipeline with N+1 queue sizes. diff --git a/folly/MemoryMapping.h b/folly/MemoryMapping.h index a1ca7444..280a261f 100644 --- a/folly/MemoryMapping.h +++ b/folly/MemoryMapping.h @@ -53,7 +53,7 @@ class MemoryMapping : boost::noncopyable { * likely become inaccessible) when the MemoryMapping object is destroyed. */ struct Options { - Options() { } + Options() {} // Convenience methods; return *this for chaining. Options& setPageSize(off_t v) { pageSize = v; return *this; } diff --git a/folly/Singleton.h b/folly/Singleton.h index 8eff26f2..88eed342 100644 --- a/folly/Singleton.h +++ b/folly/Singleton.h @@ -188,7 +188,7 @@ class TypeDescriptorHasher { // SingletonHolders. class SingletonHolderBase { public: - virtual ~SingletonHolderBase() {} + virtual ~SingletonHolderBase() = default; virtual TypeDescriptor type() = 0; virtual bool hasLiveInstance() = 0; diff --git a/folly/SmallLocks.h b/folly/SmallLocks.h index 3702afe3..6e7d68d1 100644 --- a/folly/SmallLocks.h +++ b/folly/SmallLocks.h @@ -295,7 +295,7 @@ struct SpinLockArray { private: struct PaddedSpinLock { - PaddedSpinLock() : lock() { } + PaddedSpinLock() : lock() {} T lock; char padding[FOLLY_CACHE_LINE_SIZE - sizeof(T)]; }; diff --git a/folly/SocketAddress.h b/folly/SocketAddress.h index 7915c96f..049cf2ff 100644 --- a/folly/SocketAddress.h +++ b/folly/SocketAddress.h @@ -32,7 +32,7 @@ namespace folly { class SocketAddress { public: - SocketAddress() {} + SocketAddress() = default; /** * Construct a SocketAddress from a hostname and port. diff --git a/folly/Subprocess.h b/folly/Subprocess.h index b1f6707f..b7c377e6 100644 --- a/folly/Subprocess.h +++ b/folly/Subprocess.h @@ -208,7 +208,7 @@ class SubprocessError : public std::exception {}; class CalledProcessError : public SubprocessError { public: explicit CalledProcessError(ProcessReturnCode rc); - ~CalledProcessError() throw() { } + ~CalledProcessError() throw() = default; const char* what() const throw() FOLLY_OVERRIDE { return what_.c_str(); } ProcessReturnCode returnCode() const { return returnCode_; } private: @@ -222,7 +222,7 @@ class CalledProcessError : public SubprocessError { class SubprocessSpawnError : public SubprocessError { public: SubprocessSpawnError(const char* executable, int errCode, int errnoValue); - ~SubprocessSpawnError() throw() {} + ~SubprocessSpawnError() throw() = default; const char* what() const throw() FOLLY_OVERRIDE { return what_.c_str(); } int errnoValue() const { return errnoValue_; } diff --git a/folly/ThreadLocal.h b/folly/ThreadLocal.h index d3215f0d..fee6fac4 100644 --- a/folly/ThreadLocal.h +++ b/folly/ThreadLocal.h @@ -59,7 +59,7 @@ template class ThreadLocalPtr; template class ThreadLocal { public: - ThreadLocal() { } + ThreadLocal() = default; T* get() const { T* ptr = tlp_.get(); diff --git a/folly/dynamic.cpp b/folly/dynamic.cpp index abb57adc..26d17516 100644 --- a/folly/dynamic.cpp +++ b/folly/dynamic.cpp @@ -52,7 +52,7 @@ TypeError::TypeError(const std::string& expected, '\'')) {} -TypeError::~TypeError() {} +TypeError::~TypeError() = default; // This is a higher-order preprocessor macro to aid going from runtime // types to the compile time type system. diff --git a/folly/experimental/JSONSchema.cpp b/folly/experimental/JSONSchema.cpp index 51a6d20a..9283ee36 100644 --- a/folly/experimental/JSONSchema.cpp +++ b/folly/experimental/JSONSchema.cpp @@ -59,7 +59,7 @@ Optional makeError(Args&&... args) { struct ValidationContext; struct IValidator { - virtual ~IValidator() {} + virtual ~IValidator() = default; private: friend struct ValidationContext; @@ -102,7 +102,7 @@ struct SchemaValidatorContext final { * Root validator for a schema. */ struct SchemaValidator final : IValidator, public Validator { - SchemaValidator() {} + SchemaValidator() = default; void loadSchema(SchemaValidatorContext& context, const dynamic& schema); Optional validate(ValidationContext&, @@ -1010,7 +1010,7 @@ folly::Singleton schemaValidator([]() { }); } -Validator::~Validator() {} +Validator::~Validator() = default; std::unique_ptr makeValidator(const dynamic& schema) { auto v = make_unique(); diff --git a/folly/experimental/StringKeyedUnorderedMap.h b/folly/experimental/StringKeyedUnorderedMap.h index 395bc823..28da8e96 100644 --- a/folly/experimental/StringKeyedUnorderedMap.h +++ b/folly/experimental/StringKeyedUnorderedMap.h @@ -59,7 +59,7 @@ public: typedef typename Base::size_type size_type; typedef typename Base::difference_type difference_type; - explicit StringKeyedUnorderedMap() {} + explicit StringKeyedUnorderedMap() = default; explicit StringKeyedUnorderedMap( size_type n, diff --git a/folly/gen/Base-inl.h b/folly/gen/Base-inl.h index e66d2317..43dde36d 100644 --- a/folly/gen/Base-inl.h +++ b/folly/gen/Base-inl.h @@ -158,7 +158,7 @@ class RangeSource : public GenImpl::reference, RangeSource> { Range range_; public: - RangeSource() {} + RangeSource() = default; explicit RangeSource(Range range) : range_(std::move(range)) {} @@ -382,7 +382,7 @@ template class Map : public Operator> { Predicate pred_; public: - Map() {} + Map() = default; explicit Map(Predicate pred) : pred_(std::move(pred)) @@ -448,7 +448,7 @@ template class Filter : public Operator> { Predicate pred_; public: - Filter() {} + Filter() = default; explicit Filter(Predicate pred) : pred_(std::move(pred)) { } @@ -512,7 +512,7 @@ template class Until : public Operator> { Predicate pred_; public: - Until() {} + Until() = default; explicit Until(Predicate pred) : pred_(std::move(pred)) {} @@ -850,7 +850,7 @@ class Order : public Operator> { Selector selector_; Comparer comparer_; public: - Order() {} + Order() = default; explicit Order(Selector selector) : selector_(std::move(selector)) @@ -984,7 +984,7 @@ template class Distinct : public Operator> { Selector selector_; public: - Distinct() {} + Distinct() = default; explicit Distinct(Selector selector) : selector_(std::move(selector)) @@ -1165,7 +1165,7 @@ class FoldLeft : public Operator> { Seed seed_; Fold fold_; public: - FoldLeft() {} + FoldLeft() = default; FoldLeft(Seed seed, Fold fold) : seed_(std::move(seed)) @@ -1193,7 +1193,7 @@ class FoldLeft : public Operator> { */ class First : public Operator { public: - First() { } + First() = default; template { */ class Any : public Operator { public: - Any() { } + Any() = default; template @@ -1265,7 +1265,7 @@ template class All : public Operator> { Predicate pred_; public: - All() {} + All() = default; explicit All(Predicate pred) : pred_(std::move(pred)) { } @@ -1302,7 +1302,7 @@ template class Reduce : public Operator> { Reducer reducer_; public: - Reduce() {} + Reduce() = default; explicit Reduce(Reducer reducer) : reducer_(std::move(reducer)) {} @@ -1335,7 +1335,7 @@ class Reduce : public Operator> { */ class Count : public Operator { public: - Count() { } + Count() = default; template @@ -1418,7 +1418,7 @@ class Min : public Operator> { Selector selector_; Comparer comparer_; public: - Min() {} + Min() = default; explicit Min(Selector selector) : selector_(std::move(selector)) @@ -1494,7 +1494,7 @@ class Append : public Operator> { template class Collect : public Operator> { public: - Collect() { } + Collect() = default; template class Container, template class Allocator> class CollectTemplate : public Operator> { public: - CollectTemplate() { } + CollectTemplate() = default; template> { */ class Concat : public Operator { public: - Concat() { } + Concat() = default; template { */ class RangeConcat : public Operator { public: - RangeConcat() { } + RangeConcat() = default; template { */ class Dereference : public Operator { public: - Dereference() {} + Dereference() = default; template { */ class Indirect : public Operator { public: - Indirect() {} + Indirect() = default; template > { * non-template operators, statically defined to avoid the need for anything but * the header. */ -static const detail::Sum sum; +static const detail::Sum sum{}; -static const detail::Count count; +static const detail::Count count{}; -static const detail::First first; +static const detail::First first{}; /** * Use directly for detecting any values, or as a function to detect values @@ -2010,21 +2010,21 @@ static const detail::First first; * auto nonempty = g | any; * auto evens = g | any(even); */ -static const detail::Any any; +static const detail::Any any{}; -static const detail::Min min; +static const detail::Min min{}; -static const detail::Min max; +static const detail::Min max{}; -static const detail::Order order; +static const detail::Order order{}; -static const detail::Distinct distinct; +static const detail::Distinct distinct{}; -static const detail::Map move; +static const detail::Map move{}; -static const detail::Concat concat; +static const detail::Concat concat{}; -static const detail::RangeConcat rconcat; +static const detail::RangeConcat rconcat{}; /** * Use directly for infinite sequences, or as a function to limit cycle count. @@ -2032,11 +2032,11 @@ static const detail::RangeConcat rconcat; * auto forever = g | cycle; * auto thrice = g | cycle(3); */ -static const detail::Cycle cycle; +static const detail::Cycle cycle{}; -static const detail::Dereference dereference; +static const detail::Dereference dereference{}; -static const detail::Indirect indirect; +static const detail::Indirect indirect{}; inline detail::Take take(size_t count) { return detail::Take(count); diff --git a/folly/gen/Combine-inl.h b/folly/gen/Combine-inl.h index 06c8c208..b36c8c71 100644 --- a/folly/gen/Combine-inl.h +++ b/folly/gen/Combine-inl.h @@ -203,7 +203,7 @@ class MergeTuples { } // namespace detail -static const detail::Map tuple_flatten; +static const detail::Map tuple_flatten{}; // TODO(mcurtiss): support zip() for N>1 operands. Because of variadic problems, // this might not be easily possible until gcc4.8 is available. diff --git a/folly/gen/Core-inl.h b/folly/gen/Core-inl.h index 6916dca3..33aff6b4 100644 --- a/folly/gen/Core-inl.h +++ b/folly/gen/Core-inl.h @@ -304,7 +304,7 @@ class Composed : public Operator> { First first_; Second second_; public: - Composed() {} + Composed() = default; Composed(First first, Second second) : first_(std::move(first)) diff --git a/folly/gen/Parallel-inl.h b/folly/gen/Parallel-inl.h index 50adb5bc..ca4a7179 100644 --- a/folly/gen/Parallel-inl.h +++ b/folly/gen/Parallel-inl.h @@ -385,7 +385,7 @@ class ChunkedRangeSource Range range_; public: - ChunkedRangeSource() {} + ChunkedRangeSource() = default; ChunkedRangeSource(int chunkSize, Range range) : chunkSize_(chunkSize), range_(std::move(range)) {} diff --git a/folly/gen/ParallelMap-inl.h b/folly/gen/ParallelMap-inl.h index 08ca3f55..b4098392 100644 --- a/folly/gen/ParallelMap-inl.h +++ b/folly/gen/ParallelMap-inl.h @@ -45,7 +45,7 @@ class PMap : public Operator> { Predicate pred_; size_t nThreads_; public: - PMap() {} + PMap() = default; PMap(Predicate pred, size_t nThreads) : pred_(std::move(pred)), diff --git a/folly/io/async/AsyncSSLSocket.h b/folly/io/async/AsyncSSLSocket.h index 0cc0dc92..8523bdb6 100644 --- a/folly/io/async/AsyncSSLSocket.h +++ b/folly/io/async/AsyncSSLSocket.h @@ -83,7 +83,7 @@ class AsyncSSLSocket : public virtual AsyncSocket { class HandshakeCB { public: - virtual ~HandshakeCB() {} + virtual ~HandshakeCB() = default; /** * handshakeVer() is invoked during handshaking to give the diff --git a/folly/io/async/AsyncServerSocket.h b/folly/io/async/AsyncServerSocket.h index ff9562fe..26662fc9 100644 --- a/folly/io/async/AsyncServerSocket.h +++ b/folly/io/async/AsyncServerSocket.h @@ -66,7 +66,7 @@ class AsyncServerSocket : public DelayedDestruction class AcceptCallback { public: - virtual ~AcceptCallback() {} + virtual ~AcceptCallback() = default; /** * connectionAccepted() is called whenever a new client connection is @@ -614,7 +614,7 @@ class AsyncServerSocket : public DelayedDestruction explicit RemoteAcceptor(AcceptCallback *callback) : callback_(callback) {} - ~RemoteAcceptor() {} + ~RemoteAcceptor() = default; void start(EventBase *eventBase, uint32_t maxAtOnce, uint32_t maxInQueue); void stop(EventBase* eventBase, AcceptCallback* callback); diff --git a/folly/io/async/AsyncSocket.cpp b/folly/io/async/AsyncSocket.cpp index 5436daa1..3ff2b345 100644 --- a/folly/io/async/AsyncSocket.cpp +++ b/folly/io/async/AsyncSocket.cpp @@ -148,7 +148,7 @@ class AsyncSocket::BytesWriteRequest : public AsyncSocket::WriteRequest { } // private destructor, to ensure callers use destroy() - virtual ~BytesWriteRequest() {} + virtual ~BytesWriteRequest() = default; const struct iovec* getOps() const { assert(opCount_ > opIndex_); diff --git a/folly/io/async/AsyncSocket.h b/folly/io/async/AsyncSocket.h index 523093be..5ea024ce 100644 --- a/folly/io/async/AsyncSocket.h +++ b/folly/io/async/AsyncSocket.h @@ -67,7 +67,7 @@ class AsyncSocket : virtual public AsyncTransportWrapper { class ConnectCallback { public: - virtual ~ConnectCallback() {} + virtual ~ConnectCallback() = default; /** * connectSuccess() will be invoked when the connection has been diff --git a/folly/io/async/AsyncTransport.h b/folly/io/async/AsyncTransport.h index 1cf4d209..a166db50 100644 --- a/folly/io/async/AsyncTransport.h +++ b/folly/io/async/AsyncTransport.h @@ -318,7 +318,7 @@ class AsyncTransport : public DelayedDestruction, public AsyncSocketBase { virtual size_t getRawBytesReceived() const = 0; protected: - virtual ~AsyncTransport() {} + virtual ~AsyncTransport() = default; }; // Transitional intermediate interface. This is deprecated. @@ -329,7 +329,7 @@ class AsyncTransportWrapper : virtual public AsyncTransport { class ReadCallback { public: - virtual ~ReadCallback() {} + virtual ~ReadCallback() = default; /** * When data becomes available, getReadBuffer() will be invoked to get the @@ -400,7 +400,7 @@ class AsyncTransportWrapper : virtual public AsyncTransport { class WriteCallback { public: - virtual ~WriteCallback() {} + virtual ~WriteCallback() = default; /** * writeSuccess() will be invoked when all of the data has been diff --git a/folly/io/async/AsyncUDPServerSocket.h b/folly/io/async/AsyncUDPServerSocket.h index 1a5201b9..0476abe8 100644 --- a/folly/io/async/AsyncUDPServerSocket.h +++ b/folly/io/async/AsyncUDPServerSocket.h @@ -62,7 +62,7 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback std::unique_ptr buf, bool truncated) noexcept = 0; - virtual ~Callback() {} + virtual ~Callback() = default; }; /** diff --git a/folly/io/async/AsyncUDPSocket.h b/folly/io/async/AsyncUDPSocket.h index 02f90080..35d8373a 100644 --- a/folly/io/async/AsyncUDPSocket.h +++ b/folly/io/async/AsyncUDPSocket.h @@ -74,7 +74,7 @@ class AsyncUDPSocket : public EventHandler { */ virtual void onReadClosed() noexcept = 0; - virtual ~ReadCallback() {} + virtual ~ReadCallback() = default; }; /** diff --git a/folly/io/async/DelayedDestruction.h b/folly/io/async/DelayedDestruction.h index 639c8538..bda26f7e 100644 --- a/folly/io/async/DelayedDestruction.h +++ b/folly/io/async/DelayedDestruction.h @@ -143,7 +143,7 @@ class DelayedDestruction : private boost::noncopyable { * shared_ptr using a DelayedDestruction::Destructor as the second argument * to the shared_ptr constructor. */ - virtual ~DelayedDestruction() {} + virtual ~DelayedDestruction() = default; /** * Get the number of DestructorGuards currently protecting this object. diff --git a/folly/io/async/EventBase.h b/folly/io/async/EventBase.h index 9077b06c..369754bd 100644 --- a/folly/io/async/EventBase.h +++ b/folly/io/async/EventBase.h @@ -46,7 +46,7 @@ class NotificationQueue; class EventBaseObserver { public: - virtual ~EventBaseObserver() {} + virtual ~EventBaseObserver() = default; virtual uint32_t getSampleRate() const = 0; @@ -114,7 +114,7 @@ class EventBase : private boost::noncopyable, */ class LoopCallback { public: - virtual ~LoopCallback() {} + virtual ~LoopCallback() = default; virtual void runLoopCallback() noexcept = 0; void cancelLoopCallback() { diff --git a/folly/io/async/Request.h b/folly/io/async/Request.h index 490c69b0..a7c7bef9 100644 --- a/folly/io/async/Request.h +++ b/folly/io/async/Request.h @@ -33,7 +33,7 @@ namespace folly { class RequestData { public: - virtual ~RequestData() {} + virtual ~RequestData() = default; }; class RequestContext; diff --git a/folly/io/async/SSLContext.h b/folly/io/async/SSLContext.h index 20df0c87..1b5592b8 100644 --- a/folly/io/async/SSLContext.h +++ b/folly/io/async/SSLContext.h @@ -42,7 +42,7 @@ namespace folly { */ class PasswordCollector { public: - virtual ~PasswordCollector() {} + virtual ~PasswordCollector() = default; /** * Interface for customizing how to collect private key password. * diff --git a/folly/io/async/TimeoutManager.h b/folly/io/async/TimeoutManager.h index 2b35574c..5c068db1 100644 --- a/folly/io/async/TimeoutManager.h +++ b/folly/io/async/TimeoutManager.h @@ -41,7 +41,7 @@ class TimeoutManager { NORMAL }; - virtual ~TimeoutManager() {} + virtual ~TimeoutManager() = default; /** * Attaches/detaches TimeoutManager to AsyncTimeout diff --git a/folly/small_vector.h b/folly/small_vector.h index 2f2d46cb..a4af2fc4 100644 --- a/folly/small_vector.h +++ b/folly/small_vector.h @@ -382,7 +382,7 @@ public: typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - explicit small_vector() {} + explicit small_vector() = default; small_vector(small_vector const& o) { auto n = o.size(); diff --git a/folly/wangle/acceptor/ConnectionCounter.h b/folly/wangle/acceptor/ConnectionCounter.h index 3aaba647..3d97be1b 100644 --- a/folly/wangle/acceptor/ConnectionCounter.h +++ b/folly/wangle/acceptor/ConnectionCounter.h @@ -31,7 +31,7 @@ class IConnectionCounter { * Decrement the count of client-side connections. */ virtual void onConnectionRemoved() = 0; - virtual ~IConnectionCounter() {} + virtual ~IConnectionCounter() = default; }; class SimpleConnectionCounter: public IConnectionCounter { @@ -44,7 +44,7 @@ class SimpleConnectionCounter: public IConnectionCounter { void onConnectionAdded() override { numConnections_++; } void onConnectionRemoved() override { numConnections_--; } - virtual ~SimpleConnectionCounter() {} + virtual ~SimpleConnectionCounter() = default; protected: uint64_t maxConnections_{0}; diff --git a/folly/wangle/acceptor/ConnectionManager.h b/folly/wangle/acceptor/ConnectionManager.h index 45400a6a..8a0327f7 100644 --- a/folly/wangle/acceptor/ConnectionManager.h +++ b/folly/wangle/acceptor/ConnectionManager.h @@ -40,7 +40,7 @@ class ConnectionManager: public folly::DelayedDestruction, */ class Callback { public: - virtual ~Callback() {} + virtual ~Callback() = default; /** * Invoked when the number of connections managed by the @@ -189,7 +189,7 @@ class ConnectionManager: public folly::DelayedDestruction, DRAIN2 = 1, }; - ~ConnectionManager() {} + ~ConnectionManager() = default; ConnectionManager(const ConnectionManager&) = delete; ConnectionManager& operator=(ConnectionManager&) = delete; diff --git a/folly/wangle/acceptor/LoadShedConfiguration.h b/folly/wangle/acceptor/LoadShedConfiguration.h index 57c51b97..a3f1907f 100644 --- a/folly/wangle/acceptor/LoadShedConfiguration.h +++ b/folly/wangle/acceptor/LoadShedConfiguration.h @@ -39,9 +39,9 @@ class LoadShedConfiguration { typedef std::set AddressSet; typedef std::set NetworkSet; - LoadShedConfiguration() {} + LoadShedConfiguration() = default; - ~LoadShedConfiguration() {} + ~LoadShedConfiguration() = default; void addWhitelistAddr(folly::StringPiece); diff --git a/folly/wangle/acceptor/ManagedConnection.h b/folly/wangle/acceptor/ManagedConnection.h index abee324e..7732b7b8 100644 --- a/folly/wangle/acceptor/ManagedConnection.h +++ b/folly/wangle/acceptor/ManagedConnection.h @@ -38,7 +38,7 @@ class ManagedConnection: class Callback { public: - virtual ~Callback() {} + virtual ~Callback() = default; /* Invoked when this connection becomes busy */ virtual void onActivated(ManagedConnection& conn) = 0; diff --git a/folly/wangle/bootstrap/ClientBootstrap.h b/folly/wangle/bootstrap/ClientBootstrap.h index ecd0c3b1..d2f1a164 100644 --- a/folly/wangle/bootstrap/ClientBootstrap.h +++ b/folly/wangle/bootstrap/ClientBootstrap.h @@ -94,7 +94,7 @@ class ClientBootstrap { return pipeline_.get(); } - virtual ~ClientBootstrap() {} + virtual ~ClientBootstrap() = default; protected: std::unique_ptrsetPipelineManager(this); } - ~ServerConnection() {} + ~ServerConnection() = default; void timeoutExpired() noexcept override { } diff --git a/folly/wangle/bootstrap/ServerBootstrap.h b/folly/wangle/bootstrap/ServerBootstrap.h index 4940e67b..3b7f6b0a 100644 --- a/folly/wangle/bootstrap/ServerBootstrap.h +++ b/folly/wangle/bootstrap/ServerBootstrap.h @@ -45,7 +45,7 @@ class ServerBootstrap { ServerBootstrap(const ServerBootstrap& that) = delete; ServerBootstrap(ServerBootstrap&& that) = default; - ServerBootstrap() {} + ServerBootstrap() = default; ~ServerBootstrap() { stop(); diff --git a/folly/wangle/channel/Handler.h b/folly/wangle/channel/Handler.h index 2080c2c2..4228ca42 100644 --- a/folly/wangle/channel/Handler.h +++ b/folly/wangle/channel/Handler.h @@ -26,7 +26,7 @@ namespace folly { namespace wangle { template class HandlerBase { public: - virtual ~HandlerBase() {} + virtual ~HandlerBase() = default; virtual void attachPipeline(Context* ctx) {} virtual void detachPipeline(Context* ctx) {} @@ -55,7 +55,7 @@ class Handler : public HandlerBase> { typedef Win win; typedef Wout wout; typedef HandlerContext Context; - virtual ~Handler() {} + virtual ~Handler() = default; virtual void read(Context* ctx, Rin msg) = 0; virtual void readEOF(Context* ctx) { @@ -112,7 +112,7 @@ class InboundHandler : public HandlerBase> { typedef Nothing win; typedef Nothing wout; typedef InboundHandlerContext Context; - virtual ~InboundHandler() {} + virtual ~InboundHandler() = default; virtual void read(Context* ctx, Rin msg) = 0; virtual void readEOF(Context* ctx) { @@ -139,7 +139,7 @@ class OutboundHandler : public HandlerBase> { typedef Win win; typedef Wout wout; typedef OutboundHandlerContext Context; - virtual ~OutboundHandler() {} + virtual ~OutboundHandler() = default; virtual Future write(Context* ctx, Win msg) = 0; virtual Future close(Context* ctx) { diff --git a/folly/wangle/channel/HandlerContext-inl.h b/folly/wangle/channel/HandlerContext-inl.h index 9a220bcd..5f12f99e 100644 --- a/folly/wangle/channel/HandlerContext-inl.h +++ b/folly/wangle/channel/HandlerContext-inl.h @@ -20,7 +20,7 @@ namespace folly { namespace wangle { class PipelineContext { public: - virtual ~PipelineContext() {} + virtual ~PipelineContext() = default; virtual void attachPipeline() = 0; virtual void detachPipeline() = 0; @@ -41,7 +41,7 @@ class PipelineContext { template class InboundLink { public: - virtual ~InboundLink() {} + virtual ~InboundLink() = default; virtual void read(In msg) = 0; virtual void readEOF() = 0; virtual void readException(exception_wrapper e) = 0; @@ -52,7 +52,7 @@ class InboundLink { template class OutboundLink { public: - virtual ~OutboundLink() {} + virtual ~OutboundLink() = default; virtual Future write(Out msg) = 0; virtual Future close() = 0; }; @@ -60,7 +60,7 @@ class OutboundLink { template class ContextImplBase : public PipelineContext { public: - ~ContextImplBase() {} + ~ContextImplBase() = default; H* getHandler() { return handler_.get(); @@ -140,7 +140,7 @@ class ContextImpl this->impl_ = this; } - ~ContextImpl() {} + ~ContextImpl() = default; // HandlerContext overrides void fireRead(Rout msg) override { @@ -289,7 +289,7 @@ class InboundContextImpl this->impl_ = this; } - ~InboundContextImpl() {} + ~InboundContextImpl() = default; // InboundHandlerContext overrides void fireRead(Rout msg) override { @@ -389,7 +389,7 @@ class OutboundContextImpl this->impl_ = this; } - ~OutboundContextImpl() {} + ~OutboundContextImpl() = default; // OutboundHandlerContext overrides Future fireWrite(Wout msg) override { diff --git a/folly/wangle/channel/HandlerContext.h b/folly/wangle/channel/HandlerContext.h index ddd9a576..69a37f4b 100644 --- a/folly/wangle/channel/HandlerContext.h +++ b/folly/wangle/channel/HandlerContext.h @@ -27,7 +27,7 @@ class PipelineBase; template class HandlerContext { public: - virtual ~HandlerContext() {} + virtual ~HandlerContext() = default; virtual void fireRead(In msg) = 0; virtual void fireReadEOF() = 0; @@ -65,7 +65,7 @@ class HandlerContext { template class InboundHandlerContext { public: - virtual ~InboundHandlerContext() {} + virtual ~InboundHandlerContext() = default; virtual void fireRead(In msg) = 0; virtual void fireReadEOF() = 0; @@ -86,7 +86,7 @@ class InboundHandlerContext { template class OutboundHandlerContext { public: - virtual ~OutboundHandlerContext() {} + virtual ~OutboundHandlerContext() = default; virtual Future fireWrite(Out msg) = 0; virtual Future fireClose() = 0; diff --git a/folly/wangle/channel/Pipeline.h b/folly/wangle/channel/Pipeline.h index 47c719ca..174c5d9f 100644 --- a/folly/wangle/channel/Pipeline.h +++ b/folly/wangle/channel/Pipeline.h @@ -27,13 +27,13 @@ namespace folly { namespace wangle { class PipelineManager { public: - virtual ~PipelineManager() {} + virtual ~PipelineManager() = default; virtual void deletePipeline(PipelineBase* pipeline) = 0; }; class PipelineBase : public DelayedDestruction { public: - virtual ~PipelineBase() {} + virtual ~PipelineBase() = default; void setPipelineManager(PipelineManager* manager) { manager_ = manager; @@ -174,7 +174,7 @@ class PipelineFactory { virtual std::unique_ptr newPipeline(std::shared_ptr) = 0; - virtual ~PipelineFactory() {} + virtual ~PipelineFactory() = default; }; } diff --git a/folly/wangle/concurrent/BlockingQueue.h b/folly/wangle/concurrent/BlockingQueue.h index 72c7aa35..16677fa1 100644 --- a/folly/wangle/concurrent/BlockingQueue.h +++ b/folly/wangle/concurrent/BlockingQueue.h @@ -23,7 +23,7 @@ namespace folly { namespace wangle { template class BlockingQueue { public: - virtual ~BlockingQueue() {} + virtual ~BlockingQueue() = default; virtual void add(T item) = 0; virtual void addWithPriority(T item, int8_t priority) { add(std::move(item)); diff --git a/folly/wangle/concurrent/IOExecutor.h b/folly/wangle/concurrent/IOExecutor.h index 08ed94da..14d9a645 100644 --- a/folly/wangle/concurrent/IOExecutor.h +++ b/folly/wangle/concurrent/IOExecutor.h @@ -40,7 +40,7 @@ namespace folly { namespace wangle { // IOThreadPoolExecutor will be created and returned. class IOExecutor : public virtual Executor { public: - virtual ~IOExecutor() {} + virtual ~IOExecutor() = default; virtual EventBase* getEventBase() = 0; }; diff --git a/folly/wangle/concurrent/ThreadFactory.h b/folly/wangle/concurrent/ThreadFactory.h index effd7e09..95446f1b 100644 --- a/folly/wangle/concurrent/ThreadFactory.h +++ b/folly/wangle/concurrent/ThreadFactory.h @@ -23,7 +23,7 @@ namespace folly { namespace wangle { class ThreadFactory { public: - virtual ~ThreadFactory() {} + virtual ~ThreadFactory() = default; virtual std::thread newThread(Func&& func) = 0; }; diff --git a/folly/wangle/concurrent/ThreadPoolExecutor.h b/folly/wangle/concurrent/ThreadPoolExecutor.h index c8ca7bb1..bb77d39c 100644 --- a/folly/wangle/concurrent/ThreadPoolExecutor.h +++ b/folly/wangle/concurrent/ThreadPoolExecutor.h @@ -129,7 +129,7 @@ class ThreadPoolExecutor : public virtual Executor { idle(true), taskStatsSubject(pool->taskStatsSubject_) {} - virtual ~Thread() {} + virtual ~Thread() = default; static std::atomic nextId; uint64_t id; diff --git a/folly/wangle/rx/Subscription.h b/folly/wangle/rx/Subscription.h index 8445ccf2..09af8c9d 100644 --- a/folly/wangle/rx/Subscription.h +++ b/folly/wangle/rx/Subscription.h @@ -24,7 +24,7 @@ namespace folly { namespace wangle { template class Subscription { public: - Subscription() {} + Subscription() = default; Subscription(const Subscription&) = delete; diff --git a/folly/wangle/service/Service.h b/folly/wangle/service/Service.h index 7eb54241..7874e198 100644 --- a/folly/wangle/service/Service.h +++ b/folly/wangle/service/Service.h @@ -33,7 +33,7 @@ template class Service { public: virtual Future operator()(Req request) = 0; - virtual ~Service() {} + virtual ~Service() = default; virtual Future close() { return makeFuture(); } @@ -67,7 +67,7 @@ class ServiceFilter : public Service { public: explicit ServiceFilter(std::shared_ptr> service) : service_(service) {} - virtual ~ServiceFilter() {} + virtual ~ServiceFilter() = default; virtual Future close() override { return service_->close(); @@ -132,7 +132,7 @@ class FactoryToService : public Service { explicit FactoryToService( std::shared_ptr> factory) : factory_(factory) {} - virtual ~FactoryToService() {} + virtual ~FactoryToService() = default; virtual Future operator()(Req request) override { DCHECK(factory_); diff --git a/folly/wangle/ssl/SSLCacheProvider.h b/folly/wangle/ssl/SSLCacheProvider.h index 8817b143..e59b4c1a 100644 --- a/folly/wangle/ssl/SSLCacheProvider.h +++ b/folly/wangle/ssl/SSLCacheProvider.h @@ -33,7 +33,7 @@ public: folly::DelayedDestruction::DestructorGuard> guard; } CacheContext; - virtual ~SSLCacheProvider() {} + virtual ~SSLCacheProvider() = default; /** * Store a session in the external cache. diff --git a/folly/wangle/ssl/SSLContextConfig.h b/folly/wangle/ssl/SSLContextConfig.h index 47aa3f11..6bd938b3 100644 --- a/folly/wangle/ssl/SSLContextConfig.h +++ b/folly/wangle/ssl/SSLContextConfig.h @@ -27,8 +27,8 @@ namespace folly { struct SSLContextConfig { - SSLContextConfig() {} - ~SSLContextConfig() {} + SSLContextConfig() = default; + ~SSLContextConfig() = default; struct CertificateInfo { CertificateInfo(const std::string& crtPath, diff --git a/folly/wangle/ssl/SSLContextManager.cpp b/folly/wangle/ssl/SSLContextManager.cpp index 101dde79..095e13ca 100644 --- a/folly/wangle/ssl/SSLContextManager.cpp +++ b/folly/wangle/ssl/SSLContextManager.cpp @@ -144,7 +144,7 @@ std::string flattenList(const std::list& list) { } -SSLContextManager::~SSLContextManager() {} +SSLContextManager::~SSLContextManager() = default; SSLContextManager::SSLContextManager( EventBase* eventBase, -- 2.34.1