Skip to content

Commit c652cfb

Browse files
Merge branch 'vmware:master' into full_node_st_changes
2 parents c1204d4 + b4dea9d commit c652cfb

File tree

12 files changed

+37
-43
lines changed

12 files changed

+37
-43
lines changed

.cppcheck/suppressions.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# TODO [TK] - do we want enable cppckeck for tests?
55

66
incorrectStringBooleanError
7-
uninitMemberVar
87
noCopyConstructor
98
noOperatorEq
109

.github/workflows/cppcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ jobs:
2222
mkdir build
2323
cd build
2424
echo $(date +%y-%m-%d_%H-%M-%S) > timestamp
25-
cmake -DBUILD_TESTING=OFF -DBUILD_UTT=OFF -DUSE_LOG4CPP=OFF -DCPPCHECK=ON ..
25+
cmake -DCPPCHECK=ON ..
2626
make -j$(nproc)

CMakeLists.txt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ project(concord-bft VERSION 0.1.0.0 LANGUAGES CXX)
44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_CXX_EXTENSIONS OFF)
7-
set(SLEEP_FOR_DBG FALSE)
7+
88
# targets with generic names like "format" may already exist in an imported libs
99
cmake_policy(SET CMP0002 OLD)
1010
set(ALLOW_DUPLICATE_CUSTOM_TARGETS TRUE)
11+
1112
set(MIN_BOOST_VERSION 1.80)
1213
set(YAML_CPP_VERSION 0.7.0)
1314

14-
# Default to debug builds
15+
# Defaults to debug builds
1516
# Release builds can be enabled by running cmake with -DCMAKE_BUILD_TYPE=Release
1617
if(NOT CMAKE_BUILD_TYPE)
1718
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Enable debug or release builds" FORCE)
@@ -21,10 +22,7 @@ option(USE_LOG4CPP "Enable LOG4CPP" ON)
2122
option(RUN_APOLLO_TESTS "Enable Apollo tests run" ON)
2223
option(KEEP_APOLLO_LOGS "Retains logs from replicas in separate folder for each test in build/tests/apollo/logs" ON)
2324
option(TXN_SIGNING_ENABLED "Enable External concord client transcattion signing" ON)
24-
option(LEAKCHECK "Enable Address and Leak Sanitizers" OFF)
25-
option(HEAPTRACK "Enable Heaptrack - a heap memory profiler for Linux" OFF)
26-
option(THREADCHECK "Enable Thread Sanitizer" OFF)
27-
option(UNDEFINED_BEHAVIOR_CHECK "Enable Undefined Behavior Sanitizer" OFF)
25+
2826
# Rocksdb is required for storage now. Consider removing this flag.
2927
option(BUILD_ROCKSDB_STORAGE "Enable building of RocksDB storage library" ON)
3028
option(USE_S3_OBJECT_STORE "Enable S3 Object Store" ON)
@@ -45,20 +43,14 @@ if((USE_OPENSSL) AND NOT BUILD_THIRDPARTY)
4543
set(OPENSSL_ROOT_DIR /usr/local/ssl) # not to confuse with system ssl libs
4644
endif()
4745

48-
if(SLEEP_FOR_DBG)
49-
add_definitions(-DSLEEP_DBG)
50-
endif()
51-
5246
# include compiler specific options
5347
include(cmake/${CMAKE_CXX_COMPILER_ID}.cmake)
5448
include(cmake/cppcheck.cmake)
5549

5650
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
5751
include(cmake/grpc_utils.cmake)
5852

59-
if(BUILD_TESTING)
60-
include(CTest)
61-
endif()
53+
include(CTest)
6254

6355
if(USE_S3_OBJECT_STORE)
6456
add_compile_definitions(USE_S3_OBJECT_STORE=1)

