Skip to content

Commit fafd725

Browse files
author
MarcoFalke
committed
Merge bitcoin#19846: build: enable unused member function diagnostic
819d03b refactor: took out unused member functions (Zero) ed69213 build: enable unused member function diagnostic (Zero) Pull request description: This PR enables the `-Wunused-member-function` compiler diagnostic, as discussed in bitcoin#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`. (ed69213) - [x] Resolve the reported warnings. (819d03b) 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 bitcoin#19702. ACKs for top commit: practicalswift: ACK 819d03b - patch still looks correct :) MarcoFalke: ACK 819d03b pox: Tested ACK 819d03b with clang after `make clean`. No unused member function warnings. theStack: tested ACK 819d03b Tree-SHA512: 5fdfbbb02b3dc618a90a874a5caa5e01e596fc1d14a209e75a6981f01b253f9bca0cfac8fdd758dd7151986609fb76571c3745124a29cfd4f8cbb8d82a07272e
2 parents 34322b7 + 819d03b commit fafd725

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

Diff for: configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
423423
AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]])
424424
AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]])
425425
AX_CHECK_COMPILE_FLAG([-Wunused-variable],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"],,[[$CXXFLAG_WERROR]])
426+
AX_CHECK_COMPILE_FLAG([-Wunused-member-function],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-member-function"],,[[$CXXFLAG_WERROR]])
426427
AX_CHECK_COMPILE_FLAG([-Wdate-time],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"],,[[$CXXFLAG_WERROR]])
427428
AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]])
428429
AX_CHECK_COMPILE_FLAG([-Wsign-compare],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsign-compare"],,[[$CXXFLAG_WERROR]])

Diff for: src/index/blockfilterindex.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ struct DBVal {
5151
struct DBHeightKey {
5252
int height;
5353

54-
DBHeightKey() : height(0) {}
5554
explicit DBHeightKey(int height_in) : height(height_in) {}
5655

5756
template<typename Stream>

Diff for: src/script/bitcoinconsensus.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ namespace {
1616
class TxInputStream
1717
{
1818
public:
19-
TxInputStream(int nTypeIn, int nVersionIn, const unsigned char *txTo, size_t txToLen) :
20-
m_type(nTypeIn),
19+
TxInputStream(int nVersionIn, const unsigned char *txTo, size_t txToLen) :
2120
m_version(nVersionIn),
2221
m_data(txTo),
2322
m_remaining(txToLen)
@@ -47,9 +46,7 @@ class TxInputStream
4746
}
4847

4948
int GetVersion() const { return m_version; }
50-
int GetType() const { return m_type; }
5149
private:
52-
const int m_type;
5350
const int m_version;
5451
const unsigned char* m_data;
5552
size_t m_remaining;
@@ -84,7 +81,7 @@ static int verify_script(const unsigned char *scriptPubKey, unsigned int scriptP
8481
return set_error(err, bitcoinconsensus_ERR_INVALID_FLAGS);
8582
}
8683
try {
87-
TxInputStream stream(SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen);
84+
TxInputStream stream(PROTOCOL_VERSION, txTo, txToLen);
8885
CTransaction tx(deserialize, stream);
8986
if (nIn >= tx.vin.size())
9087
return set_error(err, bitcoinconsensus_ERR_TX_INDEX);

Diff for: src/test/util_tests.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -2014,12 +2014,6 @@ struct Tracker
20142014
copies = t.copies + 1;
20152015
return *this;
20162016
}
2017-
Tracker& operator=(Tracker&& t) noexcept
2018-
{
2019-
origin = t.origin;
2020-
copies = t.copies;
2021-
return *this;
2022-
}
20232017
};
20242018

20252019
}

0 commit comments

Comments
 (0)