Enabled more compiler warnings

This commit is contained in:
SChernykh 2022-06-01 14:25:58 +02:00
parent 9a5be0a321
commit 6ef34bb3f5
8 changed files with 27 additions and 9 deletions

View file

@ -7,7 +7,7 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(GENERAL_FLAGS "-pthread")
set(WARNING_FLAGS "-Wall -Wextra -Werror")
set(WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wcast-qual -Wlogical-op -Wstrict-overflow=2 -Wundef -Wformat=2 -Wpointer-arith -Werror")
set(OPTIMIZATION_FLAGS "-Ofast -s")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
@ -42,7 +42,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(GENERAL_FLAGS "-pthread")
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Werror")
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
set(OPTIMIZATION_FLAGS "-Ofast -funroll-loops -fmerge-all-constants")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")

View file

@ -1,7 +1,11 @@
#ifdef _MSC_VER
#pragma warning(disable : 4100 4668 4710 4711 4820)
#elif defined __clang__
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#elif defined __GNUC__
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wcast-qual"
#endif
#include <stdlib.h>

View file

@ -1,5 +1,8 @@
#ifdef _MSC_VER
#pragma warning(disable : 4100 4668 4710 4711 4820)
#elif defined __clang__
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#elif defined __GNUC__
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

View file

@ -1,8 +1,18 @@
#ifdef _MSC_VER
#pragma warning(disable : 4061 4065 4100 4152 4242 4244 4668 4702 4710 4711 4820 5045)
#elif defined __clang__
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wunreachable-code"
#elif defined __GNUC__
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wcast-qual"
#endif
#ifndef LLHTTP_STRICT_MODE
#define LLHTTP_STRICT_MODE 0
#endif
#if LLHTTP_STRICT_MODE

View file

@ -334,6 +334,8 @@ void* realloc_hook(void* ptr, size_t size) noexcept;
void* calloc_hook(size_t count, size_t size) noexcept;
void free_hook(void* p) noexcept;
extern const char* BLOCK_FOUND;
} // namespace p2pool
#include "util.h"

View file

@ -390,8 +390,6 @@ void SideChain::unsee_block(const PoolBlock& block)
m_seenBlocks.erase(block.m_sidechainId);
}
extern const char* BLOCK_FOUND;
bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_blocks)
{
if (block.m_difficulty < m_minDifficulty) {

View file

@ -1035,12 +1035,9 @@ bool StratumServer::StratumClient::process_request(char* data, uint32_t /*size*/
LOGINFO(6, "incoming keepalive from " << log::Gray() << static_cast<char*>(m_addrString));
return true;
}
else {
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON request (unknown method)");
return false;
}
return true;
}
bool StratumServer::StratumClient::process_login(rapidjson::Document& doc, uint32_t id)

View file

@ -221,6 +221,10 @@ FORCEINLINE uint64_t bsr(uint64_t x)
} // namespace p2pool
void memory_tracking_start();
void memory_tracking_stop();
void p2pool_usage();
namespace robin_hood {
template<>