[Qt-creator] Clang code model running in C++98 mode
Julius Bullinger
julius.bullinger at mvtec.com
Thu Nov 15 15:55:23 CET 2018
Hi Nikolai
On 06.11.2018 12:19, Nikolai Kosjar wrote:
> Recently there were some changes in that area. Could you please try
> again with the updated snapshots for 4.8?
>
> http://download.qt.io/snapshots/qtcreator/4.8/4.8.0-beta2
I managed to built the latest 4.8 branch on my machine, and still got
the same issue:
>> I can't reproduce it with a smaller project, but is there any way I can
>> debug this issue? Like get the options that are passed from qmake to the
>> code model?
>
> A breakpoint in ProjectInfoGenerator::createProjectPart() should help,
> especially on
>
> part->languageVersion = macroInspectionReport.languageVersion;
>
On the first break after loading the project,
macroInspectionReport.languageVersion is CXX14 (7). On further breaks,
it's CXX98 (4).
I cannot find any differences in the respective qmake projects. The
flags.commandLineFlags that are passed are the following:
-nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline /wd4503 /w14239 /FC
/D_LIntStatic /Zi /Fd<path> -O2 -Zi -MD -Zc:strictStrings -W3 -w34100
-w34189 -w44996 /WX -EHsc
However, I found that in tcInfo.macroInspectionRunner, the "__cplusplus"
macro has a value of 199711L. This is from msvctoolchain.cpp, which
shows some information about the possible values:
// We want to detect the language version based on the predefined macros.
// Unfortunately MSVC does not conform to standard when it comes to the
predefined
// __cplusplus macro - it reports "199711L", even for newer language
versions.
//
// However:
// * For >= Visual Studio 2015 Update 3 predefines _MSVC_LANG which
has the proper value
// of __cplusplus.
// See
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2017
// * For >= Visual Studio 2017 Version 15.7 __cplusplus is correct
once /Zc:__cplusplus
// is provided on the command line. Then __cplusplus == _MSVC_LANG.
// See
https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus
//
// We rely on _MSVC_LANG if possible, otherwise on some hard coded
language versions
// depending on _MSC_VER.
We're still running MSVC 2013, which doesn't seem to be covered by this
exceptions. I tested opening the project with a MSVC 2017 Version 15.8
kit, and with that, the code model reports a C++ version of CXX17
(although it should be C++11)!
So, I guess this is a bug in Creator regarding C++ version detection
with MSVC 2013?
If so, I'll file a bug report.
Thanks,
Julius
More information about the Qt-creator
mailing list