From 73e7f0fe6d5ea2c75ad452effe9d7b95dd323ea2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 5 Jan 2023 12:16:21 +0100 Subject: Core/Misc: Added a include hack for msvc to use only c++17 bits from it (cherry picked from commit 585900f42d064b9f6adc08015605931163ea79c8) --- src/common/Logging/Log.cpp | 2 +- src/common/Utilities/ByteConverter.h | 5 +++-- src/common/Utilities/Duration.h | 5 +++++ src/common/Utilities/TaskScheduler.h | 1 - 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index c4a00af8c9e..96dadcb82c5 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -20,6 +20,7 @@ #include "AppenderFile.h" #include "Common.h" #include "Config.h" +#include "Duration.h" #include "Errors.h" #include "Logger.h" #include "LogMessage.h" @@ -27,7 +28,6 @@ #include "Strand.h" #include "StringConvert.h" #include "Util.h" -#include #include Log::Log() : AppenderId(0), lowestLogLevel(LOG_LEVEL_FATAL), _ioContext(nullptr), _strand(nullptr) diff --git a/src/common/Utilities/ByteConverter.h b/src/common/Utilities/ByteConverter.h index 59be4adb86b..d9b74b83264 100644 --- a/src/common/Utilities/ByteConverter.h +++ b/src/common/Utilities/ByteConverter.h @@ -23,14 +23,15 @@ */ #include "Define.h" -#include namespace ByteConverter { template inline void convert(char *val) { - std::swap(*val, *(val + T - 1)); + char tmp = *val; + *val = *(val + T - 1); + *(val + T - 1) = tmp; convert(val + 1); } diff --git a/src/common/Utilities/Duration.h b/src/common/Utilities/Duration.h index f506467abda..b4c3f17cb3e 100644 --- a/src/common/Utilities/Duration.h +++ b/src/common/Utilities/Duration.h @@ -18,7 +18,12 @@ #ifndef _DURATION_H_ #define _DURATION_H_ +// HACKS TERRITORY +#if __has_include(<__msvc_chrono.hpp>) +#include <__msvc_chrono.hpp> // skip all the formatting/istream/locale/mutex bloat +#else #include +#endif /// Milliseconds shorthand typedef. typedef std::chrono::milliseconds Milliseconds; diff --git a/src/common/Utilities/TaskScheduler.h b/src/common/Utilities/TaskScheduler.h index 6bd50cf5b6d..4d6761780be 100644 --- a/src/common/Utilities/TaskScheduler.h +++ b/src/common/Utilities/TaskScheduler.h @@ -22,7 +22,6 @@ #include "Optional.h" #include "Random.h" #include -#include #include #include #include -- cgit v1.2.3