Merge #17073: move-only: PASTE macros to util/macros.h

0d86f4d3da 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 0d86f4d3da -- diff looks correct
  hebasto:
    ACK 0d86f4d3da, I have reviewed the code and it looks OK, I agree it can be merged.
  promag:
    ACK 0d86f4d3da.

Tree-SHA512: 19208a8cbf83034b1ef25138d8f08d8f32ace7775f654b1597fc4599dd576f0758145f592f161cfdcaaa29d4907ac9aa5553f6f524e2b960205c760605a05901
This commit is contained in:
Wladimir J. van der Laan 2019-10-08 11:25:46 +02:00
commit 2f174498d6
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
3 changed files with 13 additions and 3 deletions

View file

@ -209,6 +209,7 @@ BITCOIN_CORE_H = \
util/error.h \
util/fees.h \
util/system.h \
util/macros.h \
util/memory.h \
util/moneystr.h \
util/rbf.h \

View file

@ -7,6 +7,7 @@
#define BITCOIN_SYNC_H
#include <threadsafety.h>
#include <util/macros.h>
#include <condition_variable>
#include <thread>
@ -176,9 +177,6 @@ public:
template<typename MutexArg>
using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type>;
#define PASTE(x, y) x ## y
#define PASTE2(x, y) PASTE(x, y)
#define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)
#define LOCK2(cs1, cs2) \
DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \

11
src/util/macros.h Normal file
View file

@ -0,0 +1,11 @@
// Copyright (c) 2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_UTIL_MACROS_H
#define BITCOIN_UTIL_MACROS_H
#define PASTE(x, y) x ## y
#define PASTE2(x, y) PASTE(x, y)
#endif // BITCOIN_UTIL_MACROS_H