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 "Config.h"
#include "Uncopyable.h"
namespace beast {

View File

@@ -257,22 +257,28 @@ std::string RelativeTime::to_string () const
}
namespace beast {
namespace detail {
#if BEAST_WINDOWS
#include <windows.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds()
{
return GetTickCount64() / 1000.0;
}
}
}
#elif BEAST_MAC || BEAST_IOS
#include <time.h>
#include <mach/mach_time.h>
#include <mach/mach.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds()
{
@@ -309,11 +315,16 @@ static double monotonicCurrentTimeInSeconds()
return mach_absolute_time() * data.ratio;
}
}
}
#else
#include <time.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds()
{
timespec t;
@@ -321,8 +332,14 @@ static double monotonicCurrentTimeInSeconds()
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()
{

View File

@@ -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)

View File

@@ -439,9 +439,16 @@ void Thread::yield()
#if BEAST_BSD
// ???
#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
# include <sys/prctl.h>
#endif
namespace beast {

View File

@@ -130,7 +130,7 @@ private:
/** A reference counted, abstract completion handler. */
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);
template <typename Function>
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 <char> (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;

View File

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

View File

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

View File

@@ -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.
*/

View File

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