diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-11-10 09:44:30 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-12-01 06:59:16 +0000 |
commit | 83bf81fd73b433e39405dbab124c144f77001fa4 (patch) | |
tree | eb68ef8b0b0e68a449c06ab48f3859771f510382 | |
parent | 2fa63f352ae9094e6fd12537bffb9ff0b9b2b64a (diff) |
qcompilerdetection.h: include <version>
...and update the documentation for how we detect post-C++11 features,
as proposed on the mailing-list:
https://lists.qt-project.org/pipermail/development/2022-November/043248.html
According to https://en.cppreference.com/w/cpp/compiler_support,
<version> is available from
- libstdc++ from GCC 9
- libc++ from LLVM 7
- MSVC 19.22 = VS 2019 16.2
- AppleClang 10 = Xcode 10.0 beta (10L176w), 10.0 (10A255), 10.1 (10B61)
It is _not_ available on
- GHS 22.1.4
- GCC 8.3.0 (as used by QNX 7.1, but the default is libc++)
Task-number: QTBUG-108228
Change-Id: I61e0727573d1b4559228e3f5bd58d73e86a9256e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b2ed29b8d9b33dcece83000aee28073dd27f1cd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 81477b2ff0..f811f52ca7 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -445,6 +445,12 @@ #define QT_HAS_INCLUDE(x) __has_include(x) #define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x) +#ifdef __cplusplus +# if __has_include(<version>) /* remove this check once Integrity, QNX have caught up */ +# include <version> +# endif +#endif + /* * C++11 support * @@ -485,10 +491,16 @@ * N1653 Q_COMPILER_VARIADIC_MACROS * N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES __cpp_variadic_templates = 200704 * - * For any future version of the C++ standard, we use only the SD-6 macro. + * + * For the C++ standards C++14 and C++17, we use only the SD-6 macro. * For full listing, see * http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations * + * For any future version of the C++ standard, we use only the C++20 feature test macro. + * For library features, we assume <version> is present (this header includes it). + * For full listing, see + * https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros + * * C++ extensions: * Q_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays */ |