From 643142dc30355d501cdd9327818b8ce0a9588671 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 13 Dec 2020 13:57:12 +0700 Subject: [PATCH] Update user agent for macOS and fix compile warnings --- src/backend/cpu/platform/BasicCpuInfo.h | 3 +++ src/backend/cpu/platform/HwlocCpuInfo.cpp | 18 ++++++++++-------- src/backend/cuda/CudaWorker.cpp | 1 - src/base/kernel/Platform_mac.cpp | 9 ++++++++- src/base/net/http/HttpListener.h | 9 ++++++++- src/net/Network.h | 1 - 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/backend/cpu/platform/BasicCpuInfo.h b/src/backend/cpu/platform/BasicCpuInfo.h index 7956ef1c6..5504d07b1 100644 --- a/src/backend/cpu/platform/BasicCpuInfo.h +++ b/src/backend/cpu/platform/BasicCpuInfo.h @@ -71,10 +71,13 @@ protected: bool m_jccErratum = false; private: +# ifndef XMRIG_ARM uint32_t m_procInfo = 0; uint32_t m_family = 0; uint32_t m_model = 0; uint32_t m_stepping = 0; +# endif + Assembly m_assembly = Assembly::NONE; MsrMod m_msrMod = MSR_MOD_NONE; std::bitset m_flags; diff --git a/src/backend/cpu/platform/HwlocCpuInfo.cpp b/src/backend/cpu/platform/HwlocCpuInfo.cpp index 6f6cb4b70..2a074fc07 100644 --- a/src/backend/cpu/platform/HwlocCpuInfo.cpp +++ b/src/backend/cpu/platform/HwlocCpuInfo.cpp @@ -85,6 +85,15 @@ static inline void findByType(hwloc_obj_t obj, hwloc_obj_type_t type, func lambd } +static inline size_t countByType(hwloc_topology_t topology, hwloc_obj_type_t type) +{ + const int count = hwloc_get_nbobjs_by_type(topology, type); + + return count > 0 ? static_cast(count) : 0; +} + + +#ifndef XMRIG_ARM static inline std::vector findByType(hwloc_obj_t obj, hwloc_obj_type_t type) { std::vector out; @@ -94,14 +103,6 @@ static inline std::vector findByType(hwloc_obj_t obj, hwloc_obj_typ } -static inline size_t countByType(hwloc_topology_t topology, hwloc_obj_type_t type) -{ - const int count = hwloc_get_nbobjs_by_type(topology, type); - - return count > 0 ? static_cast(count) : 0; -} - - static inline size_t countByType(hwloc_obj_t obj, hwloc_obj_type_t type) { size_t count = 0; @@ -116,6 +117,7 @@ static inline bool isCacheExclusive(hwloc_obj_t obj) const char *value = hwloc_obj_get_info_by_name(obj, "Inclusive"); return value == nullptr || value[0] != '1'; } +#endif } // namespace xmrig diff --git a/src/backend/cuda/CudaWorker.cpp b/src/backend/cuda/CudaWorker.cpp index 3585308fd..725d59c95 100644 --- a/src/backend/cuda/CudaWorker.cpp +++ b/src/backend/cuda/CudaWorker.cpp @@ -50,7 +50,6 @@ namespace xmrig { -static constexpr uint32_t kReserveCount = 32768; std::atomic CudaWorker::ready; diff --git a/src/base/kernel/Platform_mac.cpp b/src/base/kernel/Platform_mac.cpp index 4bd7a40a8..20ad96529 100644 --- a/src/base/kernel/Platform_mac.cpp +++ b/src/base/kernel/Platform_mac.cpp @@ -36,7 +36,14 @@ char *xmrig::Platform::createUserAgent() constexpr const size_t max = 256; char *buf = new char[max](); - int length = snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s", APP_NAME, APP_VERSION, uv_version_string()); + int length = snprintf(buf, max, + "%s/%s (Macintosh; macOS" +# ifdef XMRIG_ARM + "; arm64" +# else + "; x86_64" +# endif + ") libuv/%s", APP_NAME, APP_VERSION, uv_version_string()); # ifdef __clang__ length += snprintf(buf + length, max - length, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__); diff --git a/src/base/net/http/HttpListener.h b/src/base/net/http/HttpListener.h index 0e7264217..8f86d2baa 100644 --- a/src/base/net/http/HttpListener.h +++ b/src/base/net/http/HttpListener.h @@ -29,13 +29,20 @@ namespace xmrig { class HttpListener : public IHttpListener { public: - inline HttpListener(IHttpListener *listener, const char *tag = nullptr) : m_tag(tag), m_listener(listener) {} + inline HttpListener(IHttpListener *listener, const char *tag = nullptr) : +# ifdef APP_DEBUG + m_tag(tag), +# endif + m_listener(listener) + {} protected: void onHttpData(const HttpData &data) override; private: +# ifdef APP_DEBUG const char *m_tag; +# endif IHttpListener *m_listener; }; diff --git a/src/net/Network.h b/src/net/Network.h index 0289b2d25..94d546572 100644 --- a/src/net/Network.h +++ b/src/net/Network.h @@ -92,7 +92,6 @@ private: IStrategy *m_strategy = nullptr; NetworkState *m_state = nullptr; Timer *m_timer = nullptr; - uint32_t m_benchSize = 0; };