Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Update to C++ 17 #6896

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ include( InstallDirectoryPermissions )
include( MASSigning )

set( BLOCKCHAIN_NAME "EOSIO" )
set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_EXTENSIONS ON )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth turning this off? Seems like it compiles okay with it off

set( CXX_STANDARD_REQUIRED ON)

Expand Down
2 changes: 1 addition & 1 deletion libraries/fc
5 changes: 3 additions & 2 deletions libraries/wasm-jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
set(WAVM_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/Include)
include_directories(${WAVM_INCLUDE_DIR})
#
# Use C++11
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# Use C++11
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

# Compile with all warnings and fatal warnings
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
Expand All @@ -36,6 +36,7 @@ include_directories(${WAVM_INCLUDE_DIR})
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
# endif()

set(CMAKE_CXX_STANDARD 11)
option(WAVM_METRICS_OUTPUT "controls printing the timings of some operations to stdout" OFF)
if(WAVM_METRICS_OUTPUT)
add_definitions("-DWAVM_METRICS_OUTPUT=1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class se_wallet final : public wallet_api {
string create_key(string key_type) override;
bool remove_key(string key) override;

optional<signature_type> try_sign_digest(const digest_type digest, const public_key_type public_key) override;
fc::optional<signature_type> try_sign_digest(const digest_type digest, const public_key_type public_key) override;

private:
std::unique_ptr<detail::se_wallet_impl> my;
};

}}
}}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class soft_wallet final : public wallet_api

/* Attempts to sign a digest via the given public_key
*/
optional<signature_type> try_sign_digest( const digest_type digest, const public_key_type public_key ) override;
fc::optional<signature_type> try_sign_digest( const digest_type digest, const public_key_type public_key ) override;

std::shared_ptr<detail::soft_wallet_impl> my;
void encrypt_keys();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class wallet_api

/** Returns a signature given the digest and public_key, if this wallet can sign via that public key
*/
virtual optional<signature_type> try_sign_digest( const digest_type digest, const public_key_type public_key ) = 0;
virtual fc::optional<signature_type> try_sign_digest( const digest_type digest, const public_key_type public_key ) = 0;
};

}}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class yubihsm_wallet final : public wallet_api {
string create_key(string key_type) override;
bool remove_key(string key) override;

optional<signature_type> try_sign_digest(const digest_type digest, const public_key_type public_key) override;
fc::optional<signature_type> try_sign_digest(const digest_type digest, const public_key_type public_key) override;

private:
std::unique_ptr<detail::yubihsm_wallet_impl> my;
};

}}
}}
8 changes: 4 additions & 4 deletions plugins/wallet_plugin/se_wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ struct se_wallet_impl {
return pub;
}

optional<signature_type> try_sign_digest(const digest_type d, const public_key_type public_key) {
fc::optional<signature_type> try_sign_digest(const digest_type d, const public_key_type public_key) {
auto it = _keys.find(public_key);
if(it == _keys.end())
return optional<signature_type>{};
return fc::optional<signature_type>{};

fc::ecdsa_sig sig = ECDSA_SIG_new();
CFErrorRef error = nullptr;
Expand Down Expand Up @@ -370,8 +370,8 @@ bool se_wallet::remove_key(string key) {
return my->remove_key(key);
}

optional<signature_type> se_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) {
fc::optional<signature_type> se_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) {
return my->try_sign_digest(digest, public_key);
}

}}
}}
10 changes: 5 additions & 5 deletions plugins/wallet_plugin/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ class soft_wallet_impl

string get_wallet_filename() const { return _wallet_filename; }

optional<private_key_type> try_get_private_key(const public_key_type& id)const
fc::optional<private_key_type> try_get_private_key(const public_key_type& id)const
{
auto it = _keys.find(id);
if( it != _keys.end() )
return it->second;
return optional<private_key_type>();
return fc::optional<private_key_type>();
}

