summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-10-02 08:05:06 -0700
committerThiago Macieira <thiago.macieira@intel.com>2024-10-03 18:54:32 -0700
commit20b6ebea84997ecd70d37640f68232c60cc7231f (patch)
tree29ed107a22a3c93c0ed49a95e5c8908f52fe24f0 /src
parente39ea199167270971f45ab6c4b9c2c6c66b4b2ff (diff)
qtformat_impl.h: #include <version> to get __cpp_lib_format
libstdc++ didn't #define it in any of the files that were indirectly included. Change-Id: Ib82948fc8ed0381d0311fffdc0508f2f334073a9 Reviewed-by: Ivan Solovev (OOO) <ivan.solovev@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qtformat_impl.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/corelib/io/qtformat_impl.h b/src/corelib/io/qtformat_impl.h
index 648d0a9afe2..a18e03c601f 100644
--- a/src/corelib/io/qtformat_impl.h
+++ b/src/corelib/io/qtformat_impl.h
@@ -12,13 +12,16 @@
#include <QtCore/qsystemdetection.h>
#include <QtCore/qtconfigmacros.h>
+#if __has_include(<version>)
+# include <version>
+#endif
+
// Users can disable std::format support in their
// projects by using this definition.
-#ifndef QT_NO_STD_FORMAT_SUPPORT
-
-#if (defined(__cpp_lib_format) && (__cpp_lib_format >= 202106L))
+#if !defined(QT_NO_STD_FORMAT_SUPPORT) && defined(__cpp_lib_format) && __cpp_lib_format >= 202106L
#include <format>
+
// If this macro is defined, std::format support is actually available.
// Use it to provide the implementation!
// Note that any out-of-line helper function should not depend on this
@@ -26,8 +29,6 @@
// to keep BC.
#define QT_SUPPORTS_STD_FORMAT 1
-#endif // __cpp_lib_format
-
-#endif // QT_NO_STD_FORMAT_SUPPORT
+#endif // __cpp_lib_format && !QT_NO_STD_FORMAT_SUPPORT
#endif // QTFORMAT_IMPL_H