mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-29 18:10:34 +00:00
Suppress warnings & allow copy elision:
* Suppress warnings from rocksdb2 * Add `override` to rippled rocksdb functions * Remove moves preventing copy elision
This commit is contained in:
48
SConstruct
48
SConstruct
@@ -724,6 +724,22 @@ def get_soci_sources(style):
|
||||
CPPPATH=cpp_path)
|
||||
return result
|
||||
|
||||
def use_shp(toolchain):
|
||||
'''
|
||||
Return True if we want to use the --system-header-prefix command-line switch
|
||||
'''
|
||||
if toolchain != 'clang':
|
||||
return False
|
||||
if use_shp.cache is None:
|
||||
try:
|
||||
ver = subprocess.check_output(
|
||||
['clang', '--version'], stderr=subprocess.STDOUT).strip()
|
||||
use_shp.cache = 'version 3.4' not in ver and 'version 3.0' not in ver
|
||||
except:
|
||||
use_shp.cache = False
|
||||
return use_shp.cache
|
||||
use_shp.cache = None
|
||||
|
||||
def get_common_sources(toolchain):
|
||||
result = []
|
||||
if toolchain == 'msvc':
|
||||
@@ -761,6 +777,11 @@ def get_classic_sources(toolchain):
|
||||
append_sources(result, *list_sources('src/ripple/test', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/unl', '.cpp'))
|
||||
|
||||
if use_shp(toolchain):
|
||||
cc_flags = {'CCFLAGS': ['--system-header-prefix=rocksdb2']}
|
||||
else:
|
||||
cc_flags = {}
|
||||
|
||||
append_sources(
|
||||
result,
|
||||
*list_sources('src/ripple/nodestore', '.cpp'),
|
||||
@@ -768,7 +789,8 @@ def get_classic_sources(toolchain):
|
||||
'src/rocksdb2/include',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
])
|
||||
],
|
||||
**cc_flags)
|
||||
|
||||
result += get_soci_sources('classic')
|
||||
result += get_common_sources(toolchain)
|
||||
@@ -800,6 +822,11 @@ def get_unity_sources(toolchain):
|
||||
'src/ripple/unity/unl.cpp',
|
||||
)
|
||||
|
||||
if use_shp(toolchain):
|
||||
cc_flags = {'CCFLAGS': ['--system-header-prefix=rocksdb2']}
|
||||
else:
|
||||
cc_flags = {}
|
||||
|
||||
append_sources(
|
||||
result,
|
||||
'src/ripple/unity/nodestore.cpp',
|
||||
@@ -807,7 +834,8 @@ def get_unity_sources(toolchain):
|
||||
'src/rocksdb2/include',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
])
|
||||
],
|
||||
**cc_flags)
|
||||
|
||||
result += get_soci_sources('unity')
|
||||
result += get_common_sources(toolchain)
|
||||
@@ -917,6 +945,11 @@ for tu_style in ['classic', 'unity']:
|
||||
'src/ripple/unity/git_id.cpp',
|
||||
**git_commit_tag)
|
||||
|
||||
if use_shp(toolchain):
|
||||
cc_flags = {'CCFLAGS': ['--system-header-prefix=rocksdb2']}
|
||||
else:
|
||||
cc_flags = {}
|
||||
|
||||
object_builder.add_source_files(
|
||||
'src/beast/beast/unity/hash_unity.cpp',
|
||||
'src/ripple/unity/beast.cpp',
|
||||
@@ -925,7 +958,8 @@ for tu_style in ['classic', 'unity']:
|
||||
'src/ripple/unity/ripple.proto.cpp',
|
||||
'src/ripple/unity/resource.cpp',
|
||||
'src/ripple/unity/server.cpp',
|
||||
'src/ripple/unity/websocket02.cpp'
|
||||
'src/ripple/unity/websocket02.cpp',
|
||||
**cc_flags
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
@@ -933,9 +967,11 @@ for tu_style in ['classic', 'unity']:
|
||||
CCFLAGS = ([] if toolchain == 'msvc' else ['-Wno-array-bounds']))
|
||||
|
||||
if 'gcc' in toolchain:
|
||||
no_uninitialized_warning = {'CCFLAGS': ['-Wno-maybe-uninitialized']}
|
||||
cc_flags = {'CCFLAGS': ['-Wno-maybe-uninitialized']}
|
||||
elif use_shp(toolchain):
|
||||
cc_flags = {'CCFLAGS': ['--system-header-prefix=rocksdb2']}
|
||||
else:
|
||||
no_uninitialized_warning = {}
|
||||
cc_flags = {}
|
||||
|
||||
object_builder.add_source_files(
|
||||
'src/ripple/unity/ed25519.c',
|
||||
@@ -952,7 +988,7 @@ for tu_style in ['classic', 'unity']:
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
],
|
||||
**no_uninitialized_warning
|
||||
**cc_flags
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
|
||||
@@ -757,9 +757,7 @@ Ledger::peek (Keylet const& k) const
|
||||
return nullptr;
|
||||
// VFALCO TODO Eliminate "immutable" runtime property
|
||||
sle->setImmutable();
|
||||
// need move otherwise makes a copy
|
||||
// because return type is different
|
||||
return std::move(sle);
|
||||
return sle;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
}
|
||||
|
||||
std::string
|
||||
getName()
|
||||
getName() override
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
Status
|
||||
fetch (void const* key, std::shared_ptr<NodeObject>* pObject)
|
||||
fetch (void const* key, std::shared_ptr<NodeObject>* pObject) override
|
||||
{
|
||||
pObject->reset ();
|
||||
|
||||
@@ -267,13 +267,13 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
store (std::shared_ptr<NodeObject> const& object)
|
||||
store (std::shared_ptr<NodeObject> const& object) override
|
||||
{
|
||||
m_batch.store (object);
|
||||
}
|
||||
|
||||
void
|
||||
storeBatch (Batch const& batch)
|
||||
storeBatch (Batch const& batch) override
|
||||
{
|
||||
rocksdb::WriteBatch wb;
|
||||
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
for_each (std::function <void(std::shared_ptr<NodeObject>)> f)
|
||||
for_each (std::function <void(std::shared_ptr<NodeObject>)> f) override
|
||||
{
|
||||
rocksdb::ReadOptions const options;
|
||||
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
}
|
||||
|
||||
int
|
||||
getWriteLoad ()
|
||||
getWriteLoad () override
|
||||
{
|
||||
return m_batch.getWriteLoad ();
|
||||
}
|
||||
@@ -350,7 +350,7 @@ public:
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
writeBatch (Batch const& batch)
|
||||
writeBatch (Batch const& batch) override
|
||||
{
|
||||
storeBatch (batch);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
}
|
||||
|
||||
std::string
|
||||
getName()
|
||||
getName() override
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
Status
|
||||
fetch (void const* key, std::shared_ptr<NodeObject>* pObject)
|
||||
fetch (void const* key, std::shared_ptr<NodeObject>* pObject) override
|
||||
{
|
||||
pObject->reset ();
|
||||
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
store (std::shared_ptr<NodeObject> const& object)
|
||||
store (std::shared_ptr<NodeObject> const& object) override
|
||||
{
|
||||
storeBatch(Batch{object});
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
storeBatch (Batch const& batch)
|
||||
storeBatch (Batch const& batch) override
|
||||
{
|
||||
rocksdb::WriteBatch wb;
|
||||
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
for_each (std::function <void(std::shared_ptr<NodeObject>)> f)
|
||||
for_each (std::function <void(std::shared_ptr<NodeObject>)> f) override
|
||||
{
|
||||
rocksdb::ReadOptions const options;
|
||||
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
}
|
||||
|
||||
int
|
||||
getWriteLoad ()
|
||||
getWriteLoad () override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -862,7 +862,7 @@ STParsedJSONObject::STParsedJSONObject (
|
||||
Json::Value const& json)
|
||||
{
|
||||
using namespace STParsedJSONDetail;
|
||||
object = std::move (parseObject (name, json, sfGeneric, 0, error));
|
||||
object = parseObject (name, json, sfGeneric, 0, error);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -127,7 +127,7 @@ make_stvar(Args&&... args)
|
||||
{
|
||||
STVar st;
|
||||
st.construct<T>(std::forward<Args>(args)...);
|
||||
return std::move(st);
|
||||
return st;
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
@@ -792,7 +792,7 @@ Json::Value transactionSignFor (
|
||||
{
|
||||
Json::Value err = checkMultiSignFields (jvRequest);
|
||||
if (RPC::contains_error (err))
|
||||
return std::move (err);
|
||||
return err;
|
||||
}
|
||||
|
||||
// Add and amend fields based on the transaction type.
|
||||
@@ -880,7 +880,7 @@ Json::Value transactionSubmitMultiSigned (
|
||||
{
|
||||
Json::Value err = checkMultiSignFields (jvRequest);
|
||||
if (RPC::contains_error (err))
|
||||
return std::move (err);
|
||||
return err;
|
||||
}
|
||||
|
||||
Json::Value& tx_json (jvRequest ["tx_json"]);
|
||||
@@ -913,7 +913,7 @@ Json::Value transactionSubmitMultiSigned (
|
||||
jvRequest, role, false, app.config(), app.getFeeTrack(), ledger);
|
||||
|
||||
if (RPC::contains_error(err))
|
||||
return std::move (err);
|
||||
return err;
|
||||
|
||||
err = checkPayment (
|
||||
jvRequest,
|
||||
@@ -925,7 +925,7 @@ Json::Value transactionSubmitMultiSigned (
|
||||
false);
|
||||
|
||||
if (RPC::contains_error(err))
|
||||
return std::move (err);
|
||||
return err;
|
||||
}
|
||||
|
||||
// Grind through the JSON in tx_json to produce a STTx
|
||||
|
||||
Reference in New Issue
Block a user