Use more C++11 features:

* Remove beast::static_initializer
* Remove noexcept VS2013 workaround
* Use [[noreturn]] attribute
This commit is contained in:
Nik Bougalis
2015-10-06 12:38:26 -07:00
parent b7c3b96516
commit 570bb2e139
89 changed files with 113 additions and 969 deletions

View File

@@ -19,18 +19,21 @@
#include <BeastConfig.h>
#include <ripple/basics/contract.h>
#include <cstdlib>
#include <exception>
namespace ripple {
namespace detail {
[[noreturn]]
void
accessViolation()
accessViolation() noexcept
{
// dereference memory
// location zero
// dereference memory location zero
int volatile* j = 0;
(void)*j;
std::abort ();
}
// This hook lets you do pre or post
@@ -43,8 +46,9 @@ throwException (std::exception_ptr ep)
} // detail
[[noreturn]]
void
LogicError (std::string const&)
LogicError (std::string const&) noexcept
{
detail::accessViolation();
}

View File

@@ -22,7 +22,6 @@
#include <ripple/basics/chrono.h>
#include <beast/container/aged_unordered_set.h>
#include <beast/module/core/diagnostic/FatalError.h>
#include <beast/utility/static_initializer.h>
#include <cstdint>
#include <sstream>
#include <stdexcept>
@@ -323,9 +322,7 @@ disallowRenegotiation (SSL const* ssl, bool isNew)
// Do not allow a connection to renegotiate
// more than once every 4 minutes
static beast::static_initializer <StaticData> static_data;
auto& sd (static_data.get ());
static StaticData sd;
std::lock_guard <std::mutex> lock (sd.lock);
auto const expired (sd.set.clock().now() - std::chrono::minutes(4));