Fix clang compile

This commit is contained in:
NATTSiM
2013-12-18 12:52:08 -08:00
committed by Vinnie Falco
parent 893b2d4587
commit eb19343f91
10 changed files with 36 additions and 25 deletions

View File

@@ -27,6 +27,7 @@
#include <cstring> #include <cstring>
#include "Config.h" #include "Config.h"
#include "Uncopyable.h"
namespace beast { namespace beast {

View File

@@ -257,22 +257,28 @@ std::string RelativeTime::to_string () const
} }
namespace beast {
namespace detail {
#if BEAST_WINDOWS #if BEAST_WINDOWS
#include <windows.h> #include <windows.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds() static double monotonicCurrentTimeInSeconds()
{ {
return GetTickCount64() / 1000.0; return GetTickCount64() / 1000.0;
} }
}
}
#elif BEAST_MAC || BEAST_IOS #elif BEAST_MAC || BEAST_IOS
#include <time.h> #include <mach/mach_time.h>
#include <mach/mach.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds() static double monotonicCurrentTimeInSeconds()
{ {
@@ -309,11 +315,16 @@ static double monotonicCurrentTimeInSeconds()
return mach_absolute_time() * data.ratio; return mach_absolute_time() * data.ratio;
} }
}
}
#else #else
#include <time.h> #include <time.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds() static double monotonicCurrentTimeInSeconds()
{ {
timespec t; timespec t;
@@ -321,8 +332,14 @@ static double monotonicCurrentTimeInSeconds()
return t.tv_sec + t.tv_nsec / 1000000000.0; return t.tv_sec + t.tv_nsec / 1000000000.0;
} }
}
}
#endif #endif
namespace beast {
namespace detail {
// Records and returns the time from process startup // Records and returns the time from process startup
static double getStartupTime() static double getStartupTime()
{ {

View File

@@ -174,7 +174,6 @@
#ifdef __clang__ #ifdef __clang__
#define BEAST_CLANG 1 #define BEAST_CLANG 1
#define BEAST_GCC 1
#elif defined (__GNUC__) #elif defined (__GNUC__)
#define BEAST_GCC 1 #define BEAST_GCC 1
#elif defined (_MSC_VER) #elif defined (_MSC_VER)

View File

@@ -439,9 +439,16 @@ void Thread::yield()
#if BEAST_BSD #if BEAST_BSD
// ??? // ???
#elif BEAST_MAC || BEAST_IOS #elif BEAST_MAC || BEAST_IOS
// Compiles fine without prctl.h #include <Foundation/NSThread.h>
#include <Foundation/NSString.h>
#import <objc/message.h>
namespace beast{
#include "../../../modules/beast_core/native/osx_ObjCHelpers.h"
}
#else #else
# include <sys/prctl.h> # include <sys/prctl.h>
#endif #endif
namespace beast { namespace beast {

View File

@@ -130,7 +130,7 @@ private:
/** A reference counted, abstract completion handler. */ /** A reference counted, abstract completion handler. */
template <typename Signature, class Allocator = std::allocator <char> > template <typename Signature, class Allocator = std::allocator <char> >
class AbstractHandler; struct AbstractHandler;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -62,14 +62,7 @@ public:
virtual void operator() (error_code const&, std::size_t); virtual void operator() (error_code const&, std::size_t);
template <typename Function> template <typename Function>
void invoke (BOOST_ASIO_MOVE_ARG(Function) f) void 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 (f,
SharedHandlerAllocator <char> (this));
invoke (invoked);
}
virtual void invoke (invoked_type& invoked) = 0; virtual void invoke (invoked_type& invoked) = 0;
virtual void* allocate (std::size_t size) = 0; virtual void* allocate (std::size_t size) = 0;

View File

@@ -111,17 +111,13 @@ private:
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if 0
template <typename Function> template <typename Function>
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 // The allocator will hold a reference to the SharedHandler
// so that we can safely destroy the function object. // so that we can safely destroy the function object.
invoked_type invoked (BOOST_ASIO_MOVE_CAST(Function)(f), invoked_type invoked (f,SharedHandlerAllocator <char> (this));
SharedHandlerAllocator <char> (this));
invoke (invoked); invoke (invoked);
} }
#endif
#endif #endif

View File

@@ -25,7 +25,7 @@
*/ */
struct SocketBase struct SocketBase
{ {
protected: public:
typedef boost::system::error_code error_code; typedef boost::system::error_code error_code;
/** The error returned when a pure virtual is called. /** The error returned when a pure virtual is called.

View File

@@ -24,7 +24,6 @@
#ifndef BEAST_OSX_OBJCHELPERS_H_INCLUDED #ifndef BEAST_OSX_OBJCHELPERS_H_INCLUDED
#define BEAST_OSX_OBJCHELPERS_H_INCLUDED #define BEAST_OSX_OBJCHELPERS_H_INCLUDED
/* This file contains a few helper functions that are used internally but which /* 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. need to be kept away from the public headers because they use obj-C symbols.
*/ */

View File

@@ -29,7 +29,6 @@
# define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED # define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
#endif #endif
#include <boost/version.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/bind/arg.hpp> #include <boost/bind/arg.hpp>