From dd59118b87d779e5cbfcd0b4ee2a3d5332433da9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Jul 2016 11:18:41 +0200 Subject: [PATCH] move c++11 test into qcompilerdetection.h and make it stricter it positively makes no sense to have a configure test which will be never reached due to the configure/qmake bootstrap failing with a slew of totally unhelpful error messages. pre-standardization partial c++11 implementations are now rejected, except for VS2013, which is still sufficient despite not announcing full compatibility. Change-Id: I58af10e03960af06b80cedac105cf8433f7a1745 Reviewed-by: Thiago Macieira --- config.tests/common/c++11/c++11.cpp | 49 ------------------------- config.tests/common/c++11/c++11.pro | 3 -- configure | 6 +-- src/corelib/global/qcompilerdetection.h | 6 +++ tools/configure/configureapp.cpp | 7 +--- 5 files changed, 8 insertions(+), 63 deletions(-) delete mode 100644 config.tests/common/c++11/c++11.cpp delete mode 100644 config.tests/common/c++11/c++11.pro diff --git a/config.tests/common/c++11/c++11.cpp b/config.tests/common/c++11/c++11.cpp deleted file mode 100644 index 88b67b5bff..0000000000 --- a/config.tests/common/c++11/c++11.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the configuration of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__INTEL_CXX11_MODE__) -// Compiler claims to support C++11, trust it -#else -# error "__cplusplus must be >= 201103L, or one of __GXX_EXPERIMENTAL_CXX0X__ or __INTEL_CXX11_MODE__ must be defined" -#endif - -#include -#include - -int main(int, char **) { return std::move(0); } diff --git a/config.tests/common/c++11/c++11.pro b/config.tests/common/c++11/c++11.pro deleted file mode 100644 index 3620f99c71..0000000000 --- a/config.tests/common/c++11/c++11.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = c++11.cpp -CONFIG += c++11 console -CONFIG -= qt diff --git a/configure b/configure index f2822503c4..0ba0c31e4a 100755 --- a/configure +++ b/configure @@ -4430,11 +4430,7 @@ fi # Detect C++11 & up support stdcxx_error=false -if ! compileTest common/c++11 "C++11"; then - echo "ERROR: Qt requires a C++11 compiler and yours does not seem to be that." - echo "Please upgrade." - exit 1 -elif [ "$CFG_STDCXX" = "c++11" ]; then +if [ "$CFG_STDCXX" = "c++11" ]; then : # CFG_STDCXX is correct elif ! compileTest common/c++14 "C++14"; then if [ "$CFG_STDCXX" != "auto" ]; then diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e152786d3f..285931e794 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -557,6 +557,12 @@ * Q_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays */ +#ifdef __cplusplus +# if __cplusplus < 201103L && !(defined(Q_CC_MSVC) && Q_CC_MSVC >= 1800) +# error Qt requires a C++11 compiler and yours does not seem to be that. +# endif +#endif + #ifdef Q_CC_INTEL # define Q_COMPILER_RESTRICTED_VLA # define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index a89e66c377..0fa205bd98 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2310,12 +2310,7 @@ void Configure::autoDetection() detectArch(); if (dictionary["C++STD"] == "auto" && !dictionary["QMAKESPEC"].contains("msvc")) { - if (!tryCompileProject("common/c++11")) { - dictionary["DONE"] = "error"; - cout << "ERROR: Qt requires a C++11 compiler and yours does not seem to be that." << endl - << "Please upgrade." << endl; - return; - } else if (!tryCompileProject("common/c++14")) { + if (!tryCompileProject("common/c++14")) { dictionary["C++STD"] = "c++11"; } else if (!tryCompileProject("common/c++1z")) { dictionary["C++STD"] = "c++14";