Page MenuHomePhabricator

Extend bilingual_str support for tinyformat
ClosedPublic

Authored by PiRK on Dec 15 2023, 12:26.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC58c73bcf68fb: Extend bilingual_str support for tinyformat
Summary

Previous bilingual_str tinyformat::format accepted bilingual format strings,
but not bilingual arguments. Extend it to accept both. This is useful when
embedding one translated string inside another translated string, for example:
strprintf(_("Error: %s"), message) which would fail previously if message
was a bilingual_str.

This is a partial backport of core#27150
https://github.com/bitcoin/bitcoin/pull/27150/commits/3db2874bd71d2391747b7385cabcbfef67218c4c


refactor: Avoid copy of bilingual_str when formatting, Fix ADL violation

The return type of TranslateArg is std::string, which creates a copy.
Fix this by moving everything into a lambda that takes a reference and
returns a reference.

Also, the format function is called without specifying the namespace it
lives in. Fix this by specifying the namespace. See also:
https://github.com/bitcoin/bitcoin/blob/7a59865793cd710d7d6650a6106ca4e790ced5d3/doc/developer-notes.md#L117-L137.

This is a backport of core#27892

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Tail of the build log:

../../src/wallet/salvage.cpp:84:19:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:1&, bool)> [with auto:1 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/salvage.cpp:132:24:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
[396/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[397/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[398/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[399/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/spend.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/spend.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -c ../../src/wallet/spend.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/./wallet/spend.h:10,
                 from ../../src/wallet/spend.cpp:5:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/spend.cpp:708:56:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
cc1plus: all warnings being treated as errors
[400/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[401/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[402/543] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[403/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[404/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[405/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[406/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[407/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -c ../../src/wallet/wallet.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/wallet/wallet.cpp:6:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2723:78:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]’
../../src/wallet/wallet.cpp:2741:29:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2869:61:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.
Build build-debug failed with exit code 1

Tail of the build log:

[346/483] Building C object src/secp256k1/CMakeFiles/verify-bench.dir/src/bench_verify.c.o
[347/483] Building C object src/secp256k1/CMakeFiles/sign-bench.dir/src/bench_sign.c.o
[348/483] Building C object src/secp256k1/CMakeFiles/secp256k1.dir/src/secp256k1.c.o
[349/483] Linking C static library src/secp256k1/libsecp256k1.a
[350/483] Linking C executable src/secp256k1/recover-bench
[351/483] Linking C executable src/secp256k1/verify-bench
[352/483] Linking C executable src/secp256k1/sign-bench
[353/483] Building CXX object src/CMakeFiles/server.dir/rpc/net.cpp.o
[354/483] Building CXX object src/CMakeFiles/bitcoind.dir/bitcoind.cpp.o
[355/483] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[356/483] Linking C executable src/secp256k1/ecmult-bench
[357/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[358/483] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[359/483] Linking C executable src/secp256k1/internal-bench
[360/483] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[361/483] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[362/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[363/483] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[364/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[365/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[366/483] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[367/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[368/483] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[369/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[370/483] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[371/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[372/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[373/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[374/483] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[375/483] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[376/483] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[377/483] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[378/483] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[379/483] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[380/483] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[381/483] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
FAILED: src/CMakeFiles/server.dir/validation.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/validation.cpp.o -MF src/CMakeFiles/server.dir/validation.cpp.o.d -o src/CMakeFiles/server.dir/validation.cpp.o -c ../../src/validation.cpp
In file included from ../../src/./util/result.h:9,
                 from ../../src/./txdb.h:14,
                 from ../../src/./node/blockstorage.h:15,
                 from ../../src/./validation.h:27,
                 from ../../src/validation.cpp:7:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]’
../../src/validation.cpp:6311:52:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]::<lambda(const auto:22&, bool)> [with auto:22 = int]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]’
../../src/validation.cpp:6311:52:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [50]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]’
../../src/validation.cpp:6311:52:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1

Tail of the build log:

../../src/wallet/salvage.cpp:84:19:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:1&, bool)> [with auto:1 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/salvage.cpp:132:24:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
[396/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[397/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[398/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[399/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[400/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/spend.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/spend.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -c ../../src/wallet/spend.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/./wallet/spend.h:10,
                 from ../../src/wallet/spend.cpp:5:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/spend.cpp:708:56:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
cc1plus: all warnings being treated as errors
[401/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[402/543] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[403/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[404/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[405/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[406/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -c ../../src/wallet/wallet.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/wallet/wallet.cpp:6:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2723:78:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]’
../../src/wallet/wallet.cpp:2741:29:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2869:61:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
[407/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1

testing with maybe-unused (I cannot reproduce the error locally)

Tail of the build log:

../../src/wallet/salvage.cpp:84:19:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:1&, bool)> [with auto:1 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/salvage.cpp:132:24:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
[398/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/spend.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/spend.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -c ../../src/wallet/spend.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/./wallet/spend.h:10,
                 from ../../src/wallet/spend.cpp:5:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/spend.cpp:708:56:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
cc1plus: all warnings being treated as errors
[399/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[400/545] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[401/545] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[402/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[403/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[404/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[405/545] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[406/545] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[407/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[408/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[409/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -c ../../src/wallet/wallet.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/wallet/wallet.cpp:6:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2723:78:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]’
../../src/wallet/wallet.cpp:2741:29:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2869:61:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.
Build build-debug failed with exit code 1

Tail of the build log:

[498/608] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[499/608] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[500/608] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[501/608] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[502/608] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[503/608] Building CXX object src/CMakeFiles/bitcoinkernel.dir/net.cpp.o
FAILED: src/CMakeFiles/bitcoinkernel.dir/net.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_ALL_NO_LIB -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_CONFIG_H -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -I../../src/leveldb/helpers/memenv -Isrc -Isrc/crypto/.. -I../../src/univalue/include -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/CMakeFiles/bitcoinkernel.dir/net.cpp.o -MF src/CMakeFiles/bitcoinkernel.dir/net.cpp.o.d -o src/CMakeFiles/bitcoinkernel.dir/net.cpp.o -c ../../src/net.cpp
In file included from ../../src/./util/result.h:9,
                 from ../../src/./txdb.h:14,
                 from ../../src/./node/blockstorage.h:15,
                 from ../../src/./validation.h:28,
                 from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/net.cpp:10:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/net.cpp:2724:32:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/net.cpp:2765:67:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/net.cpp:2765:67:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/net.cpp:2769:79:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
[504/608] Building CXX object src/CMakeFiles/bitcoinkernel.dir/validation.cpp.o
FAILED: src/CMakeFiles/bitcoinkernel.dir/validation.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_ALL_NO_LIB -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_CONFIG_H -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -I../../src/leveldb/helpers/memenv -Isrc -Isrc/crypto/.. -I../../src/univalue/include -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/CMakeFiles/bitcoinkernel.dir/validation.cpp.o -MF src/CMakeFiles/bitcoinkernel.dir/validation.cpp.o.d -o src/CMakeFiles/bitcoinkernel.dir/validation.cpp.o -c ../../src/validation.cpp
In file included from ../../src/./util/result.h:9,
                 from ../../src/./txdb.h:14,
                 from ../../src/./node/blockstorage.h:15,
                 from ../../src/./validation.h:28,
                 from ../../src/validation.cpp:7:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]’
../../src/validation.cpp:6427:52:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]::<lambda(const auto:22&, bool)> [with auto:22 = int]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]’
../../src/validation.cpp:6427:52:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [50]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12], int, int, int, char [50]}]’
../../src/validation.cpp:6427:52:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1

Tail of the build log:

../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {int}]::<lambda(const auto:1&, bool)> [with auto:1 = int]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {int}]’
../../src/wallet/salvage.cpp:84:19:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:1&, bool)> [with auto:1 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/salvage.cpp:132:24:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
[400/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[401/545] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[402/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/spend.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/spend.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/spend.cpp.o -c ../../src/wallet/spend.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/./wallet/spend.h:10,
                 from ../../src/wallet/spend.cpp:5:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/spend.cpp:708:56:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
cc1plus: all warnings being treated as errors
[403/545] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[404/545] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[405/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[406/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[407/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[408/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o -c ../../src/wallet/wallet.cpp
In file included from ../../src/./wallet/wallet.h:21,
                 from ../../src/wallet/wallet.cpp:6:
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2723:78:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
   47 |         [](const auto& arg, bool translated) -> const auto& {
      |                             ~~~~~^~~~~~~~~~
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [12]}]’
../../src/wallet/wallet.cpp:2736:41:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]::<lambda(const auto:22&, bool)> [with auto:22 = char [12]]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {char [12]}]’
../../src/wallet/wallet.cpp:2741:29:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
../../src/./util/translation.h: In instantiation of ‘tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]::<lambda(const auto:22&, bool)> [with auto:22 = std::__cxx11::basic_string<char>]’:
../../src/./util/translation.h:55:48:   required from ‘bilingual_str tinyformat::format(const bilingual_str&, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
../../src/wallet/wallet.cpp:2869:61:   required from here
../../src/./util/translation.h:47:34: error: parameter ‘translated’ set but not used [-Werror=unused-but-set-parameter]
cc1plus: all warnings being treated as errors
[409/545] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1

add maybe_unused back, it is definitely needed for 3 of the CI jobs

PiRK published this revision for review.Mar 11 2024, 11:16
src/util/translation.h
43 ↗(On Diff #46086)

Without this, the linted result would be

namespace tinyformat {
template <typename... Args>
bilingual_str format(const bilingual_str &fmt, const Args &...args) {
    const auto translate_arg{
        [](const auto &arg, [[maybe_unused]] bool translated)
            -> const auto &{
                if constexpr (std::is_same_v<decltype(arg),
                                             const bilingual_str &>){
                    return translated ? arg.translated : arg.original;
}
else {
    return arg;
}
} // namespace tinyformat
}
;
return bilingual_str{tfm::format(fmt.original, translate_arg(args, false)...),
                     tfm::format(fmt.translated, translate_arg(args, true)...)};
}
} // namespace tinyformat
Fabien requested changes to this revision.Mar 12 2024, 08:45
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/util/translation.h
58 ↗(On Diff #46086)

If you disable clang-format, at least make the code style consistent with the other code in the repo, e.g. bilingual_str& fmt => bilingual_str &fmt

This revision now requires changes to proceed.Mar 12 2024, 08:45

make code style consistent with the rest of the codebase

This revision is now accepted and ready to land.Mar 12 2024, 10:26
This revision was automatically updated to reflect the committed changes.