optional<signature_type> try_sign_digest( const digest_type digest, const public_key_type public_key ) {
fc::optional<signature_type> try_sign_digest( const digest_type digest, const public_key_type public_key ) {
auto it = _keys.find(public_key);
if( it == _keys.end() )
return optional<signature_type>{};
return fc::optional<signature_type>{};
return it->second.sign(digest);
}

Expand Down Expand Up @@ -401,7 +401,7 @@ private_key_type soft_wallet::get_private_key( public_key_type pubkey )const
return my->get_private_key( pubkey );
}

optional<signature_type> soft_wallet::try_sign_digest( const digest_type digest, const public_key_type public_key ) {
fc::optional<signature_type> soft_wallet::try_sign_digest( const digest_type digest, const public_key_type public_key ) {
return my->try_sign_digest(digest, public_key);
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/wallet_plugin/wallet_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ wallet_manager::sign_transaction(const chain::signed_transaction& txn, const fla
bool found = false;
for (const auto& i : wallets) {
if (!i.second->is_locked()) {
optional<signature_type> sig = i.second->try_sign_digest(stxn.sig_digest(id, stxn.context_free_data), pk);
fc::optional<signature_type> sig = i.second->try_sign_digest(stxn.sig_digest(id, stxn.context_free_data), pk);
if (sig) {
stxn.signatures.push_back(*sig);
found = true;
Expand All @@ -260,7 +260,7 @@ wallet_manager::sign_digest(const chain::digest_type& digest, const public_key_t
try {
for (const auto& i : wallets) {
if (!i.second->is_locked()) {
optional<signature_type> sig = i.second->try_sign_digest(digest, key);
fc::optional<signature_type> sig = i.second->try_sign_digest(digest, key);
if (sig)
return *sig;
}
Expand Down
6 changes: 3 additions & 3 deletions plugins/wallet_plugin/yubihsm_wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ struct yubihsm_wallet_impl {
});
}

optional<signature_type> try_sign_digest(const digest_type d, const public_key_type public_key) {
fc::optional<signature_type> try_sign_digest(const digest_type d, const public_key_type public_key) {
auto it = _keys.find(public_key);
if(it == _keys.end())
return optional<signature_type>{};
return fc::optional<signature_type>{};

size_t der_sig_sz = 128;
uint8_t der_sig[der_sig_sz];
Expand Down Expand Up @@ -265,7 +265,7 @@ bool yubihsm_wallet::remove_key(string key) {
return true;
}

optional<signature_type> yubihsm_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) {
fc::optional<signature_type> yubihsm_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) {
return my->try_sign_digest(digest, public_key);
}

Expand Down
8 changes: 4 additions & 4 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,14 @@ void print_action( const fc::variant& at ) {
}

//resolver for ABI serializer to decode actions in proposed transaction in multisig contract
auto abi_serializer_resolver = [](const name& account) -> optional<abi_serializer> {
static unordered_map<account_name, optional<abi_serializer> > abi_cache;
auto abi_serializer_resolver = [](const name& account) -> fc::optional<abi_serializer> {
static unordered_map<account_name, fc::optional<abi_serializer> > abi_cache;
auto it = abi_cache.find( account );
if ( it == abi_cache.end() ) {
auto result = call(get_abi_func, fc::mutable_variant_object("account_name", account));
auto abi_results = result.as<eosio::chain_apis::read_only::get_abi_results>();

optional<abi_serializer> abis;
fc::optional<abi_serializer> abis;
if( abi_results.abi.valid() ) {
abis.emplace( *abi_results.abi, abi_serializer_max_time );
} else {
Expand Down Expand Up @@ -480,7 +480,7 @@ void print_result( const fc::variant& result ) { try {
cerr << " us\n";

if( status == "failed" ) {
auto soft_except = processed["except"].as<optional<fc::exception>>();
auto soft_except = processed["except"].as<fc::optional<fc::exception>>();
if( soft_except ) {
edump((soft_except->to_detail_string()));
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ if [ "$ARCH" == "Linux" ]; then
;;
"Ubuntu")
FILE="${REPO_ROOT}/scripts/eosio_build_ubuntu.sh"
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
CXX_COMPILER=g++
C_COMPILER=gcc
;;
"Debian GNU/Linux")
FILE="${REPO_ROOT}/scripts/eosio_build_ubuntu.sh"
Expand Down