X Tutup
Skip to content

Add support for Visual Studio 2026 .slnx project files#8355

Open
IOBYTE wants to merge 11 commits intodanmar:mainfrom
IOBYTE:main
Open

Add support for Visual Studio 2026 .slnx project files#8355
IOBYTE wants to merge 11 commits intodanmar:mainfrom
IOBYTE:main

Conversation

@IOBYTE
Copy link
Copy Markdown
Contributor

@IOBYTE IOBYTE commented Mar 19, 2026

No description provided.

@IOBYTE
Copy link
Copy Markdown
Contributor Author

IOBYTE commented Mar 19, 2026

The selfcheck fails because of unused functions that have nothing to do with this PR. There appear to be suppressions for these errors but I don't know where they come from or how to fix them.

@chrchr-github
Copy link
Copy Markdown
Collaborator

The suppressions seem to come from here:

supprs="--suppress=unusedFunction:lib/errorlogger.h:197 --suppress=unusedFunction:lib/importproject.cpp:1531 --suppress=unusedFunction:lib/importproject.cpp:1555"

Not sure why we keep those functions around, if they are really unused. @firewave

Copy link
Copy Markdown
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any test. So well some basic test would be nice..

@chrchr-github
Copy link
Copy Markdown
Collaborator

The suppressions seem to come from here:

supprs="--suppress=unusedFunction:lib/errorlogger.h:197 --suppress=unusedFunction:lib/importproject.cpp:1531 --suppress=unusedFunction:lib/importproject.cpp:1555"

Not sure why we keep those functions around, if they are really unused.

The functions are used by the GUI.

@IOBYTE
Copy link
Copy Markdown
Contributor Author

IOBYTE commented Mar 27, 2026

I tried adding slnx to the first test in test/cli/project_test.py and I get this:

Bob@DESKTOP-3DNJ0T8 MINGW64 ~/forks/cppcheck/test/cli (main)
$ python -m pytest project_test.py
============================================================================= test session starts =============================================================================
platform win32 -- Python 3.13.0, pytest-9.0.2, pluggy-1.6.0
rootdir: C:\Users\Bob\forks\cppcheck\test\cli
collected 21 items

project_test.py ...........F.........                                                                                                                                    [100%]

================================================================================== FAILURES ===================================================================================
_______________________________________________________________________ test_json_entry_file_not_found ________________________________________________________________________

tmpdir = local('C:\\Users\\Bob\\AppData\\Local\\Temp\\pytest-of-Bob\\pytest-16\\test_json_entry_file_not_found0')

    def test_json_entry_file_not_found(tmpdir):
        compilation_db = [
            {"directory": str(tmpdir),
             "command": "c++ -o bug1.o -c bug1.cpp",
             "file": "bug1.cpp",
             "output": "bug1.o"}
        ]

        project_file = os.path.join(tmpdir, "file.json")
        missing_file = os.path.join(tmpdir, "bug1.cpp")
        missing_file_posix = missing_file

        if sys.platform == "win32":
            missing_file_posix = missing_file_posix.replace('\\', '/')

        with open(project_file, 'w') as f:
            f.write(json.dumps(compilation_db))

        ret, _, stderr = cppcheck([
            '--template=simple',
            "--project=" + str(project_file)
        ])
>       assert 0 == ret
E       assert 0 == 1

project_test.py:66: AssertionError
---------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------
using 'C:\Users\Bob\forks\cppcheck\test\cli\cppcheck.exe'
=========================================================================== short test summary info ===========================================================================
FAILED project_test.py::test_json_entry_file_not_found - assert 0 == 1
======================================================================== 1 failed, 20 passed in 0.28s =========================================================================

Is this the test you are referring to? Is this the proper way to run this test? Are these tests run by CI? Should I be looking elsewhere?

My original PR added test/cli/helloworld2 but it was rejected because it duplicated 2 files. The current helloworld test only tests cppcheck gui projects with .sln project files. It should also check .vcxproj files but doesn't. .slnx files should also be added but these changes would require changes to helloworld_test.py and I don't know python. There are probably other tests that would need changes.

@IOBYTE
Copy link
Copy Markdown
Contributor Author

IOBYTE commented Mar 27, 2026

Hopefully this is enough tests.

@sonarqubecloud
Copy link
Copy Markdown

@IOBYTE
Copy link
Copy Markdown
Contributor Author

IOBYTE commented Mar 28, 2026

I just noticed something interesting. Visual Studio created slnx files do not have the xml version on the first line but cmake generated files do. Visual Studio doesn't seem to care.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup