diff --git a/.travis.yml b/.travis.yml index 02924139..76b66faa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ cache: apt: true os: linux +dist: xenial addons: apt: diff --git a/CMakeLists.txt b/CMakeLists.txt index 82e49066..d217945f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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 @@ -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) diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index b71607ec..3c12e172 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -204,7 +204,7 @@ bool connection::request_callback() template boost::asio::io_service &connection::get_io_service() { - return socket_.get_io_service(); + return GET_IO_SERVICE(socket_); } //--------------------------------------------------------------------------------- template @@ -367,7 +367,7 @@ bool connection::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; } @@ -378,7 +378,7 @@ bool connection::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); } diff --git a/contrib/epee/include/net/net_utils_base.h b/contrib/epee/include/net/net_utils_base.h index 3c859ece..7a479173 100644 --- a/contrib/epee/include/net/net_utils_base.h +++ b/contrib/epee/include/net/net_utils_base.h @@ -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_ diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index f38450e0..472e39df 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -83,6 +83,7 @@ #include #ifdef WIN32 +#undef fmt #include #include #include diff --git a/src/wallet/wallet_args.cpp b/src/wallet/wallet_args.cpp index 7ecc2488..05723ead 100644 --- a/src/wallet/wallet_args.cpp +++ b/src/wallet/wallet_args.cpp @@ -53,6 +53,7 @@ #include #if defined(WIN32) +#undef fmt #include #include #endif