Skip to content

Commit

Permalink
ticket-1508 skaled build is cleaned from all the possible warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiy-skalelabs committed May 4, 2023
1 parent 2cee896 commit e1a519a
Show file tree
Hide file tree
Showing 30 changed files with 166 additions and 15 deletions.
2 changes: 2 additions & 0 deletions libdevcore/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@

#pragma warning( push )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wpessimizing-move"
#include <boost/multiprecision/cpp_int.hpp>
#pragma warning( pop )
#pragma GCC diagnostic pop
Expand Down
10 changes: 10 additions & 0 deletions libdevcore/FixedHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ class SecureFixedHash : private FixedHash< T > {
using FixedHash< T >::operator<=;
using FixedHash< T >::operator>;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

// The obvious binary operators.
SecureFixedHash& operator^=( FixedHash< T > const& _c ) {
static_cast< FixedHash< T >& >( *this ).operator^=( _c );
Expand Down Expand Up @@ -444,19 +447,26 @@ class SecureFixedHash : private FixedHash< T > {
return static_cast< SecureFixedHash const& >( r );
}

#pragma GCC diagnostic pop

using FixedHash< T >::abridged;
using FixedHash< T >::abridgedMiddle;

bytesConstRef ref() const { return FixedHash< T >::ref(); }
_byte_ const* data() const { return FixedHash< T >::data(); }

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

static SecureFixedHash< T > random() {
SecureFixedHash< T > ret;
ret.randomize( s_fixedHashEngine );
return ret;
}
using FixedHash< T >::firstBitSet;

#pragma GCC diagnostic pop

void clear() { ref().cleanse(); }
};

Expand Down
1 change: 1 addition & 0 deletions libdevcore/Guards.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#pragma warning( push )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <boost/thread.hpp>
#pragma warning( pop )
#pragma GCC diagnostic pop
Expand Down
5 changes: 5 additions & 0 deletions libdevcore/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@

#include <libdevcore/microprofile.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

#include <boost/core/null_deleter.hpp>
#include <boost/log/attributes/clock.hpp>
#include <boost/log/attributes/function.hpp>
Expand All @@ -39,6 +42,8 @@
#include <boost/log/support/date_time.hpp>
#include <boost/log/utility/exception_handler.hpp>

#pragma GCC diagnostic pop

#include <skutils/console_colors.h>

#include <chrono>
Expand Down
5 changes: 5 additions & 0 deletions libdevcore/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@
#include <string>
#include <vector>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

#include <boost/log/attributes/scoped_attribute.hpp>
#include <boost/log/sources/global_logger_storage.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/sources/severity_channel_logger.hpp>

#pragma GCC diagnostic pop

#include <skutils/console_colors.h>

namespace dev {
Expand Down
5 changes: 5 additions & 0 deletions libdevcore/SHA3.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ inline h256 sha3( bytesConstRef _input ) noexcept {
return ret;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

inline SecureFixedHash< 32 > sha3Secure( bytesConstRef _input ) noexcept {
SecureFixedHash< 32 > ret;
sha3( _input, ret.writable().ref() );
return ret;
}

#pragma GCC diagnostic pop

/// Calculate SHA3-256 hash of the given input, returning as a 256-bit hash.
inline h256 sha3( bytes const& _input ) noexcept {
return sha3( bytesConstRef( &_input ) );
Expand Down
5 changes: 5 additions & 0 deletions libdevcore/StatusAndControl.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#ifndef STATUSANDCONTROL_H
#define STATUSANDCONTROL_H

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

#include <boost/filesystem.hpp>

#pragma GCC diagnostic pop

#include <array>
#include <iostream>
#include <map>
Expand Down
5 changes: 5 additions & 0 deletions libdevcrypto/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,17 @@ bytesSec dev::scrypt( std::string const& _pass, bytes const& _salt, uint64_t _n,
return ret;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

KeyPair::KeyPair( Secret const& _sec ) : m_secret( _sec ), m_public( toPublic( _sec ) ) {
// Assign address only if the secret key is valid.
if ( m_public )
m_address = toAddress( m_public );
}

#pragma GCC diagnostic pop

KeyPair KeyPair::create() {
while ( true ) {
KeyPair keyPair( Secret::random() );
Expand Down
4 changes: 4 additions & 0 deletions libethcore/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ class Signal {
template < class... Args >
using Handler = std::shared_ptr< typename Signal< Args... >::HandlerAux >;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

struct TransactionSkeleton {
bool creation = false;
Address from;
Expand All @@ -223,6 +226,7 @@ struct TransactionSkeleton {
static uint64_t howMany() { return Counter< TransactionSkeleton >::howMany(); }
};

#pragma GCC diagnostic pop

void badBlock( bytesConstRef _header, std::string const& _err );
inline void badBlock( bytes const& _header, std::string const& _err ) {
Expand Down
5 changes: 5 additions & 0 deletions libethcore/CommonJS.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ inline Public jsToPublic( std::string const& _s ) {
return jsToFixed< sizeof( dev::Public ) >( _s );
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

/// Leniently convert string to Secret (h256). Accepts integers, "0x" prefixing, non-exact length.
inline Secret jsToSecret( std::string const& _s ) {
h256 d = jsToFixed< sizeof( dev::Secret ) >( _s );
Expand All @@ -47,6 +50,8 @@ inline Secret jsToSecret( std::string const& _s ) {
return ret;
}

#pragma GCC diagnostic pop

/// Leniently convert string to Address (h160). Accepts integers, "0x" prefixing, non-exact length.
inline Address jsToAddress( std::string const& _s ) {
return eth::toAddress( _s );
Expand Down
5 changes: 5 additions & 0 deletions libethcore/Counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
namespace dev {
namespace eth {

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"

template < typename T >
class Counter {
public:
Expand All @@ -23,5 +26,7 @@ class Counter {
template < typename T >
std::atomic_uint64_t Counter< T >::count = 0;

#pragma GCC diagnostic pop

} // namespace eth
} // namespace dev
5 changes: 5 additions & 0 deletions libethcore/LogEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

#pragma once

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

#include "Common.h"

#include <libdevcore/Address.h>
Expand Down Expand Up @@ -95,3 +98,5 @@ inline LogBloom bloom( LogEntries const& _logs ) {

} // namespace eth
} // namespace dev

#pragma GCC diagnostic pop
5 changes: 5 additions & 0 deletions libethcore/TransactionBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

#pragma once

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

#include <libdevcore/RLP.h>
#include <libdevcore/SHA3.h>
#include <libdevcrypto/Common.h>
Expand Down Expand Up @@ -311,3 +314,5 @@ inline std::ostream& operator<<( std::ostream& _out, TransactionBase const& _t )

} // namespace eth
} // namespace dev

#pragma GCC diagnostic pop
21 changes: 20 additions & 1 deletion libethereum/Account.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@ namespace eth {
// global roots through the program


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

class StorageRoot : public h256 {
public:
StorageRoot( const u256& _value ) : h256( _value ) {}

StorageRoot( const StorageRoot& _value ) : h256( _value ){};
};

#pragma GCC diagnostic pop

class GlobalRoot : public h256 {
public:
GlobalRoot( const u256& _value ) : h256( _value ) {}
Expand All @@ -53,6 +58,9 @@ class GlobalRoot : public h256 {
};


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

/**
* Models the state of a single Ethereum account.
* Used to cache a portion of the full Ethereum state. State keeps a mapping of Address's to
Expand Down Expand Up @@ -123,6 +131,9 @@ class Account {
}


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

/// Kill this account. Useful for the suicide opcode. Following this call, isAlive() returns
/// false.
void kill() {
Expand All @@ -136,6 +147,8 @@ class Account {
changed();
}

#pragma GCC diagnostic pop

/// @returns true iff this object represents an account in the state. Returns false if this
/// object represents an account that should no longer exist in the trie (an account that never
/// existed or was suicided).
Expand Down Expand Up @@ -183,6 +196,9 @@ class Account {
/// @returns the storage overlay as a simple hash map.
std::unordered_map< u256, u256 > const& storageOverlay() const { return m_storageOverlay; }

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

/// Set a key/value pair in the account's storage. This actually goes into the overlay, for
/// committing to the trie later.
void setStorage( u256 _p, u256 _v ) {
Expand All @@ -197,7 +213,6 @@ class Account {
changed();
}


/// Set a key/value pair in the account's storage to a value that is already present inside the
/// database.
void setStorageCache( u256 _p, u256 _v ) const {
Expand All @@ -211,6 +226,8 @@ class Account {
changed();
}

#pragma GCC diagnostic pop

/// @returns the hash of the account's code.
h256 codeHash() const { return m_codeHash; }

Expand Down Expand Up @@ -315,6 +332,8 @@ class Account {
static uint64_t howMany() { return Counter< Account >::howMany(); }
};

#pragma GCC diagnostic pop

class AccountMask {
public:
AccountMask( bool _all = false )
Expand Down
5 changes: 5 additions & 0 deletions libethereum/BlockDetails.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#pragma once

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

#include "TransactionReceipt.h"
#include <libdevcore/Log.h>
#include <libdevcore/RLP.h>
Expand Down Expand Up @@ -165,3 +168,5 @@ static const BlocksBlooms NullBlocksBlooms;

} // namespace eth
} // namespace dev

#pragma GCC diagnostic pop
2 changes: 1 addition & 1 deletion libethereum/Precompiled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ ETH_REGISTER_PRECOMPILED( getBlockRandom )( bytesConstRef ) {
return { false, response }; // 1st false - means bad error occur
}

ETH_REGISTER_PRECOMPILED( addBalance )( bytesConstRef _in ) {
ETH_REGISTER_PRECOMPILED( addBalance )( [[maybe_unused]] bytesConstRef _in ) {
/*
try {
auto rawAddress = _in.cropped( 0, 20 ).toBytes();
Expand Down
2 changes: 1 addition & 1 deletion libethereum/SkaleHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void ConsensusExtImpl::terminateApplication() {

SkaleHost::SkaleHost( dev::eth::Client& _client, const ConsensusFactory* _consFactory,
std::shared_ptr< InstanceMonitor > _instanceMonitor, const std::string& _gethURL,
bool _broadcastEnabled )
[[maybe_unused]] bool _broadcastEnabled )
: m_client( _client ),
m_tq( _client.m_tq ),
m_instanceMonitor( _instanceMonitor ),
Expand Down
6 changes: 6 additions & 0 deletions libethereum/TransactionQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,11 @@ void TransactionQueue::insertCurrent_WITH_LOCK( std::pair< h256, Transaction > c
auto inserted = m_currentByAddressAndNonce[t.from()].insert(
std::make_pair( t.nonce(), PriorityQueue::iterator() ) );
PriorityQueue::iterator handle = m_current.emplace( VerifiedTransaction( t ) );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
inserted.first->second = handle;
m_currentByHash[_p.first] = handle;
#pragma GCC diagnostic pop

// Move following transactions from future to current
makeCurrent_WITH_LOCK( t );
Expand Down Expand Up @@ -394,8 +397,11 @@ void TransactionQueue::makeCurrent_WITH_LOCK( Transaction const& _t ) {
auto inserted = m_currentByAddressAndNonce[_t.from()].insert(
std::make_pair( ft->second.transaction.nonce(), PriorityQueue::iterator() ) );
PriorityQueue::iterator handle = m_current.emplace( move( ft->second ) );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
inserted.first->second = handle;
m_currentByHash[( *handle ).transaction.sha3()] = handle;
#pragma GCC diagnostic pop
--m_futureSize;
++ft;
++nonce;
Expand Down
5 changes: 5 additions & 0 deletions libethereum/TransactionReceipt.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#pragma once

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"

#include <libdevcore/RLP.h>
#include <libethcore/Common.h>
#include <libethcore/Counter.h>
Expand Down Expand Up @@ -139,3 +142,5 @@ class LocalisedTransactionReceipt : public TransactionReceipt {

} // namespace eth
} // namespace dev

#pragma GCC diagnostic pop
Loading

0 comments on commit e1a519a

Please sign in to comment.