From a300c3810cd1e91a3946447aaa3bce9e6b8b278f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 1 Feb 2022 11:14:57 +0100 Subject: [PATCH] Detect clang-cl features as clang not as msvc Clang-cl supports the clang detections, and only approximates specific MSVC version. This works as the MSVC standard library is ahead of the clang standard library. Where this logic was written 7 years ago when it was not the case. Pick-to: 6.3 Change-Id: Ic13e2f2fbcde011a0d8831cc48c0c9041bfe3b99 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index bfa4f89105f..00b55c7ab49 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -626,7 +626,7 @@ # endif #endif -#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !defined(Q_CC_MSVC) +#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) /* General C++ features */ # define Q_COMPILER_RESTRICTED_VLA # if __has_feature(attribute_deprecated_with_message) @@ -785,14 +785,11 @@ # endif # endif -#endif // Q_CC_CLANG && !Q_CC_INTEL && !Q_CC_MSVC - -#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) # ifndef Q_DECL_UNUSED # define Q_DECL_UNUSED __attribute__((__unused__)) # endif # define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED -#endif +#endif // defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) # define Q_COMPILER_RESTRICTED_VLA @@ -897,7 +894,7 @@ # endif #endif -#if defined(Q_CC_MSVC) +#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) # if defined(__cplusplus) /* C++11 features supported in VC8 = VC2005: */ # define Q_COMPILER_VARIADIC_MACROS @@ -955,7 +952,7 @@ # define Q_COMPILER_CONSTEXPR # endif # endif /* __cplusplus */ -#endif /* Q_CC_MSVC */ +#endif // defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) #ifdef Q_COMPILER_UNICODE_STRINGS # define Q_STDLIB_UNICODE_STRINGS