From eb19343f9174a94f6c1e05ac1ef801596bce36b9 Mon Sep 17 00:00:00 2001 From: NATTSiM Date: Wed, 18 Dec 2013 12:52:08 -0800 Subject: [PATCH] Fix clang compile --- beast/Memory.h | 1 + beast/chrono/impl/RelativeTime.cpp | 27 +++++++++++++++---- beast/config/PlatformConfig.h | 1 - beast/threads/impl/Thread.cpp | 9 ++++++- modules/beast_asio/async/AbstractHandler.h | 2 +- modules/beast_asio/async/SharedHandler.h | 9 +------ .../beast_asio/async/SharedHandlerAllocator.h | 8 ++---- modules/beast_asio/sockets/SocketBase.h | 2 +- modules/beast_core/native/osx_ObjCHelpers.h | 1 - .../beast_core/system/BoostPlaceholdersFix.h | 1 - 10 files changed, 36 insertions(+), 25 deletions(-) diff --git a/beast/Memory.h b/beast/Memory.h index 538e82e5a..a95627542 100644 --- a/beast/Memory.h +++ b/beast/Memory.h @@ -27,6 +27,7 @@ #include #include "Config.h" +#include "Uncopyable.h" namespace beast { diff --git a/beast/chrono/impl/RelativeTime.cpp b/beast/chrono/impl/RelativeTime.cpp index 157cdd67a..8a79c7fd2 100644 --- a/beast/chrono/impl/RelativeTime.cpp +++ b/beast/chrono/impl/RelativeTime.cpp @@ -256,23 +256,29 @@ std::string RelativeTime::to_string () const } } - -namespace beast { - -namespace detail { #if BEAST_WINDOWS #include +namespace beast { +namespace detail { + static double monotonicCurrentTimeInSeconds() { return GetTickCount64() / 1000.0; } + +} +} #elif BEAST_MAC || BEAST_IOS -#include +#include +#include + +namespace beast { +namespace detail { static double monotonicCurrentTimeInSeconds() { @@ -309,20 +315,31 @@ static double monotonicCurrentTimeInSeconds() return mach_absolute_time() * data.ratio; } +} +} #else #include +namespace beast { +namespace detail { + static double monotonicCurrentTimeInSeconds() { timespec t; clock_gettime (CLOCK_MONOTONIC, &t); return t.tv_sec + t.tv_nsec / 1000000000.0; } + +} +} #endif +namespace beast { +namespace detail { + // Records and returns the time from process startup static double getStartupTime() { diff --git a/beast/config/PlatformConfig.h b/beast/config/PlatformConfig.h index ec59dab8d..5ee181322 100644 --- a/beast/config/PlatformConfig.h +++ b/beast/config/PlatformConfig.h @@ -174,7 +174,6 @@ #ifdef __clang__ #define BEAST_CLANG 1 - #define BEAST_GCC 1 #elif defined (__GNUC__) #define BEAST_GCC 1 #elif defined (_MSC_VER) diff --git a/beast/threads/impl/Thread.cpp b/beast/threads/impl/Thread.cpp index ebc5a4450..f04782d9b 100644 --- a/beast/threads/impl/Thread.cpp +++ b/beast/threads/impl/Thread.cpp @@ -439,9 +439,16 @@ void Thread::yield() #if BEAST_BSD // ??? #elif BEAST_MAC || BEAST_IOS -// Compiles fine without prctl.h +#include +#include +#import +namespace beast{ +#include "../../../modules/beast_core/native/osx_ObjCHelpers.h" +} + #else # include + #endif namespace beast { diff --git a/modules/beast_asio/async/AbstractHandler.h b/modules/beast_asio/async/AbstractHandler.h index f999b9e5d..7a92f5bf2 100644 --- a/modules/beast_asio/async/AbstractHandler.h +++ b/modules/beast_asio/async/AbstractHandler.h @@ -130,7 +130,7 @@ private: /** A reference counted, abstract completion handler. */ template > -class AbstractHandler; +struct AbstractHandler; //------------------------------------------------------------------------------ diff --git a/modules/beast_asio/async/SharedHandler.h b/modules/beast_asio/async/SharedHandler.h index 9a1c58ed1..ea9626553 100644 --- a/modules/beast_asio/async/SharedHandler.h +++ b/modules/beast_asio/async/SharedHandler.h @@ -62,14 +62,7 @@ public: virtual void operator() (error_code const&, std::size_t); template - void invoke (BOOST_ASIO_MOVE_ARG(Function) f) - { - // The allocator will hold a reference to the SharedHandler - // so that we can safely destroy the function object. - invoked_type invoked (f, - SharedHandlerAllocator (this)); - invoke (invoked); - } + void invoke (BEAST_MOVE_ARG(Function) f); virtual void invoke (invoked_type& invoked) = 0; virtual void* allocate (std::size_t size) = 0; diff --git a/modules/beast_asio/async/SharedHandlerAllocator.h b/modules/beast_asio/async/SharedHandlerAllocator.h index 41606f456..0c61b8b66 100644 --- a/modules/beast_asio/async/SharedHandlerAllocator.h +++ b/modules/beast_asio/async/SharedHandlerAllocator.h @@ -111,17 +111,13 @@ private: }; //------------------------------------------------------------------------------ - -#if 0 template -void SharedHandler::invoke (BOOST_ASIO_MOVE_ARG(Function) f) +void SharedHandler::invoke (BEAST_MOVE_ARG(Function) f) { // The allocator will hold a reference to the SharedHandler // so that we can safely destroy the function object. - invoked_type invoked (BOOST_ASIO_MOVE_CAST(Function)(f), - SharedHandlerAllocator (this)); + invoked_type invoked (f,SharedHandlerAllocator (this)); invoke (invoked); } -#endif #endif diff --git a/modules/beast_asio/sockets/SocketBase.h b/modules/beast_asio/sockets/SocketBase.h index 2881589bd..2504df37f 100644 --- a/modules/beast_asio/sockets/SocketBase.h +++ b/modules/beast_asio/sockets/SocketBase.h @@ -25,7 +25,7 @@ */ struct SocketBase { -protected: +public: typedef boost::system::error_code error_code; /** The error returned when a pure virtual is called. diff --git a/modules/beast_core/native/osx_ObjCHelpers.h b/modules/beast_core/native/osx_ObjCHelpers.h index 29f992296..42743eede 100644 --- a/modules/beast_core/native/osx_ObjCHelpers.h +++ b/modules/beast_core/native/osx_ObjCHelpers.h @@ -24,7 +24,6 @@ #ifndef BEAST_OSX_OBJCHELPERS_H_INCLUDED #define BEAST_OSX_OBJCHELPERS_H_INCLUDED - /* This file contains a few helper functions that are used internally but which need to be kept away from the public headers because they use obj-C symbols. */ diff --git a/modules/beast_core/system/BoostPlaceholdersFix.h b/modules/beast_core/system/BoostPlaceholdersFix.h index 5fbd1b613..2711c382b 100644 --- a/modules/beast_core/system/BoostPlaceholdersFix.h +++ b/modules/beast_core/system/BoostPlaceholdersFix.h @@ -29,7 +29,6 @@ # define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED #endif -#include #include #include