11diff --git a/src/bench/bench.h b/src/bench/bench.h
2- index 17535e4e8..90f9c8ab7 100644
2+ index 63e1bf67e2..358dd663f8 100644
33--- a/src/bench/bench.h
44+++ b/src/bench/bench.h
5- @@ -65 ,6 +65 ,6 @@ public:
5+ @@ -77 ,6 +77 ,6 @@ public:
66
7- // BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo", foo);
8- #define BENCHMARK(n) \
9- - benchmark::BenchRunner PASTE2(bench_, PASTE2(__LINE__, n))(STRINGIZE(n), n);
10- + benchmark::BenchRunner PASTE2(bench_, PASTE2(0, n))(STRINGIZE(n), n);
7+ // BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo", foo, priority_level );
8+ #define BENCHMARK(n, priority_level ) \
9+ - benchmark::BenchRunner PASTE2(bench_, PASTE2(__LINE__, n))(STRINGIZE(n), n, priority_level );
10+ + benchmark::BenchRunner PASTE2(bench_, PASTE2(0, n))(STRINGIZE(n), n, priority_level );
1111
1212 #endif // BITCOIN_BENCH_BENCH_H
1313diff --git a/src/clientversion.cpp b/src/clientversion.cpp
14- index 192e9c52b..e25705962 100644
14+ index 192e9c52bc..e257059624 100644
1515--- a/src/clientversion.cpp
1616+++ b/src/clientversion.cpp
1717@@ -53,7 +53,7 @@ static std::string FormatVersion(int nVersion)
@@ -24,7 +24,7 @@ index 192e9c52b..e25705962 100644
2424 }
2525
2626diff --git a/src/compat/assumptions.h b/src/compat/assumptions.h
27- index 92615b582..611894be1 100644
27+ index 92615b582a..611894be19 100644
2828--- a/src/compat/assumptions.h
2929+++ b/src/compat/assumptions.h
3030@@ -13,9 +13,6 @@
@@ -38,20 +38,20 @@ index 92615b582..611894be1 100644
3838 // Assumption: We assume a C++17 (ISO/IEC 14882:2017) compiler (minimum requirement).
3939 // Example(s): We assume the presence of C++17 features everywhere :-)
4040diff --git a/src/logging.h b/src/logging.h
41- index ae8cad906..0222526f8 100644
41+ index 14a0f08f8d..32d4b7c708 100644
4242--- a/src/logging.h
4343+++ b/src/logging.h
44- @@ -187 ,7 +187 ,7 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
44+ @@ -230 ,7 +230 ,7 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
4545 }
4646 }
4747
48- - #define LogPrintf( ...) LogPrintf_(__func__, __FILE__, __LINE__, __VA_ARGS__)
49- + #define LogPrintf( ...) LogPrintf_(__func__, __FILE__, 0, __VA_ARGS__)
48+ - #define LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, __LINE__, category, level , __VA_ARGS__)
49+ + #define LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, 0, category, level , __VA_ARGS__)
5050
51- // Use a macro instead of a function for conditional logging to prevent
52- // evaluating arguments when logging for the category is not enabled.
51+ // Log unconditionally.
52+ #define LogPrintf(...) LogPrintLevel_(BCLog::LogFlags::NONE, BCLog::Level::None, __VA_ARGS__)
5353diff --git a/src/rest.cpp b/src/rest.cpp
54- index 22b5d2e07..4d783accb 100644
54+ index a10d8a433f..48736c9b9d 100644
5555--- a/src/rest.cpp
5656+++ b/src/rest.cpp
5757@@ -87,7 +87,7 @@ static NodeContext* GetNodeContext(const std::any& context, HTTPRequest* req)
@@ -73,44 +73,48 @@ index 22b5d2e07..4d783accb 100644
7373 }
7474 return node_context->chainman.get();
7575diff --git a/src/sync.h b/src/sync.h
76- index a17592611..c0aa8a672 100644
76+ index 1f4e191214..88d4ade0a0 100644
7777--- a/src/sync.h
7878+++ b/src/sync.h
79- @@ -129,11 +129,11 @@ using RecursiveMutex = AnnotatedMixin<std::recursive_mutex >;
80- /** Wrapped mutex: supports waiting but not recursive locking */
81- using Mutex = AnnotatedMixin<std::mutex> ;
79+ @@ -140,12 +140,12 @@ using Mutex = AnnotatedMixin<std::mutex >;
80+ */
81+ class GlobalMutex : public Mutex { } ;
8282
8383- #define AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)
8484+ #define AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, 0, &cs)
8585
8686 inline void AssertLockNotHeldInline(const char* name, const char* file, int line, Mutex* cs) EXCLUSIVE_LOCKS_REQUIRED(!cs) { AssertLockNotHeldInternal(name, file, line, cs); }
8787 inline void AssertLockNotHeldInline(const char* name, const char* file, int line, RecursiveMutex* cs) LOCKS_EXCLUDED(cs) { AssertLockNotHeldInternal(name, file, line, cs); }
88+ inline void AssertLockNotHeldInline(const char* name, const char* file, int line, GlobalMutex* cs) LOCKS_EXCLUDED(cs) { AssertLockNotHeldInternal(name, file, line, cs); }
8889- #define AssertLockNotHeld(cs) AssertLockNotHeldInline(#cs, __FILE__, __LINE__, &cs)
8990+ #define AssertLockNotHeld(cs) AssertLockNotHeldInline(#cs, __FILE__, 0, &cs)
9091
91- /** Wrapper around std::unique_lock style lock for Mutex . */
92- template <typename Mutex, typename Base = typename Mutex::UniqueLock >
93- @@ -227,28 +227,28 @@ public:
92+ /** Wrapper around std::unique_lock style lock for MutexType . */
93+ template <typename MutexType >
94+ @@ -241,7 +241,7 @@ public:
9495 friend class reverse_lock;
9596 };
9697
9798- #define REVERSE_LOCK(g) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, #g, __FILE__, __LINE__)
9899+ #define REVERSE_LOCK(g) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, #g, __FILE__, 0)
99100
100- template<typename MutexArg>
101- using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type>;
101+ // When locking a Mutex, require negative capability to ensure the lock
102+ // is not already held
103+ @@ -255,23 +255,23 @@ inline MutexType& MaybeCheckNotHeld(MutexType& m) LOCKS_EXCLUDED(m) LOCK_RETURNE
104+ template <typename MutexType>
105+ inline MutexType* MaybeCheckNotHeld(MutexType* m) LOCKS_EXCLUDED(m) LOCK_RETURNED(m) { return m; }
102106
103- - #define LOCK(cs) DebugLock<decltype(cs)> UNIQUE_NAME(criticalblock)(cs , #cs, __FILE__, __LINE__)
104- + #define LOCK(cs) DebugLock<decltype(cs)> UNIQUE_NAME(criticalblock)(cs , #cs, __FILE__, 0)
107+ - #define LOCK(cs) UniqueLock UNIQUE_NAME(criticalblock)(MaybeCheckNotHeld(cs) , #cs, __FILE__, __LINE__)
108+ + #define LOCK(cs) UniqueLock UNIQUE_NAME(criticalblock)(MaybeCheckNotHeld(cs) , #cs, __FILE__, 0)
105109 #define LOCK2(cs1, cs2) \
106- - DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \
107- - DebugLock<decltype(cs2)> criticalblock2(cs2, #cs2, __FILE__, __LINE__);
108- - #define TRY_LOCK(cs, name) DebugLock<decltype(cs)> name(cs , #cs, __FILE__, __LINE__, true)
109- - #define WAIT_LOCK(cs, name) DebugLock<decltype(cs)> name(cs , #cs, __FILE__, __LINE__)
110- + DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, 0); \
111- + DebugLock<decltype(cs2)> criticalblock2(cs2, #cs2, __FILE__, 0);
112- + #define TRY_LOCK(cs, name) DebugLock<decltype(cs)> name(cs , #cs, __FILE__, 0, true)
113- + #define WAIT_LOCK(cs, name) DebugLock<decltype(cs)> name(cs , #cs, __FILE__, 0)
110+ - UniqueLock criticalblock1(MaybeCheckNotHeld( cs1) , #cs1, __FILE__, __LINE__); \
111+ - UniqueLock criticalblock2(MaybeCheckNotHeld( cs2) , #cs2, __FILE__, __LINE__)
112+ - #define TRY_LOCK(cs, name) UniqueLock name(MaybeCheckNotHeld(cs) , #cs, __FILE__, __LINE__, true)
113+ - #define WAIT_LOCK(cs, name) UniqueLock name(MaybeCheckNotHeld(cs) , #cs, __FILE__, __LINE__)
114+ + UniqueLock criticalblock1(MaybeCheckNotHeld( cs1) , #cs1, __FILE__, 0); \
115+ + UniqueLock criticalblock2(MaybeCheckNotHeld( cs2) , #cs2, __FILE__, 0)
116+ + #define TRY_LOCK(cs, name) UniqueLock name(MaybeCheckNotHeld(cs) , #cs, __FILE__, 0, true)
117+ + #define WAIT_LOCK(cs, name) UniqueLock name(MaybeCheckNotHeld(cs) , #cs, __FILE__, 0)
114118
115119 #define ENTER_CRITICAL_SECTION(cs) \
116120 { \
@@ -128,10 +132,10 @@ index a17592611..c0aa8a672 100644
128132 LeaveCritical(); \
129133 }
130134diff --git a/src/util/check.h b/src/util/check.h
131- index aca957925..1ec992ed2 100644
135+ index b6c03bed2a..b4a1380061 100644
132136--- a/src/util/check.h
133137+++ b/src/util/check.h
134- @@ -45 ,11 +45 ,7 @@ T&& inline_check_non_fatal(T&& val, const char* file, int line, const char* func
138+ @@ -38 ,11 +38 ,7 @@ T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, const char* file, int line, co
135139 * caller, which can then report the issue to the developers.
136140 */
137141 #define CHECK_NONFATAL(condition) \
@@ -144,7 +148,7 @@ index aca957925..1ec992ed2 100644
144148
145149 /** Helper for Assert() */
146150 void assertion_fail(const char* file, int line, const char* func, const char* assertion);
147- @@ -71 ,7 +67 ,7 @@ T&& inline_assertion_check(T&& val, [[maybe_unused]] const char* file, [[maybe_u
151+ @@ -64 ,7 +60 ,7 @@ T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* f
148152 }
149153
150154 /** Identity function. Abort if the value compares equal to zero */
@@ -153,7 +157,7 @@ index aca957925..1ec992ed2 100644
153157
154158 /**
155159 * Assume is the identity function.
156- @@ -83,7 +79,7 @@ T&& inline_assertion_check(T&& val, [[maybe_unused]] const char* file, [[maybe_u
160+ @@ -76,13 +72,13 @@ T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* f
157161 * - For non-fatal errors in interactive sessions (e.g. RPC or command line
158162 * interfaces), CHECK_NONFATAL() might be more appropriate.
159163 */
@@ -162,11 +166,10 @@ index aca957925..1ec992ed2 100644
162166
163167 /**
164168 * NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code. It throws a NonFatalCheckError.
165- @@ -92,6 +88,6 @@ T&& inline_assertion_check(T&& val, [[maybe_unused]] const char* file, [[maybe_u
169+ */
166170 #define NONFATAL_UNREACHABLE() \
167171 throw NonFatalCheckError( \
168- format_internal_error("Unreachable code reached (non-fatal)", \
169- - __FILE__, __LINE__, __func__, PACKAGE_BUGREPORT))
170- + __FILE__, 0, __func__, PACKAGE_BUGREPORT))
172+ - "Unreachable code reached (non-fatal)", __FILE__, __LINE__, __func__)
173+ + "Unreachable code reached (non-fatal)", __FILE__, 0, __func__)
171174
172175 #endif // BITCOIN_UTIL_CHECK_H
0 commit comments