Skip to content

Commit 51e70f6

Browse files
fix compilation error on windows.
1 parent 28fb763 commit 51e70f6

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/tglobal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ constexpr auto WriteOnly = QIODeviceBase::WriteOnly;
256256
#include <cstring>
257257
#include <functional>
258258
#include <algorithm>
259-
#if __cplusplus >= 202002L && __has_include(<format>)
259+
#if defined(__cpp_lib_format) // std::format
260260
# include <format>
261261
#endif
262262

@@ -300,7 +300,7 @@ inline bool strcmp(const QByteArray &str1, const QByteArray &str2)
300300
return str1.length() == str2.length() && !std::strncmp(str1.data(), str2.data(), str1.length());
301301
}
302302

303-
#if __cplusplus >= 202002L && __has_include(<format>)
303+
#if defined(__cpp_lib_format) // std::format
304304

305305
// Logging for developer
306306
template<typename... Args>

src/tsystemglobal.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
#include <QSettings>
44
#include <QVariant>
55
#include <TGlobal>
6-
#if __cplusplus >= 202002L && __has_include(<format>)
7-
#include <format>
8-
#endif
9-
#include <tuple>
106

117
class TSystemLogger;
128
class TAccessLog;
@@ -25,7 +21,7 @@ T_CORE_EXPORT void writeAccessLog(const TAccessLog &log); // write access log
2521
T_CORE_EXPORT void writeQueryLog(const QString &query, bool success, const QSqlError &error, int duration);
2622
T_CORE_EXPORT void traceQuery(int duration, const std::string &msg);
2723

28-
#if __cplusplus >= 202002L && __has_include(<format>)
24+
#if defined(__cpp_lib_format) // std::format
2925

3026
template<typename... Args>
3127
void traceQueryLog(int duration, const std::format_string<Args...> &fmt, Args&&... args)
@@ -57,7 +53,7 @@ enum SystemOpCode {
5753
T_CORE_EXPORT QMap<QString, QVariant> settingsToMap(QSettings &settings, const QString &env = QString());
5854
}
5955

60-
#if __cplusplus >= 202002L && __has_include(<format>)
56+
#if defined(__cpp_lib_format) // std::format
6157

6258
template<typename... Args>
6359
void tSystemError(const std::format_string<Args...> &fmt, Args&&... args)
@@ -105,8 +101,8 @@ void tSystemInfo(const std::string &fmt, Args&&... args)
105101

106102
#endif
107103

108-
#if !defined(TF_NO_DEBUG)
109-
#if __cplusplus >= 202002L && __has_include(<format>)
104+
#ifndef TF_NO_DEBUG
105+
#if defined(__cpp_lib_format) // std::format
110106

111107
template<typename... Args>
112108
void tSystemDebug(const std::format_string<Args...> &fmt, Args&&... args)

0 commit comments

Comments
 (0)