1
1
diff --git a/src/bench/bench.h b/src/bench/bench.h
2
- index 17535e4e8..90f9c8ab7 100644
2
+ index 63e1bf67e2..358dd663f8 100644
3
3
--- a/src/bench/bench.h
4
4
+++ b/src/bench/bench.h
5
- @@ -65 ,6 +65 ,6 @@ public:
5
+ @@ -77 ,6 +77 ,6 @@ public:
6
6
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 );
11
11
12
12
#endif // BITCOIN_BENCH_BENCH_H
13
13
diff --git a/src/clientversion.cpp b/src/clientversion.cpp
14
- index 192e9c52b..e25705962 100644
14
+ index 192e9c52bc..e257059624 100644
15
15
--- a/src/clientversion.cpp
16
16
+++ b/src/clientversion.cpp
17
17
@@ -53,7 +53,7 @@ static std::string FormatVersion(int nVersion)
@@ -24,7 +24,7 @@ index 192e9c52b..e25705962 100644
24
24
}
25
25
26
26
diff --git a/src/compat/assumptions.h b/src/compat/assumptions.h
27
- index 92615b582..611894be1 100644
27
+ index 92615b582a..611894be19 100644
28
28
--- a/src/compat/assumptions.h
29
29
+++ b/src/compat/assumptions.h
30
30
@@ -13,9 +13,6 @@
@@ -38,20 +38,20 @@ index 92615b582..611894be1 100644
38
38
// Assumption: We assume a C++17 (ISO/IEC 14882:2017) compiler (minimum requirement).
39
39
// Example(s): We assume the presence of C++17 features everywhere :-)
40
40
diff --git a/src/logging.h b/src/logging.h
41
- index ae8cad906..0222526f8 100644
41
+ index 14a0f08f8d..32d4b7c708 100644
42
42
--- a/src/logging.h
43
43
+++ 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
45
45
}
46
46
}
47
47
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__)
50
50
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__)
53
53
diff --git a/src/rest.cpp b/src/rest.cpp
54
- index 22b5d2e07..4d783accb 100644
54
+ index a10d8a433f..48736c9b9d 100644
55
55
--- a/src/rest.cpp
56
56
+++ b/src/rest.cpp
57
57
@@ -87,7 +87,7 @@ static NodeContext* GetNodeContext(const std::any& context, HTTPRequest* req)
@@ -73,44 +73,48 @@ index 22b5d2e07..4d783accb 100644
73
73
}
74
74
return node_context->chainman.get();
75
75
diff --git a/src/sync.h b/src/sync.h
76
- index a17592611..c0aa8a672 100644
76
+ index 1f4e191214..88d4ade0a0 100644
77
77
--- a/src/sync.h
78
78
+++ 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 { } ;
82
82
83
83
- #define AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)
84
84
+ #define AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, 0, &cs)
85
85
86
86
inline void AssertLockNotHeldInline(const char* name, const char* file, int line, Mutex* cs) EXCLUSIVE_LOCKS_REQUIRED(!cs) { AssertLockNotHeldInternal(name, file, line, cs); }
87
87
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); }
88
89
- #define AssertLockNotHeld(cs) AssertLockNotHeldInline(#cs, __FILE__, __LINE__, &cs)
89
90
+ #define AssertLockNotHeld(cs) AssertLockNotHeldInline(#cs, __FILE__, 0, &cs)
90
91
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:
94
95
friend class reverse_lock;
95
96
};
96
97
97
98
- #define REVERSE_LOCK(g) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, #g, __FILE__, __LINE__)
98
99
+ #define REVERSE_LOCK(g) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, #g, __FILE__, 0)
99
100
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; }
102
106
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)
105
109
#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)
114
118
115
119
#define ENTER_CRITICAL_SECTION(cs) \
116
120
{ \
@@ -128,10 +132,10 @@ index a17592611..c0aa8a672 100644
128
132
LeaveCritical(); \
129
133
}
130
134
diff --git a/src/util/check.h b/src/util/check.h
131
- index aca957925..1ec992ed2 100644
135
+ index b6c03bed2a..b4a1380061 100644
132
136
--- a/src/util/check.h
133
137
+++ 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
135
139
* caller, which can then report the issue to the developers.
136
140
*/
137
141
#define CHECK_NONFATAL(condition) \
@@ -144,7 +148,7 @@ index aca957925..1ec992ed2 100644
144
148
145
149
/** Helper for Assert() */
146
150
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
148
152
}
149
153
150
154
/** Identity function. Abort if the value compares equal to zero */
@@ -153,7 +157,7 @@ index aca957925..1ec992ed2 100644
153
157
154
158
/**
155
159
* 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
157
161
* - For non-fatal errors in interactive sessions (e.g. RPC or command line
158
162
* interfaces), CHECK_NONFATAL() might be more appropriate.
159
163
*/
@@ -162,11 +166,10 @@ index aca957925..1ec992ed2 100644
162
166
163
167
/**
164
168
* 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
+ */
166
170
#define NONFATAL_UNREACHABLE() \
167
171
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__)
171
174
172
175
#endif // BITCOIN_UTIL_CHECK_H
0 commit comments