From ab5eb955b47e822ba95e4866d310adba6c0241f5 Mon Sep 17 00:00:00 2001 From: An Tao Date: Thu, 15 Apr 2021 23:26:58 +0800 Subject: [PATCH] Fix unused parameter errors/warnings (#805) --- .github/workflows/cmake.yml | 7 ++++++- lib/src/ListenerManager.cc | 5 +++++ lib/src/Utilities.cc | 4 ++-- nosql_lib/redis/src/RedisClientImpl.cc | 4 ++-- nosql_lib/redis/src/RedisClientLockFree.cc | 4 ++-- nosql_lib/redis/src/RedisConnection.cc | 6 +++--- nosql_lib/redis/src/RedisTransactionImpl.cc | 10 +++++----- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5551b466..f7c14a86 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -109,7 +109,7 @@ jobs: # Installing packages might fail as the github image becomes outdated sudo apt update # These aren't available or don't work well in vcpkg - sudo apt install libjsoncpp-dev uuid-dev openssl libssl-dev zlib1g-dev postgresql-all libsqlite3-dev + sudo apt install libjsoncpp-dev uuid-dev openssl libssl-dev zlib1g-dev libsqlite3-dev sudo apt install libbrotli-dev - name: (Linux) Install gcc-10 if: matrix.buildname == 'ubuntu-20.04/gcc-10' @@ -122,6 +122,11 @@ jobs: sudo apt update sudo apt install boost1.67 + - name: (Linux) Install postgresql + if: matrix.os == 'ubuntu-20.04' + run: | + sudo apt install postgresql-all + - name: install gtest run: | wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz diff --git a/lib/src/ListenerManager.cc b/lib/src/ListenerManager.cc index 9c7f826c..0472d9c5 100644 --- a/lib/src/ListenerManager.cc +++ b/lib/src/ListenerManager.cc @@ -73,8 +73,13 @@ std::vector ListenerManager::createListeners( const WebSocketNewAsyncCallback &webSocketCallback, const ConnectionCallback &connectionCallback, size_t connectionTimeout, +#ifdef OpenSSL_FOUND const std::string &globalCertFile, const std::string &globalKeyFile, +#else + const std::string & /*globalCertFile*/, + const std::string & /*globalKeyFile*/, +#endif size_t threadNum, const std::vector> &syncAdvices) diff --git a/lib/src/Utilities.cc b/lib/src/Utilities.cc index eee71421..fd0b908f 100644 --- a/lib/src/Utilities.cc +++ b/lib/src/Utilities.cc @@ -1161,13 +1161,13 @@ std::string brotliDecompress(const char *data, const size_t ndata) return decompressed; } #else -std::string brotliCompress(const char *data, const size_t ndata) +std::string brotliCompress(const char * /*data*/, const size_t /*ndata*/) { LOG_ERROR << "If you do not have the brotli package installed, you cannot " "use brotliCompress()"; abort(); } -std::string brotliDecompress(const char *data, const size_t ndata) +std::string brotliDecompress(const char * /*data*/, const size_t /*ndata*/) { LOG_ERROR << "If you do not have the brotli package installed, you cannot " "use brotliDecompress()"; diff --git a/nosql_lib/redis/src/RedisClientImpl.cc b/nosql_lib/redis/src/RedisClientImpl.cc index 10501db9..efddee33 100644 --- a/nosql_lib/redis/src/RedisClientImpl.cc +++ b/nosql_lib/redis/src/RedisClientImpl.cc @@ -182,7 +182,7 @@ void RedisClientImpl::newTransactionAsync( std::weak_ptr thisWeakPtr = shared_from_this(); std::lock_guard lock(connectionsMutex_); tasks_.emplace( - [callback, thisWeakPtr](const RedisConnectionPtr &connPtr) { + [callback, thisWeakPtr](const RedisConnectionPtr & /*connPtr*/) { auto thisPtr = thisWeakPtr.lock(); if (thisPtr) { @@ -230,4 +230,4 @@ void RedisClientImpl::handleNextTask(const RedisConnectionPtr &connPtr) { task(connPtr); } -} \ No newline at end of file +} diff --git a/nosql_lib/redis/src/RedisClientLockFree.cc b/nosql_lib/redis/src/RedisClientLockFree.cc index 75eb2c34..d88e2889 100644 --- a/nosql_lib/redis/src/RedisClientLockFree.cc +++ b/nosql_lib/redis/src/RedisClientLockFree.cc @@ -161,7 +161,7 @@ void RedisClientLockFree::newTransactionAsync( { std::weak_ptr thisWeakPtr = shared_from_this(); tasks_.emplace( - [callback, thisWeakPtr](const RedisConnectionPtr &connPtr) { + [callback, thisWeakPtr](const RedisConnectionPtr & /*connPtr*/) { auto thisPtr = thisWeakPtr.lock(); if (thisPtr) { @@ -205,4 +205,4 @@ void RedisClientLockFree::handleNextTask(const RedisConnectionPtr &connPtr) { task(connPtr); } -} \ No newline at end of file +} diff --git a/nosql_lib/redis/src/RedisConnection.cc b/nosql_lib/redis/src/RedisConnection.cc index 8a63a38f..6c15a1c7 100644 --- a/nosql_lib/redis/src/RedisConnection.cc +++ b/nosql_lib/redis/src/RedisConnection.cc @@ -113,7 +113,7 @@ void RedisConnection::startConnectionInLoop() } }); redisAsyncSetDisconnectCallback( - redisContext_, [](const redisAsyncContext *context, int status) { + redisContext_, [](const redisAsyncContext *context, int /*status*/) { auto thisPtr = static_cast(context->ev.data); thisPtr->handleDisconnect(); @@ -176,7 +176,7 @@ void RedisConnection::delRead(void *userData) assert(thisPtr->channel_); thisPtr->channel_->disableReading(); } -void RedisConnection::cleanup(void *userData) +void RedisConnection::cleanup(void * /*userData*/) { LOG_TRACE << "cleanup"; } @@ -205,7 +205,7 @@ void RedisConnection::sendCommandInLoop( redisAsyncFormattedCommand( redisContext_, - [](redisAsyncContext *context, void *r, void *userData) { + [](redisAsyncContext *context, void *r, void * /*userData*/) { auto thisPtr = static_cast(context->ev.data); thisPtr->handleResult(static_cast(r)); }, diff --git a/nosql_lib/redis/src/RedisTransactionImpl.cc b/nosql_lib/redis/src/RedisTransactionImpl.cc index 79a84b27..a1a2c3bb 100644 --- a/nosql_lib/redis/src/RedisTransactionImpl.cc +++ b/nosql_lib/redis/src/RedisTransactionImpl.cc @@ -65,8 +65,8 @@ void RedisTransactionImpl::execCommandAsync( void RedisTransactionImpl::doBegin() { assert(!isExecutedOrCancelled_); - execCommandAsync([](const RedisResult &result) {}, - [](const RedisException &err) {}, + execCommandAsync([](const RedisResult & /*result*/) {}, + [](const RedisException & /*err*/) {}, "MULTI"); } @@ -75,9 +75,9 @@ RedisTransactionImpl::~RedisTransactionImpl() if (!isExecutedOrCancelled_) { LOG_WARN << "The transaction is not executed before being destroyed"; - connPtr_->sendCommand([](const RedisResult &result) {}, - [](const RedisException &err) {}, + connPtr_->sendCommand([](const RedisResult & /*result*/) {}, + [](const RedisException & /*err*/) {}, "DISCARD"); } LOG_TRACE << "transaction is destroyed"; -} \ No newline at end of file +}