Page MenuHomePhabricator

Do not hide compile-time thread safety warnings
ClosedPublic

Authored by PiRK on Sep 20 2021, 10:26.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC52376cedeae6: Do not hide compile-time thread safety warnings
Summary
Test Plan

With TSAN:
ninja check check-functional

Event Timeline

PiRK requested review of this revision.Sep 20 2021, 10:26

Tail of the build log:

[338/509] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[339/509] Building C object src/secp256k1/CMakeFiles/secp256k1.dir/src/secp256k1.c.o
[340/509] Linking C static library src/secp256k1/libsecp256k1.a
[341/509] Linking CXX static library src/libbitcoinconsensus.a
[342/509] Linking C executable src/secp256k1/ecmult-bench
[343/509] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[344/509] Linking C executable src/secp256k1/sign-bench
[345/509] Linking C executable src/secp256k1/internal-bench
[346/509] Linking C executable src/secp256k1/verify-bench
[347/509] Building CXX object src/CMakeFiles/script.dir/script/descriptor.cpp.o
[348/509] Linking C executable src/secp256k1/recover-bench
[349/509] Installing component secp256k1
-- Install configuration: "RelWithDebInfo"
-- Install component: "secp256k1"
-- Installing: /results/artifacts/lib/libsecp256k1.a
-- Installing: /results/artifacts/include/secp256k1.h
-- Installing: /results/artifacts/include/secp256k1_preallocated.h
-- Installing: /results/artifacts/include/secp256k1_recovery.h
-- Installing: /results/artifacts/include/secp256k1_schnorr.h
[350/509] Linking CXX static library src/libscript.a
[351/509] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[352/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[353/509] Linking CXX static library src/libcommon.a
[354/509] Linking CXX shared library src/libbitcoinconsensus.so.0.24.2
[355/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[356/509] Creating library symlink src/libbitcoinconsensus.so.0 src/libbitcoinconsensus.so
[357/509] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[358/509] Linking CXX executable src/bitcoin-cli
[359/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[360/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[361/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[362/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[363/509] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[364/509] Linking CXX executable src/bitcoin-tx
[365/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[366/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[367/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[368/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[369/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[370/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[371/509] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[372/509] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[373/509] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[374/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[375/509] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[376/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[377/509] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[378/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[379/509] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[380/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/__/interfaces/wallet.cpp.o
[381/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[382/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[383/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcdump.cpp.o
[384/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[385/509] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[386/509] Linking CXX static library src/wallet/libwallet.a
[387/509] Linking CXX static library src/wallet/libwallet-tool.a
[388/509] Linking CXX executable src/bitcoin-wallet
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1
PiRK planned changes to this revision.Sep 20 2021, 10:42

fix build-clang

try adding annotation in function declaration in addition to run-time asserts in function definition

The error was

[10:37:19]
[Step 1/1] FAILED: src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[10:37:19]
[Step 1/1] /usr/bin/ccache /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -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-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/avalanche/processor.cpp.o -MF src/CMakeFiles/server.dir/avalanche/processor.cpp.o.d -o src/CMakeFiles/server.dir/avalanche/processor.cpp.o -c ../../src/avalanche/processor.cpp
[10:37:19]
[Step 1/1] ../../src/avalanche/processor.cpp:42:30: error: calling function 'IsBlockFinalized' requires holding mutex 'cs_main' exclusively [-Werror,-Wthread-safety-analysis]
[10:37:19]
[Step 1/1]     if (::ChainstateActive().IsBlockFinalized(pindex)) {
[10:37:19]
[Step 1/1]                              ^
[10:37:19]
[Step 1/1] 1 error generated.
This revision is now accepted and ready to land.Sep 22 2021, 07:02