From 43591b0dd8e09c300f8d9356d9ac5857ec61164f Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 20 Oct 2017 10:29:30 -0700 Subject: [PATCH] Drop redundant void parameters from function declarations Summary: This is C++, not C, so let's keep things modern. This is applying the modernize-redundant-void-arg clang-tidy check to Folly. Reviewed By: yfeldblum Differential Revision: D6106921 fbshipit-source-id: 06a56f036f59426df5dd475bf91a3f4a335266f5 --- folly/IPAddressException.h | 2 +- folly/detail/ThreadLocalDetail.h | 8 +++++--- folly/executors/ThreadPoolExecutor.h | 2 +- folly/experimental/exception_tracer/ExceptionTracer.cpp | 2 +- folly/experimental/exception_tracer/ExceptionTracerLib.h | 4 ++-- folly/experimental/symbolizer/SignalHandler.h | 2 +- folly/io/async/AsyncSSLSocket.cpp | 2 +- folly/ssl/OpenSSLVersionFinder.h | 4 ++-- folly/ssl/detail/SSLSessionImpl.cpp | 2 +- folly/test/function_benchmark/test_functions.cpp | 6 ++++-- 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/folly/IPAddressException.h b/folly/IPAddressException.h index 82d5d044..37a163ef 100644 --- a/folly/IPAddressException.h +++ b/folly/IPAddressException.h @@ -38,7 +38,7 @@ class IPAddressFormatException : public std::exception { IPAddressFormatException& operator=(IPAddressFormatException&&) = default; ~IPAddressFormatException() noexcept override {} - const char* what(void) const noexcept override { + const char* what() const noexcept override { return msg_.c_str(); } diff --git a/folly/detail/ThreadLocalDetail.h b/folly/detail/ThreadLocalDetail.h index a88bfbb1..363196b0 100644 --- a/folly/detail/ThreadLocalDetail.h +++ b/folly/detail/ThreadLocalDetail.h @@ -379,13 +379,15 @@ struct StaticMeta : StaticMetaBase { #endif } - static void preFork(void) { + static void preFork() { instance().lock_.lock(); // Make sure it's created } - static void onForkParent(void) { instance().lock_.unlock(); } + static void onForkParent() { + instance().lock_.unlock(); + } - static void onForkChild(void) { + static void onForkChild() { // only the current thread survives instance().head_.next = instance().head_.prev = &instance().head_; ThreadEntry* threadEntry = getThreadEntry(); diff --git a/folly/executors/ThreadPoolExecutor.h b/folly/executors/ThreadPoolExecutor.h index 79ca2905..3de9ec59 100644 --- a/folly/executors/ThreadPoolExecutor.h +++ b/folly/executors/ThreadPoolExecutor.h @@ -50,7 +50,7 @@ class ThreadPoolExecutor : public virtual folly::Executor { threadFactory_ = std::move(threadFactory); } - std::shared_ptr getThreadFactory(void) { + std::shared_ptr getThreadFactory() { return threadFactory_; } diff --git a/folly/experimental/exception_tracer/ExceptionTracer.cpp b/folly/experimental/exception_tracer/ExceptionTracer.cpp index bae1c875..32953540 100644 --- a/folly/experimental/exception_tracer/ExceptionTracer.cpp +++ b/folly/experimental/exception_tracer/ExceptionTracer.cpp @@ -36,7 +36,7 @@ using namespace __cxxabiv1; extern "C" { StackTraceStack* getExceptionStackTraceStack(void) __attribute__((__weak__)); -typedef StackTraceStack* (*GetExceptionStackTraceStackType)(void); +typedef StackTraceStack* (*GetExceptionStackTraceStackType)(); GetExceptionStackTraceStackType getExceptionStackTraceStackFn; } diff --git a/folly/experimental/exception_tracer/ExceptionTracerLib.h b/folly/experimental/exception_tracer/ExceptionTracerLib.h index 263dc5ea..ce5ea80c 100644 --- a/folly/experimental/exception_tracer/ExceptionTracerLib.h +++ b/folly/experimental/exception_tracer/ExceptionTracerLib.h @@ -31,8 +31,8 @@ namespace detail { */ void dummyCxaThrow(void*, std::type_info*, void (*)(void*)) noexcept; void dummyCxaBeginCatch(void*) noexcept; -void dummyCxaRethrow(void) noexcept; -void dummyCxaEndCatch(void) noexcept; +void dummyCxaRethrow() noexcept; +void dummyCxaEndCatch() noexcept; void dummyRethrowException(std::exception_ptr) noexcept; } diff --git a/folly/experimental/symbolizer/SignalHandler.h b/folly/experimental/symbolizer/SignalHandler.h index ae68fd59..f9d7a6c3 100644 --- a/folly/experimental/symbolizer/SignalHandler.h +++ b/folly/experimental/symbolizer/SignalHandler.h @@ -40,7 +40,7 @@ void installFatalSignalHandler(); * All these fatal callback must be added before calling * installFatalSignalCallbacks(), below. */ -typedef void (*SignalCallback)(void); +typedef void (*SignalCallback)(); void addFatalSignalCallback(SignalCallback callback); /** diff --git a/folly/io/async/AsyncSSLSocket.cpp b/folly/io/async/AsyncSSLSocket.cpp index 1f8cd7dd..3a7562dc 100644 --- a/folly/io/async/AsyncSSLSocket.cpp +++ b/folly/io/async/AsyncSSLSocket.cpp @@ -184,7 +184,7 @@ static BIO_METHOD* getSSLBioMethod() { return instance; } -void* initsslBioMethod(void) { +void* initsslBioMethod() { auto sslBioMethod = getSSLBioMethod(); // override the bwrite method for MSG_EOR support OpenSSLUtils::setCustomBioWriteMethod(sslBioMethod, AsyncSSLSocket::bioWrite); diff --git a/folly/ssl/OpenSSLVersionFinder.h b/folly/ssl/OpenSSLVersionFinder.h index 19914f97..54da65d7 100644 --- a/folly/ssl/OpenSSLVersionFinder.h +++ b/folly/ssl/OpenSSLVersionFinder.h @@ -22,7 +22,7 @@ // OPENSSL_VERSION_NUMBER is insufficient as runtime version may be different // from the compile-time version struct OpenSSLVersionFinder { - static std::string getOpenSSLLongVersion(void) { + static std::string getOpenSSLLongVersion() { #ifdef OPENSSL_VERSION_TEXT return SSLeay_version(SSLEAY_VERSION); #elif defined(OPENSSL_VERSION_NUMBER) @@ -32,7 +32,7 @@ struct OpenSSLVersionFinder { #endif } - uint64_t getOpenSSLNumericVersion(void) { + uint64_t getOpenSSLNumericVersion() { #ifdef OPENSSL_VERSION_NUMBER return SSLeay(); #else diff --git a/folly/ssl/detail/SSLSessionImpl.cpp b/folly/ssl/detail/SSLSessionImpl.cpp index 7dc39d1a..2f725387 100644 --- a/folly/ssl/detail/SSLSessionImpl.cpp +++ b/folly/ssl/detail/SSLSessionImpl.cpp @@ -51,7 +51,7 @@ SSLSessionImpl::~SSLSessionImpl() { downRef(); } -std::string SSLSessionImpl::serialize(void) const { +std::string SSLSessionImpl::serialize() const { std::string ret; // Get the length first, then we know how much space to allocate. diff --git a/folly/test/function_benchmark/test_functions.cpp b/folly/test/function_benchmark/test_functions.cpp index 020a4401..57bdc7b5 100644 --- a/folly/test/function_benchmark/test_functions.cpp +++ b/folly/test/function_benchmark/test_functions.cpp @@ -25,9 +25,11 @@ class Exception : public std::exception { public: explicit Exception(const std::string& value) : value_(value) {} - ~Exception(void) noexcept override {} + ~Exception() noexcept override {} - const char* what(void) const noexcept override { return value_.c_str(); } + const char* what() const noexcept override { + return value_.c_str(); + } private: std::string value_; -- 2.34.1