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:
commit
3cea45bc56
|
@ -96,7 +96,7 @@ enable_language(C ASM)
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_C_EXTENSIONS OFF)
|
set(CMAKE_C_EXTENSIONS OFF)
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
@ -999,6 +999,9 @@ else()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
|
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()
|
endif()
|
||||||
|
|
||||||
set(DEBUG_FLAGS "-g3")
|
set(DEBUG_FLAGS "-g3")
|
||||||
|
@ -1077,6 +1080,7 @@ if (WIN32)
|
||||||
endif()
|
endif()
|
||||||
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
|
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
|
||||||
|
add_definitions(-DBOOST_NO_AUTO_PTR)
|
||||||
|
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
|
||||||
if(NOT Boost_FOUND)
|
if(NOT Boost_FOUND)
|
||||||
|
|
|
@ -166,7 +166,7 @@ library archives (`.a`).
|
||||||
|
|
||||||
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Void pkg | Fedora pkg | Optional | Purpose |
|
| 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 | |
|
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
|
||||||
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | 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 |
|
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
|
||||||
|
|
|
@ -92,7 +92,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
SET(PORT OFF)
|
SET(PORT OFF)
|
||||||
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
|
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
|
||||||
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
|
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_PIC OFF)
|
||||||
SET(LLVM_ENABLE_PIE OFF)
|
SET(LLVM_ENABLE_PIE OFF)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
#include "cryptonote_basic/subaddress_index.h"
|
#include "cryptonote_basic/subaddress_index.h"
|
||||||
#include "cryptonote_core/cryptonote_tx_utils.h"
|
#include "cryptonote_core/cryptonote_tx_utils.h"
|
||||||
|
|
||||||
#include <boost/thread/locks.hpp>
|
|
||||||
#include <boost/thread/lock_guard.hpp>
|
|
||||||
|
|
||||||
namespace hw {
|
namespace hw {
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
@ -322,10 +319,10 @@ namespace hw {
|
||||||
//automatic lock one more level on device ensuring the current thread is allowed to use it
|
//automatic lock one more level on device ensuring the current thread is allowed to use it
|
||||||
#define AUTO_LOCK_CMD() \
|
#define AUTO_LOCK_CMD() \
|
||||||
/* lock both mutexes without deadlock*/ \
|
/* 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 */ \
|
/* 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); \
|
std::lock_guard<std::recursive_mutex> lock1(device_locker, std::adopt_lock); \
|
||||||
boost::lock_guard<boost::mutex> lock2(command_locker, boost::adopt_lock)
|
std::lock_guard<std::mutex> lock2(command_locker, std::adopt_lock)
|
||||||
|
|
||||||
//lock the device for a long sequence
|
//lock the device for a long sequence
|
||||||
void device_ledger::lock(void) {
|
void device_ledger::lock(void) {
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
#include "device.hpp"
|
#include "device.hpp"
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
#include "device_io_hid.hpp"
|
#include "device_io_hid.hpp"
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <mutex>
|
||||||
#include <boost/thread/recursive_mutex.hpp>
|
|
||||||
|
|
||||||
namespace hw {
|
namespace hw {
|
||||||
|
|
||||||
|
@ -140,8 +139,8 @@ namespace hw {
|
||||||
class device_ledger : public hw::device {
|
class device_ledger : public hw::device {
|
||||||
private:
|
private:
|
||||||
// Locker for concurrent access
|
// Locker for concurrent access
|
||||||
mutable boost::recursive_mutex device_locker;
|
mutable std::recursive_mutex device_locker;
|
||||||
mutable boost::mutex command_locker;
|
mutable std::mutex command_locker;
|
||||||
|
|
||||||
//IO
|
//IO
|
||||||
hw::io::device_io_hid hw_device;
|
hw::io::device_io_hid hw_device;
|
||||||
|
|
|
@ -32,13 +32,12 @@
|
||||||
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "device/device.hpp"
|
#include "device/device.hpp"
|
||||||
#include "device/device_default.hpp"
|
#include "device/device_default.hpp"
|
||||||
#include "device/device_cold.hpp"
|
#include "device/device_cold.hpp"
|
||||||
#include <boost/scope_exit.hpp>
|
#include <boost/scope_exit.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
|
||||||
#include <boost/thread/recursive_mutex.hpp>
|
|
||||||
#include "cryptonote_config.h"
|
#include "cryptonote_config.h"
|
||||||
#include "trezor.hpp"
|
#include "trezor.hpp"
|
||||||
|
|
||||||
|
@ -49,12 +48,12 @@
|
||||||
//automatic lock one more level on device ensuring the current thread is allowed to use it
|
//automatic lock one more level on device ensuring the current thread is allowed to use it
|
||||||
#define TREZOR_AUTO_LOCK_CMD() \
|
#define TREZOR_AUTO_LOCK_CMD() \
|
||||||
/* lock both mutexes without deadlock*/ \
|
/* 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 */ \
|
/* 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); \
|
std::lock_guard<std::recursive_mutex> lock1(device_locker, std::adopt_lock); \
|
||||||
boost::lock_guard<boost::mutex> lock2(command_locker, boost::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 hw {
|
||||||
namespace trezor {
|
namespace trezor {
|
||||||
|
@ -86,8 +85,8 @@ namespace trezor {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Locker for concurrent access
|
// Locker for concurrent access
|
||||||
mutable boost::recursive_mutex device_locker;
|
mutable std::recursive_mutex device_locker;
|
||||||
mutable boost::mutex command_locker;
|
mutable std::mutex command_locker;
|
||||||
|
|
||||||
std::shared_ptr<Transport> m_transport;
|
std::shared_ptr<Transport> m_transport;
|
||||||
i_device_callback * m_callback;
|
i_device_callback * m_callback;
|
||||||
|
|
Loading…
Reference in New Issue