From 6f5d175d123da789dc63a16cf2313496c7d99013 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 13 Sep 2019 18:21:05 +0700 Subject: [PATCH] Fix compile warning, mostly struct/class inconsistency. --- cmake/randomx.cmake | 4 ++++ .../generators/ocl_generic_rx_generator.cpp | 2 +- src/backend/opencl/wrappers/OclDevice.cpp | 6 ------ src/crypto/randomx/allocator.cpp | 2 +- src/crypto/randomx/jit_compiler_x86.hpp | 2 +- src/crypto/randomx/randomx.h | 17 ++++++++++------- src/crypto/rx/RxVm.h | 9 +++++++-- 7 files changed, 24 insertions(+), 18 deletions(-) diff --git a/cmake/randomx.cmake b/cmake/randomx.cmake index 23f66b297..d0d892b96 100644 --- a/cmake/randomx.cmake +++ b/cmake/randomx.cmake @@ -52,6 +52,10 @@ if (WITH_RANDOMX) # cheat because cmake and ccache hate each other set_property(SOURCE src/crypto/randomx/jit_compiler_x86_static.S PROPERTY LANGUAGE C) endif() + + if (CMAKE_CXX_COMPILER_ID MATCHES Clang) + set_source_files_properties(src/crypto/randomx/jit_compiler_x86.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-const-variable) + endif() else() remove_definitions(/DXMRIG_ALGO_RANDOMX) endif() diff --git a/src/backend/opencl/generators/ocl_generic_rx_generator.cpp b/src/backend/opencl/generators/ocl_generic_rx_generator.cpp index 98962032a..61ea74ed7 100644 --- a/src/backend/opencl/generators/ocl_generic_rx_generator.cpp +++ b/src/backend/opencl/generators/ocl_generic_rx_generator.cpp @@ -32,7 +32,7 @@ namespace xmrig { -constexpr const size_t oneMiB = 1024u * 1024u; +//constexpr const size_t oneMiB = 1024u * 1024u; diff --git a/src/backend/opencl/wrappers/OclDevice.cpp b/src/backend/opencl/wrappers/OclDevice.cpp index 8da211813..f63387173 100644 --- a/src/backend/opencl/wrappers/OclDevice.cpp +++ b/src/backend/opencl/wrappers/OclDevice.cpp @@ -123,12 +123,6 @@ static OclDevice::Type getType(const String &name) } -static inline bool isCNv2(const Algorithm &algorithm) -{ - return algorithm.family() == Algorithm::CN && CnAlgo<>::base(algorithm) == Algorithm::CN_2; -} - - } // namespace xmrig diff --git a/src/crypto/randomx/allocator.cpp b/src/crypto/randomx/allocator.cpp index 60fb80565..ff708a62c 100644 --- a/src/crypto/randomx/allocator.cpp +++ b/src/crypto/randomx/allocator.cpp @@ -47,7 +47,7 @@ namespace randomx { rx_aligned_free(ptr); } - template class AlignedAllocator; + template struct AlignedAllocator; void* LargePageAllocator::allocMemory(size_t count) { return allocLargePagesMemory(count); diff --git a/src/crypto/randomx/jit_compiler_x86.hpp b/src/crypto/randomx/jit_compiler_x86.hpp index 30e7c2810..942fe8210 100644 --- a/src/crypto/randomx/jit_compiler_x86.hpp +++ b/src/crypto/randomx/jit_compiler_x86.hpp @@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace randomx { class Program; - class ProgramConfiguration; + struct ProgramConfiguration; class SuperscalarProgram; class JitCompilerX86; class Instruction; diff --git a/src/crypto/randomx/randomx.h b/src/crypto/randomx/randomx.h index 1a54573a7..05b7bdc8f 100644 --- a/src/crypto/randomx/randomx.h +++ b/src/crypto/randomx/randomx.h @@ -29,8 +29,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef RANDOMX_H #define RANDOMX_H -#include -#include +#include +#include #include #include "crypto/randomx/intrin_portable.h" @@ -41,17 +41,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define RANDOMX_EXPORT #endif -typedef enum { + +enum randomx_flags { RANDOMX_FLAG_DEFAULT = 0, RANDOMX_FLAG_LARGE_PAGES = 1, RANDOMX_FLAG_HARD_AES = 2, RANDOMX_FLAG_FULL_MEM = 4, RANDOMX_FLAG_JIT = 8, -} randomx_flags; +}; + + +struct randomx_dataset; +struct randomx_cache; +class randomx_vm; -typedef struct randomx_dataset randomx_dataset; -typedef struct randomx_cache randomx_cache; -typedef struct randomx_vm randomx_vm; struct RandomX_ConfigurationBase { diff --git a/src/crypto/rx/RxVm.h b/src/crypto/rx/RxVm.h index d7e617e4d..5154b66d7 100644 --- a/src/crypto/rx/RxVm.h +++ b/src/crypto/rx/RxVm.h @@ -28,10 +28,13 @@ #define XMRIG_RX_VM_H -#include +#include "base/tools/Object.h" -struct randomx_vm; +#include + + +class randomx_vm; namespace xmrig @@ -44,6 +47,8 @@ class RxDataset; class RxVm { public: + XMRIG_DISABLE_COPY_MOVE_DEFAULT(RxVm); + RxVm(RxDataset *dataset, uint8_t *scratchpad, bool softAes); ~RxVm();