diff --git a/SConstruct b/SConstruct index 76c0abdff..e8dd5c882 100644 --- a/SConstruct +++ b/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( diff --git a/src/ripple/app/ledger/Ledger.cpp b/src/ripple/app/ledger/Ledger.cpp index 17902b01a..a8df55724 100644 --- a/src/ripple/app/ledger/Ledger.cpp +++ b/src/ripple/app/ledger/Ledger.cpp @@ -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; } //------------------------------------------------------------------------------ diff --git a/src/ripple/nodestore/backend/RocksDBFactory.cpp b/src/ripple/nodestore/backend/RocksDBFactory.cpp index 46654cd3e..7b8319b07 100644 --- a/src/ripple/nodestore/backend/RocksDBFactory.cpp +++ b/src/ripple/nodestore/backend/RocksDBFactory.cpp @@ -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* pObject) + fetch (void const* key, std::shared_ptr* pObject) override { pObject->reset (); @@ -267,13 +267,13 @@ public: } void - store (std::shared_ptr const& object) + store (std::shared_ptr 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 )> f) + for_each (std::function )> 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); } diff --git a/src/ripple/nodestore/backend/RocksDBQuickFactory.cpp b/src/ripple/nodestore/backend/RocksDBQuickFactory.cpp index 2f6f15953..3936045ae 100644 --- a/src/ripple/nodestore/backend/RocksDBQuickFactory.cpp +++ b/src/ripple/nodestore/backend/RocksDBQuickFactory.cpp @@ -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* pObject) + fetch (void const* key, std::shared_ptr* pObject) override { pObject->reset (); @@ -257,7 +257,7 @@ public: } void - store (std::shared_ptr const& object) + store (std::shared_ptr 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 )> f) + for_each (std::function )> f) override { rocksdb::ReadOptions const options; @@ -336,7 +336,7 @@ public: } int - getWriteLoad () + getWriteLoad () override { return 0; } diff --git a/src/ripple/protocol/impl/STParsedJSON.cpp b/src/ripple/protocol/impl/STParsedJSON.cpp index c51945d77..728598406 100644 --- a/src/ripple/protocol/impl/STParsedJSON.cpp +++ b/src/ripple/protocol/impl/STParsedJSON.cpp @@ -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); } //------------------------------------------------------------------------------ diff --git a/src/ripple/protocol/impl/STVar.h b/src/ripple/protocol/impl/STVar.h index 6191b2620..e20bf8a37 100644 --- a/src/ripple/protocol/impl/STVar.h +++ b/src/ripple/protocol/impl/STVar.h @@ -127,7 +127,7 @@ make_stvar(Args&&... args) { STVar st; st.construct(std::forward(args)...); - return std::move(st); + return st; } inline diff --git a/src/ripple/rpc/impl/TransactionSign.cpp b/src/ripple/rpc/impl/TransactionSign.cpp index 50424af84..b117afeb5 100644 --- a/src/ripple/rpc/impl/TransactionSign.cpp +++ b/src/ripple/rpc/impl/TransactionSign.cpp @@ -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