Merge pull request #8922

b4491c1 cmake: set -fno-aligned-allocation on macOS ARM (selsta)
df9f380 cmake: set BOOST_NO_AUTO_PTR to fix c++17 compilation (selsta)
5136974 device: boost -> std locks to fix c++17 compilation (selsta)
5965b02 cmake: set cpp17 standard (selsta)
This commit is contained in:
luigi1111 2023-11-06 09:21:55 -05:00
commit 3cea45bc56
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
6 changed files with 20 additions and 21 deletions

View File

@ -96,7 +96,7 @@ enable_language(C ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
@ -999,6 +999,9 @@ else()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
if(ARM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-aligned-allocation")
endif()
endif()
set(DEBUG_FLAGS "-g3")
@ -1077,6 +1080,7 @@ if (WIN32)
endif()
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
add_definitions(-DBOOST_NO_AUTO_PTR)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
if(NOT Boost_FOUND)

View File

@ -166,7 +166,7 @@ library archives (`.a`).
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Void pkg | Fedora pkg | Optional | Purpose |
| ------------ | ------------- | -------- | -------------------- | ------------ | ------------------ | ------------------- | -------- | --------------- |
| GCC | 5 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
| GCC | 7 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |

View File

@ -92,7 +92,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD 17)
SET(LLVM_ENABLE_PIC OFF)
SET(LLVM_ENABLE_PIE OFF)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")

View File

@ -34,9 +34,6 @@
#include "cryptonote_basic/subaddress_index.h"
#include "cryptonote_core/cryptonote_tx_utils.h"
#include <boost/thread/locks.hpp>
#include <boost/thread/lock_guard.hpp>
namespace hw {
namespace ledger {
@ -322,10 +319,10 @@ namespace hw {
//automatic lock one more level on device ensuring the current thread is allowed to use it
#define AUTO_LOCK_CMD() \
/* lock both mutexes without deadlock*/ \
boost::lock(device_locker, command_locker); \
std::lock(device_locker, command_locker); \
/* make sure both already-locked mutexes are unlocked at the end of scope */ \
boost::lock_guard<boost::recursive_mutex> lock1(device_locker, boost::adopt_lock); \
boost::lock_guard<boost::mutex> lock2(command_locker, boost::adopt_lock)
std::lock_guard<std::recursive_mutex> lock1(device_locker, std::adopt_lock); \
std::lock_guard<std::mutex> lock2(command_locker, std::adopt_lock)
//lock the device for a long sequence
void device_ledger::lock(void) {

View File

@ -35,8 +35,7 @@
#include "device.hpp"
#include "log.hpp"
#include "device_io_hid.hpp"
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <mutex>
namespace hw {
@ -140,8 +139,8 @@ namespace hw {
class device_ledger : public hw::device {
private:
// Locker for concurrent access
mutable boost::recursive_mutex device_locker;
mutable boost::mutex command_locker;
mutable std::recursive_mutex device_locker;
mutable std::mutex command_locker;
//IO
hw::io::device_io_hid hw_device;

View File

@ -32,13 +32,12 @@
#include <cstddef>
#include <mutex>
#include <string>
#include "device/device.hpp"
#include "device/device_default.hpp"
#include "device/device_cold.hpp"
#include <boost/scope_exit.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include "cryptonote_config.h"
#include "trezor.hpp"
@ -49,12 +48,12 @@
//automatic lock one more level on device ensuring the current thread is allowed to use it
#define TREZOR_AUTO_LOCK_CMD() \
/* lock both mutexes without deadlock*/ \
boost::lock(device_locker, command_locker); \
std::lock(device_locker, command_locker); \
/* make sure both already-locked mutexes are unlocked at the end of scope */ \
boost::lock_guard<boost::recursive_mutex> lock1(device_locker, boost::adopt_lock); \
boost::lock_guard<boost::mutex> lock2(command_locker, boost::adopt_lock)
std::lock_guard<std::recursive_mutex> lock1(device_locker, std::adopt_lock); \
std::lock_guard<std::mutex> lock2(command_locker, std::adopt_lock)
#define TREZOR_AUTO_LOCK_DEVICE() boost::lock_guard<boost::recursive_mutex> lock1_device(device_locker)
#define TREZOR_AUTO_LOCK_DEVICE() std::lock_guard<std::recursive_mutex> lock1_device(device_locker)
namespace hw {
namespace trezor {
@ -86,8 +85,8 @@ namespace trezor {
protected:
// Locker for concurrent access
mutable boost::recursive_mutex device_locker;
mutable boost::mutex command_locker;
mutable std::recursive_mutex device_locker;
mutable std::mutex command_locker;
std::shared_ptr<Transport> m_transport;
i_device_callback * m_callback;