Skip to content

Commit 2f17449

Browse files
committed
Merge #17073: move-only: PASTE macros to util/macros.h
0d86f4d refactor: consolidate PASTE macros (James O'Beirne) Pull request description: Really dumb move-only stolen from #16805. Some of my pull requests also depend on this, so I split it up to not depend on #16805. ACKs for top commit: practicalswift: ACK 0d86f4d -- diff looks correct hebasto: ACK 0d86f4d, I have reviewed the code and it looks OK, I agree it can be merged. promag: ACK 0d86f4d. Tree-SHA512: 19208a8cbf83034b1ef25138d8f08d8f32ace7775f654b1597fc4599dd576f0758145f592f161cfdcaaa29d4907ac9aa5553f6f524e2b960205c760605a05901
2 parents df50fd1 + 0d86f4d commit 2f17449

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ BITCOIN_CORE_H = \
209209
util/error.h \
210210
util/fees.h \
211211
util/system.h \
212+
util/macros.h \
212213
util/memory.h \
213214
util/moneystr.h \
214215
util/rbf.h \

src/sync.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define BITCOIN_SYNC_H
88

99
#include <threadsafety.h>
10+
#include <util/macros.h>
1011

1112
#include <condition_variable>
1213
#include <thread>
@@ -176,9 +177,6 @@ class SCOPED_LOCKABLE UniqueLock : public Base
176177
template<typename MutexArg>
177178
using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type>;
178179

179-
#define PASTE(x, y) x ## y
180-
#define PASTE2(x, y) PASTE(x, y)
181-
182180
#define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)
183181
#define LOCK2(cs1, cs2) \
184182
DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \

src/util/macros.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2019 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_UTIL_MACROS_H
6+
#define BITCOIN_UTIL_MACROS_H
7+
8+
#define PASTE(x, y) x ## y
9+
#define PASTE2(x, y) PASTE(x, y)
10+
11+
#endif // BITCOIN_UTIL_MACROS_H

0 commit comments

Comments
 (0)