chore(Core/Misc): Clean up workarounds (#17870)
* Clean advstd to use std c++20 features * Use ABORT instead of std::abort Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@
|
|||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
#include "Duration.h"
|
#include "Duration.h"
|
||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
#include "advstd.h"
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
@@ -90,7 +89,7 @@ class LambdaBasicEvent : public BasicEvent
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using is_lambda_event = std::enable_if_t<!std::is_base_of_v<BasicEvent, std::remove_pointer_t<advstd::remove_cvref_t<T>>>>;
|
using is_lambda_event = std::enable_if_t<!std::is_base_of_v<BasicEvent, std::remove_pointer_t<std::remove_cvref_t<T>>>>;
|
||||||
|
|
||||||
typedef std::multimap<uint64, BasicEvent*> EventList;
|
typedef std::multimap<uint64, BasicEvent*> EventList;
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
#ifndef _TYPES_H_
|
#ifndef _TYPES_H_
|
||||||
#define _TYPES_H_
|
#define _TYPES_H_
|
||||||
|
|
||||||
#include "advstd.h"
|
|
||||||
|
|
||||||
namespace Acore
|
namespace Acore
|
||||||
{
|
{
|
||||||
// end "iterator" tag for find_type_if
|
// end "iterator" tag for find_type_if
|
||||||
@@ -35,7 +33,7 @@ namespace Acore
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<template<typename...> typename Check, typename T1, typename... Ts>
|
template<template<typename...> typename Check, typename T1, typename... Ts>
|
||||||
struct find_type_if<Check, T1, Ts...> : std::conditional_t<Check<T1>::value, advstd::type_identity<T1>, find_type_if<Check, Ts...>>
|
struct find_type_if<Check, T1, Ts...> : std::conditional_t<Check<T1>::value, std::type_identity<T1>, find_type_if<Check, Ts...>>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,22 +24,6 @@
|
|||||||
// this namespace holds implementations of upcoming stdlib features that our c++ version doesn't have yet
|
// this namespace holds implementations of upcoming stdlib features that our c++ version doesn't have yet
|
||||||
namespace advstd
|
namespace advstd
|
||||||
{
|
{
|
||||||
// This workaround for std::remove_cvref_t, std::type_identify is needed for GCC 8...
|
|
||||||
/// @todo: remove when we drop GCC 8 support. https://en.cppreference.com/w/cpp/compiler_support/20
|
|
||||||
// C++20 advstd::remove_cvref_t
|
|
||||||
template <class T>
|
|
||||||
using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>;
|
|
||||||
|
|
||||||
// C++20 std::type_identity
|
|
||||||
template <typename T>
|
|
||||||
struct type_identity
|
|
||||||
{
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
// C++20 std::type_identity_t
|
|
||||||
template <typename T>
|
|
||||||
using type_identity_t = typename type_identity<T>::type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _ADV_STD_H_
|
#endif // _ADV_STD_H_
|
||||||
|
|||||||
@@ -581,7 +581,7 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo, uint8 attempts /*= 5*/)
|
|||||||
{
|
{
|
||||||
LOG_FATAL("sql.sql", "Could not re-prepare statements!");
|
LOG_FATAL("sql.sql", "Could not re-prepare statements!");
|
||||||
std::this_thread::sleep_for(10s);
|
std::this_thread::sleep_for(10s);
|
||||||
std::abort();
|
ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("sql.sql", "Successfully reconnected to {} @{}:{} ({}).",
|
LOG_INFO("sql.sql", "Successfully reconnected to {} @{}:{} ({}).",
|
||||||
@@ -600,7 +600,7 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo, uint8 attempts /*= 5*/)
|
|||||||
|
|
||||||
// We could also initiate a shutdown through using std::raise(SIGTERM)
|
// We could also initiate a shutdown through using std::raise(SIGTERM)
|
||||||
std::this_thread::sleep_for(10s);
|
std::this_thread::sleep_for(10s);
|
||||||
std::abort();
|
ABORT();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -624,12 +624,12 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo, uint8 attempts /*= 5*/)
|
|||||||
case ER_NO_SUCH_TABLE:
|
case ER_NO_SUCH_TABLE:
|
||||||
LOG_ERROR("sql.sql", "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
|
LOG_ERROR("sql.sql", "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
|
||||||
std::this_thread::sleep_for(10s);
|
std::this_thread::sleep_for(10s);
|
||||||
std::abort();
|
ABORT();
|
||||||
return false;
|
return false;
|
||||||
case ER_PARSE_ERROR:
|
case ER_PARSE_ERROR:
|
||||||
LOG_ERROR("sql.sql", "Error while parsing SQL. Core fix required.");
|
LOG_ERROR("sql.sql", "Error while parsing SQL. Core fix required.");
|
||||||
std::this_thread::sleep_for(10s);
|
std::this_thread::sleep_for(10s);
|
||||||
std::abort();
|
ABORT();
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("sql.sql", "Unhandled MySQL errno {}. Unexpected behaviour possible.", errNo);
|
LOG_ERROR("sql.sql", "Unhandled MySQL errno {}. Unexpected behaviour possible.", errNo);
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "Optional.h"
|
#include "Optional.h"
|
||||||
#include "StringFormat.h"
|
#include "StringFormat.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "advstd.h"
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
@@ -115,7 +114,7 @@ namespace Acore::Impl::ChatCommands
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> struct HandlerToTuple { static_assert(Acore::dependant_false_v<T>, "Invalid command handler signature"); };
|
template <typename T> struct HandlerToTuple { static_assert(Acore::dependant_false_v<T>, "Invalid command handler signature"); };
|
||||||
template <typename... Ts> struct HandlerToTuple<bool(ChatHandler*, Ts...)> { using type = std::tuple<ChatHandler*, advstd::remove_cvref_t<Ts>...>; };
|
template <typename... Ts> struct HandlerToTuple<bool(ChatHandler*, Ts...)> { using type = std::tuple<ChatHandler*, std::remove_cvref_t<Ts>...>; };
|
||||||
template <typename T> using TupleType = typename HandlerToTuple<T>::type;
|
template <typename T> using TupleType = typename HandlerToTuple<T>::type;
|
||||||
|
|
||||||
struct CommandInvoker
|
struct CommandInvoker
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
#include "Optional.h"
|
#include "Optional.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "advstd.h"
|
|
||||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -204,7 +203,7 @@ namespace Acore::ChatCommands
|
|||||||
struct Hyperlink : Acore::Impl::ChatCommands::ContainerTag
|
struct Hyperlink : Acore::Impl::ChatCommands::ContainerTag
|
||||||
{
|
{
|
||||||
using value_type = typename linktag::value_type;
|
using value_type = typename linktag::value_type;
|
||||||
using storage_type = advstd::remove_cvref_t<value_type>;
|
using storage_type = std::remove_cvref_t<value_type>;
|
||||||
|
|
||||||
operator value_type() const { return val; }
|
operator value_type() const { return val; }
|
||||||
value_type operator*() const { return val; }
|
value_type operator*() const { return val; }
|
||||||
|
|||||||
Reference in New Issue
Block a user