diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-09-27 10:18:44 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-10-08 09:07:56 +0000 |
commit | 5900766ecb6aa25f363660c5ad2ef15777db5053 (patch) | |
tree | 1d6b10063dd286b16442e84e9fef11706f8a4c45 /src/plugins/qmakeprojectmanager | |
parent | 9192b6b024d9cdff1493e0d23fee43175825a59c (diff) | |
download | qt-creator-5900766ecb6aa25f363660c5ad2ef15777db5053.tar.gz |
Toolchains: Detect unspecified language version
We checked the command line from the project manager for "-std=X" and
friends to figure out the language version to use. However, if such a
flag was not provided, we assumed the latest version we support. This
could conflict with the actual version of the compiler and its
predefined macros.
Figure out the version by inspecting __cplusplus/__STDC_VERSION__ in the
predefined macros of the toolchain. The MSVC compiler is an exception to
this, as it does not seem to properly set the value - check for
_MSVC_LANG if possible, otherwise simply assume some versions as before.
While at it, add also support for C17/C18 and the upcoming C++2a.
Task-number: QTCREATORBUG-20884
Task-number: QTCREATORBUG-21188
Change-Id: I464ffcd52d2120c0208275a050e82efda44fae1c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/plugins/qmakeprojectmanager')
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakeproject.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index e825d600a2..2547797780 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -277,10 +277,8 @@ void QmakeProject::updateCppCodeModel() QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k); ProjectPart::QtVersion qtVersionForPart = ProjectPart::NoQt; if (qtVersion) { - if (qtVersion->qtVersion() <= QtSupport::QtVersionNumber(4,8,6)) - qtVersionForPart = ProjectPart::Qt4_8_6AndOlder; - else if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0)) - qtVersionForPart = ProjectPart::Qt4Latest; + if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0)) + qtVersionForPart = ProjectPart::Qt4; else qtVersionForPart = ProjectPart::Qt5; } |