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 <thiago.macieira@intel.com>
This commit is contained in:
Oswald Buddenhagen 2016-07-07 11:18:41 +02:00
parent b5153d5bfa
commit dd59118b87
5 changed files with 8 additions and 63 deletions

View File

@ -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 <utility>
#include <initializer_list>
int main(int, char **) { return std::move(0); }

View File

@ -1,3 +0,0 @@
SOURCES = c++11.cpp
CONFIG += c++11 console
CONFIG -= qt

6
configure vendored
View File

@ -4430,11 +4430,7 @@ fi
# Detect C++11 & up support # Detect C++11 & up support
stdcxx_error=false stdcxx_error=false
if ! compileTest common/c++11 "C++11"; then if [ "$CFG_STDCXX" = "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
: # CFG_STDCXX is correct : # CFG_STDCXX is correct
elif ! compileTest common/c++14 "C++14"; then elif ! compileTest common/c++14 "C++14"; then
if [ "$CFG_STDCXX" != "auto" ]; then if [ "$CFG_STDCXX" != "auto" ]; then

View File

@ -557,6 +557,12 @@
* Q_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays * 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 #ifdef Q_CC_INTEL
# define Q_COMPILER_RESTRICTED_VLA # define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too # define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too

View File

@ -2310,12 +2310,7 @@ void Configure::autoDetection()
detectArch(); detectArch();
if (dictionary["C++STD"] == "auto" && !dictionary["QMAKESPEC"].contains("msvc")) { if (dictionary["C++STD"] == "auto" && !dictionary["QMAKESPEC"].contains("msvc")) {
if (!tryCompileProject("common/c++11")) { if (!tryCompileProject("common/c++14")) {
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")) {
dictionary["C++STD"] = "c++11"; dictionary["C++STD"] = "c++11";
} else if (!tryCompileProject("common/c++1z")) { } else if (!tryCompileProject("common/c++1z")) {
dictionary["C++STD"] = "c++14"; dictionary["C++STD"] = "c++14";