forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -110,11 +110,13 @@ QString Utils::toString(ProjectPart::LanguageVersion languageVersion)
|
||||
CASE_LANGUAGEVERSION(C89);
|
||||
CASE_LANGUAGEVERSION(C99);
|
||||
CASE_LANGUAGEVERSION(C11);
|
||||
CASE_LANGUAGEVERSION(C18);
|
||||
CASE_LANGUAGEVERSION(CXX98);
|
||||
CASE_LANGUAGEVERSION(CXX03);
|
||||
CASE_LANGUAGEVERSION(CXX11);
|
||||
CASE_LANGUAGEVERSION(CXX14);
|
||||
CASE_LANGUAGEVERSION(CXX17);
|
||||
CASE_LANGUAGEVERSION(CXX2a);
|
||||
// no default to get a compiler warning if anything is added
|
||||
}
|
||||
#undef CASE_LANGUAGEVERSION
|
||||
@@ -146,8 +148,7 @@ QString Utils::toString(ProjectPart::QtVersion qtVersion)
|
||||
switch (qtVersion) {
|
||||
CASE_QTVERSION(UnknownQt);
|
||||
CASE_QTVERSION(NoQt);
|
||||
CASE_QTVERSION(Qt4_8_6AndOlder);
|
||||
CASE_QTVERSION(Qt4Latest);
|
||||
CASE_QTVERSION(Qt4);
|
||||
CASE_QTVERSION(Qt5);
|
||||
// no default to get a compiler warning if anything is added
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user