Add workaround/noexcept.h for visual studio

This commit is contained in:
Vinnie Falco
2014-03-18 16:53:17 -07:00
parent 18486169b3
commit 8b659a6d32
16 changed files with 69 additions and 37 deletions

View File

@@ -248,6 +248,7 @@
<ClInclude Include="..\..\beast\utility\PropertyStream.h" />
<ClInclude Include="..\..\beast\utility\StaticObject.h" />
<ClInclude Include="..\..\beast\Version.h" />
<ClInclude Include="..\..\beast\workaround\noexcept.h" />
<ClInclude Include="..\..\modules\beast_asio\async\AsyncObject.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\FixedInputBuffer.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\PeerRole.h" />

View File

@@ -315,6 +315,9 @@
<Filter Include="beast\asio\tests">
<UniqueIdentifier>{f2594738-6447-447b-8f51-2d42fbe8a6ee}</UniqueIdentifier>
</Filter>
<Filter Include="beast\workaround">
<UniqueIdentifier>{84acd0d5-5531-470e-b9a7-42af9003aa64}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
@@ -1323,6 +1326,12 @@
<Filter>beast\http</Filter>
</ClInclude>
<ClInclude Include="..\..\BeastConfig.h" />
<ClInclude Include="..\..\beast\container\cyclic_iterator.h">
<Filter>beast\container</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\workaround\noexcept.h">
<Filter>beast\workaround</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\modules\beast_core\containers\DynamicObject.cpp">

View File

@@ -27,6 +27,8 @@
#include "Config.h"
#include "CStdInt.h"
#include "workaround/noexcept.h"
#include <cmath>
#include <algorithm>

View File

@@ -28,6 +28,8 @@
#include "CStdInt.h"
#include "StaticAssert.h"
#include "workaround/noexcept.h"
namespace beast {
//==============================================================================

View File

@@ -22,6 +22,7 @@
#include <boost/asio/buffer.hpp>
#include "../workaround/noexcept.h"
#include <algorithm>
#include <iterator>
#include "../cxx14/type_traits.h" // <type_traits>

View File

@@ -24,6 +24,7 @@
#include <boost/asio/buffer.hpp>
#include "../workaround/noexcept.h"
#include <cstddef>
#include <memory>
#include <type_traits>

View File

@@ -24,16 +24,16 @@
#include "../mpl/IsCallPossible.h"
#include <functional>
#include <memory>
#include "../cxx14/type_traits.h" // <type_traits>
#include <boost/utility/base_from_member.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include "../workaround/noexcept.h"
#include <functional>
#include <memory>
#include "../cxx14/type_traits.h" // <type_traits>
#ifndef BEAST_ASIO_NO_ALLOCATE_SHARED
#define BEAST_ASIO_NO_ALLOCATE_SHARED 0
#endif

View File

@@ -23,6 +23,8 @@
#include "abstract_socket.h"
#include "bind_handler.h"
#include "../workaround/noexcept.h"
namespace beast {
namespace asio {

View File

@@ -27,6 +27,7 @@
#include "../Config.h"
#include "../strings/String.h"
#include "../workaround/noexcept.h"
#include <string>
#include <sstream>

View File

@@ -20,10 +20,11 @@
#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
#define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
#include <chrono>
#include "chrono_io.h"
#include <chrono>
#include <string>
namespace beast {
/** Abstract interface to a clock.

View File

@@ -29,6 +29,7 @@
#include "../Config.h"
#include "../workaround/noexcept.h"
#include <ctime>
#include <locale>

View File

@@ -278,35 +278,10 @@ extern void beast_reportFatalError (char const* message, char const* fileName, i
# define BEAST_MOVE_CAST(type) type
#endif
//------------------------------------------------------------------------------
// Declare some fake versions of nullptr and noexcept, for older compilers:
#if ! (DOXYGEN || BEAST_COMPILER_SUPPORTS_NOEXCEPT)
# ifdef noexcept
# undef noexcept
# endif
# define noexcept throw()
# if defined (_MSC_VER) && _MSC_VER > 1600
# define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining)
# endif
#endif
#if ! (DOXYGEN || BEAST_COMPILER_SUPPORTS_NULLPTR)
#ifdef nullptr
#undef nullptr
#endif
#define nullptr (0)
#endif
#if ! (DOXYGEN || BEAST_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL)
#undef override
#define override
#endif
#ifdef __cplusplus
namespace beast {
bool beast_isRunningUnderDebugger();
void logAssertion (char const* file, int line) noexcept;
void logAssertion (char const* file, int line);
}
#endif

View File

@@ -19,6 +19,4 @@
// Microsoft Visual C++ compiler configuration
#ifndef noexcept
# define noexcept throw()
#endif
#include "../../workaround/noexcept.h"

View File

@@ -20,6 +20,7 @@
#ifndef BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
#define BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
#include "../workaround/noexcept.h"
#include <type_traits>
#include <utility>

View File

@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Portions of this file are from JUCE.
Copyright (c) 2013 - Raw Material Software Ltd.
Please visit http://www.juce.com
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_WORKAROUND_NOEXCEPT_H_INCLUDED
#define BEAST_WORKAROUND_NOEXCEPT_H_INCLUDED
#ifdef _MSC_VER
# ifdef noexcept
# undef noexcept
# endif
# define noexcept throw()
# if _MSC_VER > 1600 && ! _ALLOW_KEYWORD_MACROS
# define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining)
# endif
#endif
#endif

View File

@@ -47,7 +47,7 @@ void Logger::writeToLog (const String& message)
}
#if BEAST_LOG_ASSERTIONS || BEAST_DEBUG
void logAssertion (const char* const filename, const int lineNum) noexcept
void logAssertion (const char* const filename, const int lineNum)
{
String m ("BEAST Assertion failure in ");
m << File::createFileWithoutCheckingPath (filename).getFileName() << ':' << lineNum;