cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

fixed #12715 - made Visual Studio conditions work again

Open firewave opened this issue 1 year ago • 6 comments

firewave avatar May 07 '24 21:05 firewave

This still needs Visual Studio import tests but I might not get to those. And as this is a high severity regression I want to get in a fix ASAP (as well as a backport and a 2.14.x patch release).

firewave avatar May 07 '24 22:05 firewave

Is the test snippet from a project file? Why do we need to create an AST from that?

chrchr-github avatar May 07 '24 22:05 chrchr-github

Is the test snippet from a project file?

Yes. That is a bog standard condition used in every Visual Studio project file.

Why do we need to create an AST from that?

I need to create the AST so Token::astOperandX() is set.

firewave avatar May 07 '24 22:05 firewave

But a .vcxproj is XML, do we treat that as code somehow? Seems sketchy...

chrchr-github avatar May 07 '24 22:05 chrchr-github

But a .vcxproj is XML, do we treat that as code somehow?

This is a string extracted from it (macros obviously being replaced):

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"/>

I think this is actually C# code.

Seems sketchy...

Hence the TODOs to improve the testing and maybe handling it differently.

firewave avatar May 07 '24 22:05 firewave

:+1:

danmar avatar May 13 '24 11:05 danmar

This needs to be cleaned up but it is all I can do right now and this needs to be fixed ASAP since it breaks scanning Visual Studio projects.

firewave avatar May 14 '24 16:05 firewave

There is a WIP selftest/dogfooding job which would have caught this with #5477.

firewave avatar May 14 '24 18:05 firewave