From 0f0b9bd2cf9518b9fb993cf22137871870092055 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 3 Mar 2023 23:22:52 +0200 Subject: [PATCH] QCompilerDetection: fix compiler warning about undefined macro build/include/QtCore/../../../src/corelib/global/qcompilerdetection.h:546:7: warning: '__cplusplus' is not defined, evaluates to 0 [-Wundef] # if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) ^ build/include/QtCore/../../../src/corelib/global/qcompilerdetection.h:648:7: warning: '__cplusplus' is not defined, evaluates to 0 [-Wundef]. # if __cplusplus > 201103L ^ Change-Id: I8ed8e0c4b93977238986df0b3339ffae4d1d0fda Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 450ba19e01..768d3ed6ce 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -543,7 +543,8 @@ # endif /* C++11 features, see http://clang.llvm.org/cxx_status.html */ -# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) +# if (defined(__cplusplus) && __cplusplus >= 201103L) \ + || defined(__GXX_EXPERIMENTAL_CXX0X__) /* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */ # if __has_feature(cxx_alignas) # define Q_COMPILER_ALIGNAS @@ -641,10 +642,10 @@ # if Q_CC_CLANG >= 209 /* since clang 2.9 */ # define Q_COMPILER_EXTERN_TEMPLATES # endif -# endif +# endif // (defined(__cplusplus) && __cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__) /* C++1y features, deprecated macros. Do not update this list. */ -# if __cplusplus > 201103L +# if defined(__cplusplus) && __cplusplus > 201103L //# if __has_feature(cxx_binary_literals) //# define Q_COMPILER_BINARY_LITERALS // see above //# endif @@ -666,7 +667,7 @@ # if __has_feature(cxx_runtime_array) # define Q_COMPILER_VLA # endif -# endif +# endif // if defined(__cplusplus) && __cplusplus > 201103L # if defined(__STDC_VERSION__) # if __has_feature(c_static_assert)