Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boost fixes #9

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cache:
apt: true

os: linux
dist: xenial

addons:
apt:
Expand Down
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ cmake_minimum_required(VERSION 3.1.0)

project(ryo)

# enforce C++11
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)

# enforce C11
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 11)


function (die msg)
if (NOT WIN32)
string(ASCII 27 Esc)
Expand Down Expand Up @@ -621,8 +632,8 @@ else()
message(STATUS "AES support disabled")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS}")

# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
Expand Down Expand Up @@ -810,6 +821,7 @@ endif()

include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(Boost_NO_BOOST_CMAKE ON)
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi)
set(ICU_LIBRARIES ${Boost_LOCALE_LIBRARY} icuio icuin icuuc icudt icutu iconv)
elseif(APPLE OR OPENBSD OR ANDROID)
Expand Down
6 changes: 3 additions & 3 deletions contrib/epee/include/net/abstract_tcp_server2.inl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool connection<t_protocol_handler>::request_callback()
template <class t_protocol_handler>
boost::asio::io_service &connection<t_protocol_handler>::get_io_service()
{
return socket_.get_io_service();
return GET_IO_SERVICE(socket_);
}
//---------------------------------------------------------------------------------
template <class t_protocol_handler>
Expand Down Expand Up @@ -367,7 +367,7 @@ bool connection<t_protocol_handler>::call_run_once_service_io()
if(!m_is_multithreaded)
{
//single thread model, we can wait in blocked call
size_t cnt = socket_.get_io_service().run_one();
size_t cnt = GET_IO_SERVICE(socket_).run_one();
if(!cnt) //service is going to quit
return false;
}
Expand All @@ -378,7 +378,7 @@ bool connection<t_protocol_handler>::call_run_once_service_io()
//if no handlers were called
//TODO: Maybe we need to have have critical section + event + callback to upper protocol to
//ask it inside(!) critical region if we still able to go in event wait...
size_t cnt = socket_.get_io_service().poll_one();
size_t cnt = GET_IO_SERVICE(socket_).poll_one();
if(!cnt)
misc_utils::sleep_no_w(0);
}
Expand Down
5 changes: 5 additions & 0 deletions contrib/epee/include/net/net_utils_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,9 @@ inline MAKE_LOGGABLE(connection_context_base, ct, os)
}
}

#if BOOST_VERSION >= 107000
#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
#else
#define GET_IO_SERVICE(s) ((s).get_io_service())
#endif
#endif //_NET_UTILS_BASE_H_
1 change: 1 addition & 0 deletions src/simplewallet/simplewallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
#include <thread>

#ifdef WIN32
#undef fmt
#include <windows.h>
#include <boost/filesystem.hpp>
#include <boost/locale.hpp>
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <boost/format.hpp>

#if defined(WIN32)
#undef fmt
#include <crtdbg.h>
#include <boost/locale.hpp>
#endif
Expand Down