mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-27 22:15:49 +00:00
Add option to enable -Wextra for gcc/clang.
This commit is contained in:
@@ -7,7 +7,7 @@ services:
|
|||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- DOCKER_IMAGE="mellery451/rippled-ci-builder:2019-08-26"
|
- DOCKER_IMAGE="mellery451/rippled-ci-builder:2019-08-26"
|
||||||
- CMAKE_EXTRA_ARGS="-Dwerr=ON"
|
- CMAKE_EXTRA_ARGS="-Dwerr=ON -Dwextra=ON"
|
||||||
- NINJA_BUILD=true
|
- NINJA_BUILD=true
|
||||||
# change this if we get more VM capacity
|
# change this if we get more VM capacity
|
||||||
- MAX_TIME_MIN=80
|
- MAX_TIME_MIN=80
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ if (MSVC)
|
|||||||
else ()
|
else ()
|
||||||
# HACK : because these need to come first, before any warning demotion
|
# HACK : because these need to come first, before any warning demotion
|
||||||
string (APPEND CMAKE_CXX_FLAGS " -Wall -Wdeprecated")
|
string (APPEND CMAKE_CXX_FLAGS " -Wall -Wdeprecated")
|
||||||
|
if (wextra)
|
||||||
|
string (APPEND CMAKE_CXX_FLAGS " -Wextra -Wno-unused-parameter")
|
||||||
|
endif ()
|
||||||
# not MSVC
|
# not MSVC
|
||||||
target_compile_options (common
|
target_compile_options (common
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ if (is_gcc OR is_clang)
|
|||||||
"Include only src/ripple files when generating coverage report. \
|
"Include only src/ripple files when generating coverage report. \
|
||||||
Set to OFF to include all sources in coverage report."
|
Set to OFF to include all sources in coverage report."
|
||||||
ON)
|
ON)
|
||||||
|
option (wextra "compile with extra gcc/clang warnings enabled" ON)
|
||||||
else ()
|
else ()
|
||||||
set (profile OFF CACHE BOOL "gcc/clang only" FORCE)
|
set (profile OFF CACHE BOOL "gcc/clang only" FORCE)
|
||||||
set (coverage OFF CACHE BOOL "gcc/clang only" FORCE)
|
set (coverage OFF CACHE BOOL "gcc/clang only" FORCE)
|
||||||
|
set (wextra OFF CACHE BOOL "gcc/clang only" FORCE)
|
||||||
endif ()
|
endif ()
|
||||||
if (is_linux)
|
if (is_linux)
|
||||||
option (BUILD_SHARED_LIBS "build shared ripple libraries" OFF)
|
option (BUILD_SHARED_LIBS "build shared ripple libraries" OFF)
|
||||||
|
|||||||
@@ -433,9 +433,7 @@ Ledger::read (Keylet const& k) const
|
|||||||
item->size()}, item->key());
|
item->size()}, item->key());
|
||||||
if (! k.check(*sle))
|
if (! k.check(*sle))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
// need move otherwise makes a copy
|
return sle;
|
||||||
// because return type is different
|
|
||||||
return std::move(sle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1567,7 +1567,7 @@ bool ApplicationImp::setup()
|
|||||||
Resource::Charge loadType = Resource::feeReferenceRPC;
|
Resource::Charge loadType = Resource::feeReferenceRPC;
|
||||||
Resource::Consumer c;
|
Resource::Consumer c;
|
||||||
RPC::Context context { journal ("RPCHandler"), jvCommand, *this,
|
RPC::Context context { journal ("RPCHandler"), jvCommand, *this,
|
||||||
loadType, getOPs (), getLedgerMaster(), c, Role::ADMIN };
|
loadType, getOPs (), getLedgerMaster (), c, Role::ADMIN};
|
||||||
|
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
RPC::doCommand (context, jvResult);
|
RPC::doCommand (context, jvResult);
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ boost::optional<Manifest> deserializeManifest(Slice s)
|
|||||||
m.signingKey = PublicKey(makeSlice(spk));
|
m.signingKey = PublicKey(makeSlice(spk));
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(m);
|
return m;
|
||||||
}
|
}
|
||||||
catch (std::exception const&)
|
catch (std::exception const&)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <ripple/app/ledger/LedgerMaster.h>
|
#include <ripple/app/ledger/LedgerMaster.h>
|
||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/app/misc/HashRouter.h>
|
#include <ripple/app/misc/HashRouter.h>
|
||||||
|
#include <ripple/basics/safe_cast.h>
|
||||||
#include <ripple/protocol/Feature.h>
|
#include <ripple/protocol/Feature.h>
|
||||||
#include <ripple/protocol/jss.h>
|
#include <ripple/protocol/jss.h>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
@@ -63,7 +64,7 @@ void Transaction::setStatus (TransStatus ts, std::uint32_t lseq)
|
|||||||
TransStatus Transaction::sqlTransactionStatus(
|
TransStatus Transaction::sqlTransactionStatus(
|
||||||
boost::optional<std::string> const& status)
|
boost::optional<std::string> const& status)
|
||||||
{
|
{
|
||||||
char const c = (status) ? (*status)[0] : txnSqlUnknown;
|
char const c = (status) ? (*status)[0] : safe_cast<char>(txnSqlUnknown);
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -112,7 +112,11 @@ inline
|
|||||||
bool
|
bool
|
||||||
is_char(char c)
|
is_char(char c)
|
||||||
{
|
{
|
||||||
|
#ifdef __CHAR_UNSIGNED__ /* -funsigned-char */
|
||||||
return c >= 0 && c <= 127;
|
return c >= 0 && c <= 127;
|
||||||
|
#else
|
||||||
|
return c >= 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class FwdIter>
|
template <class FwdIter>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ struct PeerReservation final
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PublicKey nodeId;
|
PublicKey nodeId;
|
||||||
std::string description;
|
std::string description {};
|
||||||
|
|
||||||
auto
|
auto
|
||||||
toJson() const -> Json::Value;
|
toJson() const -> Json::Value;
|
||||||
|
|||||||
@@ -819,7 +819,7 @@ static boost::optional <STObject> parseObject (
|
|||||||
// Some inner object types have templates. Attempt to apply that.
|
// Some inner object types have templates. Attempt to apply that.
|
||||||
data.applyTemplateFromSField (inName); // May throw
|
data.applyTemplateFromSField (inName); // May throw
|
||||||
|
|
||||||
return std::move (data);
|
return data;
|
||||||
}
|
}
|
||||||
catch (STObject::FieldErr const&)
|
catch (STObject::FieldErr const&)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ struct Context
|
|||||||
LedgerMaster& ledgerMaster;
|
LedgerMaster& ledgerMaster;
|
||||||
Resource::Consumer& consumer;
|
Resource::Consumer& consumer;
|
||||||
Role role;
|
Role role;
|
||||||
std::shared_ptr<JobQueue::Coro> coro;
|
std::shared_ptr<JobQueue::Coro> coro {};
|
||||||
InfoSub::pointer infoSub;
|
InfoSub::pointer infoSub {};
|
||||||
Headers headers;
|
Headers headers {};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // RPC
|
} // RPC
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ transactionPreProcessImpl (
|
|||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
auto const [pk, sk] = keypairForSignature (params, jvResult);
|
auto const [pk, sk] = keypairForSignature (params, jvResult);
|
||||||
if (contains_error (jvResult))
|
if (contains_error (jvResult))
|
||||||
return std::move (jvResult);
|
return jvResult;
|
||||||
|
|
||||||
bool const verify = !(params.isMember (jss::offline)
|
bool const verify = !(params.isMember (jss::offline)
|
||||||
&& params[jss::offline].asBool());
|
&& params[jss::offline].asBool());
|
||||||
@@ -402,7 +402,7 @@ transactionPreProcessImpl (
|
|||||||
ledger);
|
ledger);
|
||||||
|
|
||||||
if (RPC::contains_error (err))
|
if (RPC::contains_error (err))
|
||||||
return std::move (err);
|
return err;
|
||||||
|
|
||||||
err = checkPayment (
|
err = checkPayment (
|
||||||
params,
|
params,
|
||||||
@@ -414,7 +414,7 @@ transactionPreProcessImpl (
|
|||||||
verify && signingArgs.editFields());
|
verify && signingArgs.editFields());
|
||||||
|
|
||||||
if (RPC::contains_error(err))
|
if (RPC::contains_error(err))
|
||||||
return std::move (err);
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signingArgs.editFields())
|
if (signingArgs.editFields())
|
||||||
@@ -495,7 +495,7 @@ transactionPreProcessImpl (
|
|||||||
err [jss::error] = parsed.error [jss::error];
|
err [jss::error] = parsed.error [jss::error];
|
||||||
err [jss::error_code] = parsed.error [jss::error_code];
|
err [jss::error_code] = parsed.error [jss::error_code];
|
||||||
err [jss::error_message] = parsed.error [jss::error_message];
|
err [jss::error_message] = parsed.error [jss::error_message];
|
||||||
return std::move (err);
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<STTx> stpTrans;
|
std::shared_ptr<STTx> stpTrans;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ SHAMapInnerNode::clone(std::uint32_t seq) const
|
|||||||
std::lock_guard lock(childLock);
|
std::lock_guard lock(childLock);
|
||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 16; ++i)
|
||||||
p->mChildren[i] = mChildren[i];
|
p->mChildren[i] = mChildren[i];
|
||||||
return std::move(p);
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SHAMapAbstractNode>
|
std::shared_ptr<SHAMapAbstractNode>
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ class LedgerLoad_test : public beast::unit_test::suite
|
|||||||
struct SetupData
|
struct SetupData
|
||||||
{
|
{
|
||||||
std::string const dbPath;
|
std::string const dbPath;
|
||||||
std::string ledgerFile;
|
std::string ledgerFile {};
|
||||||
Json::Value ledger;
|
Json::Value ledger {};
|
||||||
Json::Value hashes;
|
Json::Value hashes {};
|
||||||
};
|
};
|
||||||
|
|
||||||
SetupData
|
SetupData
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ public:
|
|||||||
auto& app = env.app();
|
auto& app = env.app();
|
||||||
Resource::Charge loadType = Resource::feeReferenceRPC;
|
Resource::Charge loadType = Resource::feeReferenceRPC;
|
||||||
Resource::Consumer c;
|
Resource::Consumer c;
|
||||||
RPC::Context context {env.journal, {}, app, loadType,
|
RPC::Context context { env.journal, {}, app, loadType,
|
||||||
app.getOPs(), app.getLedgerMaster(), c, Role::USER, {}};
|
app.getOPs(), app.getLedgerMaster(), c, Role::USER};
|
||||||
|
|
||||||
Json::Value params = Json::objectValue;
|
Json::Value params = Json::objectValue;
|
||||||
params[jss::command] = "ripple_path_find";
|
params[jss::command] = "ripple_path_find";
|
||||||
@@ -320,7 +320,7 @@ public:
|
|||||||
Resource::Charge loadType = Resource::feeReferenceRPC;
|
Resource::Charge loadType = Resource::feeReferenceRPC;
|
||||||
Resource::Consumer c;
|
Resource::Consumer c;
|
||||||
RPC::Context context {env.journal, {}, app, loadType,
|
RPC::Context context {env.journal, {}, app, loadType,
|
||||||
app.getOPs(), app.getLedgerMaster(), c, Role::USER, {}};
|
app.getOPs(), app.getLedgerMaster(), c, Role::USER};
|
||||||
Json::Value result;
|
Json::Value result;
|
||||||
gate g;
|
gate g;
|
||||||
// Test RPC::Tuning::max_src_cur source currencies.
|
// Test RPC::Tuning::max_src_cur source currencies.
|
||||||
|
|||||||
Reference in New Issue
Block a user