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:
@@ -148,6 +148,9 @@ QStringList CppcheckTool::additionalArguments(const CppTools::ProjectPart &part)
|
||||
case Version::C11:
|
||||
result.push_back("--std=c11 --language=c");
|
||||
break;
|
||||
case Version::C18:
|
||||
result.push_back("--language=c");
|
||||
break;
|
||||
case Version::CXX03:
|
||||
result.push_back("--std=c++03 --language=c++");
|
||||
break;
|
||||
@@ -159,6 +162,7 @@ QStringList CppcheckTool::additionalArguments(const CppTools::ProjectPart &part)
|
||||
break;
|
||||
case Version::CXX98:
|
||||
case Version::CXX17:
|
||||
case Version::CXX2a:
|
||||
result.push_back("--language=c++");
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user