Skip to content

Commit bb0f8c0

Browse files
fix compilation error.
1 parent 114a91d commit bb0f8c0

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/tglobal.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ constexpr auto WriteOnly = QIODeviceBase::WriteOnly;
248248
#endif
249249
}
250250

251+
252+
#if defined(__cpp_lib_format) || (defined(_MSC_VER) && _MSC_VER >= 1930) // std::format
253+
#define TF_HAVE_STD_FORMAT
254+
#endif
255+
251256
#include "tfexception.h"
252257
#include "tfnamespace.h"
253258
#include "tdeclexport.h"
@@ -256,8 +261,8 @@ constexpr auto WriteOnly = QIODeviceBase::WriteOnly;
256261
#include <cstring>
257262
#include <functional>
258263
#include <algorithm>
259-
#if defined(__cpp_lib_format) // std::format
260-
# include <format>
264+
#ifdef TF_HAVE_STD_FORMAT // std::format
265+
#include <format>
261266
#endif
262267

263268
class TWebApplication;
@@ -300,7 +305,7 @@ inline bool strcmp(const QByteArray &str1, const QByteArray &str2)
300305
return str1.length() == str2.length() && !std::strncmp(str1.data(), str2.data(), str1.length());
301306
}
302307

303-
#if defined(__cpp_lib_format) // std::format
308+
#ifdef TF_HAVE_STD_FORMAT // std::format
304309

305310
// Logging for developer
306311
template<typename... Args>

src/tsystemglobal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ T_CORE_EXPORT void writeAccessLog(const TAccessLog &log); // write access log
2121
T_CORE_EXPORT void writeQueryLog(const QString &query, bool success, const QSqlError &error, int duration);
2222
T_CORE_EXPORT void traceQuery(int duration, const std::string &msg);
2323

24-
#if defined(__cpp_lib_format) // std::format
24+
#ifdef TF_HAVE_STD_FORMAT // std::format
2525

2626
template<typename... Args>
2727
void traceQueryLog(int duration, const std::format_string<Args...> &fmt, Args&&... args)
@@ -53,7 +53,7 @@ enum SystemOpCode {
5353
T_CORE_EXPORT QMap<QString, QVariant> settingsToMap(QSettings &settings, const QString &env = QString());
5454
}
5555

56-
#if defined(__cpp_lib_format) // std::format
56+
#ifdef TF_HAVE_STD_FORMAT // std::format
5757

5858
template<typename... Args>
5959
void tSystemError(const std::format_string<Args...> &fmt, Args&&... args)
@@ -102,7 +102,7 @@ void tSystemInfo(const std::string &fmt, Args&&... args)
102102
#endif
103103

104104
#ifndef TF_NO_DEBUG
105-
#if defined(__cpp_lib_format) // std::format
105+
#ifdef TF_HAVE_STD_FORMAT // std::format
106106

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

0 commit comments

Comments
 (0)