bftengine/include/bftengine/EpochManager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
namespace bftEngine {
2121
class EpochManager : public bftEngine::ResPagesClient<EpochManager, 1> {
2222
struct EpochData : public concord::serialize::SerializableFactory<EpochData> {
23-
uint64_t epochNumber_;
23+
uint64_t epochNumber_ = 0;
2424
EpochData() = default;
2525
EpochData(uint64_t epochNumber) : epochNumber_{epochNumber} {}
2626

@@ -79,4 +79,4 @@ class EpochManager : public bftEngine::ResPagesClient<EpochManager, 1> {
7979
concordMetrics::Component metrics_;
8080
concordMetrics::GaugeHandle epoch_number_gauge_;
8181
};
82-
} // namespace bftEngine
82+
} // namespace bftEngine

bftengine/src/bftengine/DebugStatistics.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ class DebugStatistics {
4141

4242
private:
4343
struct DebugStatDesc {
44-
bool initialized;
44+
bool initialized = false;
4545
Time lastCycleTime;
4646

47-
size_t receivedMessages;
48-
std::atomic<size_t> sendMessages;
49-
size_t completedReadOnlyRequests;
50-
size_t completedReadWriteRequests;
51-
size_t numberOfReceivedSTMessages;
52-
size_t numberOfReceivedStatusMessages;
53-
size_t numberOfReceivedCommitMessages;
54-
int64_t lastExecutedSequenceNumber;
55-
56-
size_t prePrepareMessages;
57-
size_t batchRequests;
58-
size_t pendingRequests;
47+
size_t receivedMessages = 0;
48+
std::atomic<size_t> sendMessages = 0;
49+
size_t completedReadOnlyRequests = 0;
50+
size_t completedReadWriteRequests = 0;
51+
size_t numberOfReceivedSTMessages = 0;
52+
size_t numberOfReceivedStatusMessages = 0;
53+
size_t numberOfReceivedCommitMessages = 0;
54+
int64_t lastExecutedSequenceNumber = 0;
55+
56+
size_t prePrepareMessages = 0;
57+
size_t batchRequests = 0;
58+
size_t pendingRequests = 0;
5959

6060
DebugStatDesc() : initialized(false) {}
6161
};

bftengine/src/bftengine/ReplicaSpecificInfoManager.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class RsiItem {
3434

3535
private:
3636
std::string data_;
37-
uint64_t index_;
38-
uint64_t req_seq_num_;
37+
uint64_t index_ = 0;
38+
uint64_t req_seq_num_ = 0;
3939
};
4040

4141
class RsiDataManager {
@@ -58,4 +58,4 @@ class RsiDataManager {
5858
std::unordered_map<uint32_t, uint64_t> clientsIndex_;
5959
};
6060
} // namespace impl
61-
} // namespace bftEngine
61+
} // namespace bftEngine

bftengine/src/bftengine/RetransmissionsManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ class RetransmissionsLogic {
169169
SeqNum seqNumber = 0;
170170

171171
bool ackOrAbort = false;
172-
uint16_t numOfTransmissions; // valid only if ackOrAbort==false
173-
Time timeOfTransmission; // valid only if ackOrAbort==false
172+
uint16_t numOfTransmissions = 0; // valid only if ackOrAbort==false
173+
Time timeOfTransmission; // valid only if ackOrAbort==false
174174
};
175175

176176
class ReplicaInfo {

bftengine/src/preprocessor/messages/PreProcessResultMsg.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class PreProcessResultMsg : public ClientRequestMsg {
6363
struct PreProcessResultSignature {
6464
std::vector<concord::Byte> signature;
6565
NodeIdType sender_replica;
66-
bftEngine::OperationResult pre_process_result;
66+
bftEngine::OperationResult pre_process_result = bftEngine::OperationResult::UNKNOWN;
6767

6868
PreProcessResultSignature() = default;
6969

client/bftclient/include/bftclient/fake_comm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class BehaviorThreadRunner {
7878
void stop() { stop_ = true; }
7979

8080
private:
81-
IReceiver* receiver_;
81+
IReceiver* receiver_ = nullptr;
8282
std::atomic<bool> stop_ = false;
8383

8484
Behavior behavior_;
@@ -131,7 +131,7 @@ class FakeCommunication : public bft::communication::ICommunication {
131131
void restartCommunication(NodeNum i) override {}
132132

133133
private:
134-
IReceiver* receiver_;
134+
IReceiver* receiver_ = nullptr;
135135
BehaviorThreadRunner runner_;
136136
std::thread fakeCommThread_;
137137
};

cmake/cppcheck.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
option(CPPCHECK "Perform cppcheck" OFF)
22

33
if(CPPCHECK)
4-
message(STATUS "CPPCHECK is ON")
4+
set(BUILD_TESTING OFF)
5+
set(BUILD_UTT OFF)
6+
set(USE_LOG4CPP OFF)
7+
message(STATUS "CPPCHECK is ON")
58
find_program(cppcheck cppcheck HINTS "/usr/local/bin/cppcheck" REQUIRED)
69
message(STATUS "cppcheck ${cppcheck}")
710
# Create <cppcheck> work folder for whole program analysis, for faster analysis and to store some useful debug information

0 commit comments

Comments
 (0)