Merge #19846: build: enable unused member function diagnostic

819d03b932134ee91df3b0fe98a481a331ce57bf refactor: took out unused member functions (Zero)
ed69213c2b2a99023bdee5168614cb8b71990f5f build: enable unused member function diagnostic (Zero)

Pull request description:

  This PR enables the `-Wunused-member-function` compiler diagnostic, as discussed in #19702.

  > **Notice**: The `unused-member-function` diagnostic is only available on clang. Therefore, clang should be used to test this PR.

  - [x] Include the `-Wunused-member-function`diagnostic in `./configure.ac`. (ed69213c2b2a99023bdee5168614cb8b71990f5f)
  - [x] Resolve the reported warnings. (819d03b932134ee91df3b0fe98a481a331ce57bf)

  Currently, enabling this flag no longer reports the following warnings:

  > **Note**: output from `make 2>&1 | grep "warning: unused member function" | sort | uniq -c`

  ```
  1 index/blockfilterindex.cpp:54:5: warning: unused member function 'DBHeightKey' [-Wunused-member-function]
  2 script/bitcoinconsensus.cpp:50:9: warning: unused member function 'GetType' [-Wunused-member-function]
  1 test/util_tests.cpp:1975:14: warning: unused member function 'operator=' [-Wunused-member-function]
  ```

  All tests have passed locally (from `make check` & `src/test/test_bitcoin`).

  This PR closes #19702.

ACKs for top commit:
  practicalswift:
    ACK 819d03b932134ee91df3b0fe98a481a331ce57bf - patch still looks correct :)
  MarcoFalke:
    ACK 819d03b932134ee91df3b0fe98a481a331ce57bf
  pox:
    Tested ACK 819d03b932134ee91df3b0fe98a481a331ce57bf with clang after `make clean`. No unused member function warnings.
  theStack:
    tested ACK 819d03b932134ee91df3b0fe98a481a331ce57bf

Tree-SHA512: 5fdfbbb02b3dc618a90a874a5caa5e01e596fc1d14a209e75a6981f01b253f9bca0cfac8fdd758dd7151986609fb76571c3745124a29cfd4f8cbb8d82a07272e
This commit is contained in:
MarcoFalke 2021-01-05 12:05:39 +01:00 committed by pasta
parent 3d6cc69131
commit 5ac7ca1296
4 changed files with 3 additions and 12 deletions

View File

@ -440,6 +440,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunused-variable],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wunused-variable],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunused-member-function],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-member-function"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wdate-time],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wdate-time],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]], AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]],

View File

@ -57,7 +57,6 @@ struct DBVal {
struct DBHeightKey { struct DBHeightKey {
int height; int height;
DBHeightKey() : height(0) {}
explicit DBHeightKey(int height_in) : height(height_in) {} explicit DBHeightKey(int height_in) : height(height_in) {}
template<typename Stream> template<typename Stream>

View File

@ -16,8 +16,7 @@ namespace {
class TxInputStream class TxInputStream
{ {
public: public:
TxInputStream(int nTypeIn, int nVersionIn, const unsigned char *txTo, size_t txToLen) : TxInputStream(int nVersionIn, const unsigned char *txTo, size_t txToLen) :
m_type(nTypeIn),
m_version(nVersionIn), m_version(nVersionIn),
m_data(txTo), m_data(txTo),
m_remaining(txToLen) m_remaining(txToLen)
@ -47,9 +46,7 @@ public:
} }
int GetVersion() const { return m_version; } int GetVersion() const { return m_version; }
int GetType() const { return m_type; }
private: private:
const int m_type;
const int m_version; const int m_version;
const unsigned char* m_data; const unsigned char* m_data;
size_t m_remaining; size_t m_remaining;
@ -84,7 +81,7 @@ int dashconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int
return set_error(err, dashconsensus_ERR_INVALID_FLAGS); return set_error(err, dashconsensus_ERR_INVALID_FLAGS);
} }
try { try {
TxInputStream stream(SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen); TxInputStream stream(PROTOCOL_VERSION, txTo, txToLen);
CTransaction tx(deserialize, stream); CTransaction tx(deserialize, stream);
if (nIn >= tx.vin.size()) if (nIn >= tx.vin.size())
return set_error(err, dashconsensus_ERR_TX_INDEX); return set_error(err, dashconsensus_ERR_TX_INDEX);

View File

@ -1257,12 +1257,6 @@ struct Tracker
copies = t.copies + 1; copies = t.copies + 1;
return *this; return *this;
} }
Tracker& operator=(Tracker&& t) noexcept
{
origin = t.origin;
copies = t.copies;
return *this;
}
}; };
} }