Skip to content

Commit

Permalink
Fixed compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wqking committed Sep 25, 2021
1 parent a84dd87 commit 433ff62
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 60 deletions.
98 changes: 49 additions & 49 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -343,52 +343,52 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
)
CXXFLAGS="$TEMP_CXXFLAGS"

TEMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $SSE41_CXXFLAGS"
AC_MSG_CHECKING(for SSE4.1 intrinsics)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>
#include <immintrin.h>
]],[[
__m128i l = _mm_set1_epi32(0);
return _mm_extract_epi32(l, 3);
]])],
[ AC_MSG_RESULT(yes); enable_sse41=yes; AC_DEFINE(ENABLE_SSE41, 1, [Define this symbol to build code that uses SSE4.1 intrinsics]) ],
[ AC_MSG_RESULT(no)]
)
CXXFLAGS="$TEMP_CXXFLAGS"

TEMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $AVX2_CXXFLAGS"
AC_MSG_CHECKING(for AVX2 intrinsics)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>
#include <immintrin.h>
]],[[
__m256i l = _mm256_set1_epi32(0);
return _mm256_extract_epi32(l, 7);
]])],
[ AC_MSG_RESULT(yes); enable_avx2=yes; AC_DEFINE(ENABLE_AVX2, 1, [Define this symbol to build code that uses AVX2 intrinsics]) ],
[ AC_MSG_RESULT(no)]
)
CXXFLAGS="$TEMP_CXXFLAGS"

TEMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $SHANI_CXXFLAGS"
AC_MSG_CHECKING(for SHA-NI intrinsics)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>
#include <immintrin.h>
]],[[
__m128i i = _mm_set1_epi32(0);
__m128i j = _mm_set1_epi32(1);
__m128i k = _mm_set1_epi32(2);
return _mm_extract_epi32(_mm_sha256rnds2_epu32(i, i, k), 0);
]])],
[ AC_MSG_RESULT(yes); enable_shani=yes; AC_DEFINE(ENABLE_SHANI, 1, [Define this symbol to build code that uses SHA-NI intrinsics]) ],
[ AC_MSG_RESULT(no)]
)
CXXFLAGS="$TEMP_CXXFLAGS"
#TEMP_CXXFLAGS="$CXXFLAGS"
#CXXFLAGS="$CXXFLAGS $SSE41_CXXFLAGS"
#AC_MSG_CHECKING(for SSE4.1 intrinsics)
#AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
# #include <stdint.h>
# #include <immintrin.h>
# ]],[[
# __m128i l = _mm_set1_epi32(0);
# return _mm_extract_epi32(l, 3);
# ]])],
# [ AC_MSG_RESULT(yes); enable_sse41=yes; AC_DEFINE(ENABLE_SSE41, 1, [Define this symbol to build code that uses SSE4.1 intrinsics]) ],
# [ AC_MSG_RESULT(no)]
#)
#CXXFLAGS="$TEMP_CXXFLAGS"

#TEMP_CXXFLAGS="$CXXFLAGS"
#CXXFLAGS="$CXXFLAGS $AVX2_CXXFLAGS"
#AC_MSG_CHECKING(for AVX2 intrinsics)
#AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
# #include <stdint.h>
# #include <immintrin.h>
# ]],[[
# __m256i l = _mm256_set1_epi32(0);
# return _mm256_extract_epi32(l, 7);
# ]])],
# [ AC_MSG_RESULT(yes); enable_avx2=no; AC_DEFINE(ENABLE_AVX2, 0, [Define this symbol to build code that uses AVX2 intrinsics]) ],
# [ AC_MSG_RESULT(no)]
#)
#CXXFLAGS="$TEMP_CXXFLAGS"

#TEMP_CXXFLAGS="$CXXFLAGS"
#CXXFLAGS="$CXXFLAGS $SHANI_CXXFLAGS"
#AC_MSG_CHECKING(for SHA-NI intrinsics)
#AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
# #include <stdint.h>
# #include <immintrin.h>
# ]],[[
# __m128i i = _mm_set1_epi32(0);
# __m128i j = _mm_set1_epi32(1);
# __m128i k = _mm_set1_epi32(2);
# return _mm_extract_epi32(_mm_sha256rnds2_epu32(i, i, k), 0);
# ]])],
# [ AC_MSG_RESULT(yes); enable_shani=yes; AC_DEFINE(ENABLE_SHANI, 1, [Define this symbol to build code that uses SHA-NI intrinsics]) ],
# [ AC_MSG_RESULT(no)]
#)
#CXXFLAGS="$TEMP_CXXFLAGS"

CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"

Expand Down Expand Up @@ -1308,9 +1308,9 @@ AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes])
AM_CONDITIONAL([ENABLE_HWCRC32],[test x$enable_hwcrc32 = xyes])
AM_CONDITIONAL([ENABLE_SSE41],[test x$enable_sse41 = xyes])
AM_CONDITIONAL([ENABLE_AVX2],[test x$enable_avx2 = xyes])
AM_CONDITIONAL([ENABLE_SHANI],[test x$enable_shani = xyes])
#AM_CONDITIONAL([ENABLE_SSE41],[test x$enable_sse41 = xyes])
#AM_CONDITIONAL([ENABLE_AVX2],[test x$enable_avx2 = xyes])
#AM_CONDITIONAL([ENABLE_SHANI],[test x$enable_shani = xyes])
AM_CONDITIONAL([USE_ASM],[test x$use_asm = xyes])

AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
Expand Down
2 changes: 0 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ std::string GetWarnings(std::string strFor);
bool GetTransaction(const uint256& hash, CTransaction& tx, uint256& hashBlock, bool fAllowSlow = false);
/** Find the best known block, and make it the tip of the block chain */

bool DisconnectBlocksAndReprocess(int blocks);

// ***TODO***
double ConvertBitsToDouble(unsigned int nBits);
int64_t GetMasternodePayment(int nHeight, int64_t blockValue, int nMasternodeCount = 0);
Expand Down
4 changes: 1 addition & 3 deletions src/masternodeconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ void CMasternodeConfig::writeToMasternodeConf()

std::string masternodeAliasBase = "";

std::string masternodeAliasBase = "";

for (CMasternodeConfig::CMasternodeEntry mne : masternodeConfig.getEntries()) {
// Orders configs in proper strings
std::string masternodeAliasLine = mne.getAlias() + " " + mne.getIp() + " " + mne.getPrivKey() + " " + mne.getTxHash() + " " + mne.getOutputIndex() + "\n";
Expand All @@ -144,4 +142,4 @@ void CMasternodeConfig::writeToMasternodeConf()
clear();
std::string strErr;
read(strErr);
}
}
14 changes: 8 additions & 6 deletions src/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ void AfterReleaseLock(const void * lockInstance, const bool ownsLock);
#define AfterReleaseLock(lockInstance, ownsLock)
#endif

/** Wrapper around boost::unique_lock<CCriticalSection> */
/** Wrapper around std::unique_lock<CCriticalSection> */
template <typename Mutex>
class SCOPED_LOCKABLE CMutexLock
{
private:
std::unique_lock<CCriticalSection> lock;
std::unique_lock<Mutex> lock;

void Enter(const char* pszName, const char* pszFile, int nLine)
{
Expand All @@ -152,7 +152,7 @@ class SCOPED_LOCKABLE CMutexLock
}

public:
CCriticalBlock(CCriticalSection& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) : lock(mutexIn, std::defer_lock)
CMutexLock(Mutex& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) : lock(mutexIn, std::defer_lock)
{
BeforeAcquireLock(this, &mutexIn, pszName, pszFile, nLine, fTry);

Expand All @@ -164,13 +164,13 @@ class SCOPED_LOCKABLE CMutexLock
AfterAcquireLock(this, lock.owns_lock());
}

CCriticalBlock(CCriticalSection* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(pmutexIn)
CMutexLock(Mutex* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(pmutexIn)
{
if (!pmutexIn) return;

BeforeAcquireLock(this, pmutexIn, pszName, pszFile, nLine, fTry);

lock = boost::unique_lock<Mutex>(*pmutexIn, boost::defer_lock);
lock = std::unique_lock<Mutex>(*pmutexIn, std::defer_lock);
if (fTry)
TryEnter(pszName, pszFile, nLine);
else
Expand All @@ -179,7 +179,7 @@ class SCOPED_LOCKABLE CMutexLock
AfterAcquireLock(this, lock.owns_lock());
}

~CCriticalBlock() UNLOCK_FUNCTION()
~CMutexLock() UNLOCK_FUNCTION()
{
if (lock.owns_lock())
LeaveCritical();
Expand All @@ -193,6 +193,8 @@ class SCOPED_LOCKABLE CMutexLock
}
};

typedef CMutexLock<CCriticalSection> CCriticalBlock;

#define PASTE(x, y) x ## y
#define PASTE2(x, y) PASTE(x, y)

Expand Down

0 comments on commit 433ff62

Please sign in to comment.