Skip to content

Commit 152ddb3

Browse files
author
MarcoFalke
committed
Merge #20180: test: Fix -Wunused-function warnings if configured --without-libs
76bbcc4 test: Fix -Wunused-function warning if configured --without-libs (Hennadii Stepanov) Pull request description: On master (80c8a02) compiling with gcc: ``` $ ./configure --without-libs $ make clean && make ... test/script_tests.cpp:1369:23: warning: ‘CScriptWitness script_tests::ScriptWitnessFromJSON(const UniValue&)’ defined but not used [-Wunused-function] 1369 | static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue) | ^~~~~~~~~~~~~~~~~~~~~ test/script_tests.cpp:1357:28: warning: ‘std::vector<CTxOut> script_tests::TxOutsFromJSON(const UniValue&)’ defined but not used [-Wunused-function] 1357 | static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue) | ^~~~~~~~~~~~~~ test/script_tests.cpp:1350:28: warning: ‘CMutableTransaction script_tests::TxFromHex(const string&)’ defined but not used [-Wunused-function] 1350 | static CMutableTransaction TxFromHex(const std::string& str) | ^~~~~~~~~ ... ``` This change is move-only (nice to review with `git diff --color-moved`). ACKs for top commit: practicalswift: ACK 76bbcc4: diff looks correct fanquake: ACK 76bbcc4 - verified that this fixes the warnings. As mentioned can be reviewed with `git diff HEAD~ --color-moved=dimmed_zebra`. Tree-SHA512: 7799ac190d1e3f15e38b36cfcd1f8d138be80cab6c6cfad8f7828e07deffc2037d52f1d967f7f233a3a8ed74eee184f5275076c2f364c3e363c77a1f40aa5030
2 parents 62af467 + 76bbcc4 commit 152ddb3

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/test/script_tests.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,36 +1347,6 @@ static CScript ScriptFromHex(const std::string& str)
13471347
return CScript(data.begin(), data.end());
13481348
}
13491349

1350-
static CMutableTransaction TxFromHex(const std::string& str)
1351-
{
1352-
CMutableTransaction tx;
1353-
VectorReader(SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, ParseHex(str), 0) >> tx;
1354-
return tx;
1355-
}
1356-
1357-
static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue)
1358-
{
1359-
assert(univalue.isArray());
1360-
std::vector<CTxOut> prevouts;
1361-
for (size_t i = 0; i < univalue.size(); ++i) {
1362-
CTxOut txout;
1363-
VectorReader(SER_DISK, 0, ParseHex(univalue[i].get_str()), 0) >> txout;
1364-
prevouts.push_back(std::move(txout));
1365-
}
1366-
return prevouts;
1367-
}
1368-
1369-
static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
1370-
{
1371-
assert(univalue.isArray());
1372-
CScriptWitness scriptwitness;
1373-
for (size_t i = 0; i < univalue.size(); ++i) {
1374-
auto bytes = ParseHex(univalue[i].get_str());
1375-
scriptwitness.stack.push_back(std::move(bytes));
1376-
}
1377-
return scriptwitness;
1378-
}
1379-
13801350
BOOST_AUTO_TEST_CASE(script_FindAndDelete)
13811351
{
13821352
// Exercise the FindAndDelete functionality
@@ -1502,6 +1472,36 @@ BOOST_AUTO_TEST_CASE(script_HasValidOps)
15021472

15031473
#if defined(HAVE_CONSENSUS_LIB)
15041474

1475+
static CMutableTransaction TxFromHex(const std::string& str)
1476+
{
1477+
CMutableTransaction tx;
1478+
VectorReader(SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, ParseHex(str), 0) >> tx;
1479+
return tx;
1480+
}
1481+
1482+
static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue)
1483+
{
1484+
assert(univalue.isArray());
1485+
std::vector<CTxOut> prevouts;
1486+
for (size_t i = 0; i < univalue.size(); ++i) {
1487+
CTxOut txout;
1488+
VectorReader(SER_DISK, 0, ParseHex(univalue[i].get_str()), 0) >> txout;
1489+
prevouts.push_back(std::move(txout));
1490+
}
1491+
return prevouts;
1492+
}
1493+
1494+
static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
1495+
{
1496+
assert(univalue.isArray());
1497+
CScriptWitness scriptwitness;
1498+
for (size_t i = 0; i < univalue.size(); ++i) {
1499+
auto bytes = ParseHex(univalue[i].get_str());
1500+
scriptwitness.stack.push_back(std::move(bytes));
1501+
}
1502+
return scriptwitness;
1503+
}
1504+
15051505
/* Test simple (successful) usage of bitcoinconsensus_verify_script */
15061506
BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_returns_true)
15071507
{

0 commit comments

Comments
 (0)