mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Non-Linux linkers require a fallback implementation for when coverage is not enabled. The fallbacks are marked weak to have lower precedence than built-in implementations when available, removing ambiguity from the linker.
22 lines
762 B
C++
22 lines
762 B
C++
// Copyright (c) 2025-present The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <test/util/coverage.h>
|
|
|
|
#if defined(__clang__)
|
|
extern "C" __attribute__((weak)) void __llvm_profile_reset_counters(void);
|
|
extern "C" __attribute__((weak)) void __gcov_reset(void);
|
|
|
|
// Fallback implementations
|
|
extern "C" __attribute__((weak)) void __llvm_profile_reset_counters(void) {}
|
|
extern "C" __attribute__((weak)) void __gcov_reset(void) {}
|
|
|
|
void ResetCoverageCounters() {
|
|
// These will call the real ones if available, or our dummies if not
|
|
__llvm_profile_reset_counters();
|
|
__gcov_reset();
|
|
}
|
|
#else
|
|
void ResetCoverageCounters() {}
|
|
#endif
|