microsoft / microsoft/vscode-cpptools

Extension overrides C/C++ standard settings from configuration

Offen
#12,451 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@sean-mcmanus arbeitet bereits daran.

Seit 08.7.2024.

bug Language Service regression verified
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

Environment
  • OS and Version: Windows 10 22H2
  • VS Code Version: 1.91.0
  • C/C++ Extension Version: 1.20.5
Bug Summary and Steps to Reproduce

Bug Summary:
Due to current automatic behavior, it is impossible to use intellisense with cl.exe on older projects that correctly compile with CL.
Extension always overrides cStandard and cppStandard settings based on compiler path for cl.exe if flags are given without /std.
The default settings without flags are C89 and C++14 - at least for Visual Studio 2022 CL 19.40.33811.
There is no /std flag for standards older than C11 and C++14, but the compiler accepts these without a flag.

Steps to reproduce:

  1. Create c_cpp_properties.json with selected cStandard and cppStandard older than C++17/C17.
  2. Note messages like:
    For C++ source files, the cppStandard was changed from "c++03" to "c++17" based on compiler args and querying compilerPath
    For C source files, the cStandard was changed from "c89" to "c17" based on compiler args and querying compilerPath

Expected behavior:
If any of /permissive, /Zc or /Ze are provided in arguments, the override is not applied.
OPTIONALLY:
Plugin checks the compiler version by running cl.exe and sets the override based on compiler version.
This would typically be C89/C++14, unless it changes later for a newer Microsoft compiler.

Configuration and Logs
{
    "configurations": [
        {
            "name": "C89/C++03 VS2022",
            "intelliSenseMode": "windows-msvc-x64",
            "compilerPath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\bin\\Hostx64\\x64\\cl.exe",
            "compilerArgs": [
                "/Od",
                "/permissive"
            ],
            "cppStandard": "c++03",
            "cStandard": "c89",
            "windowsSdkVersion": "10.0.19041.0"
        }
    ],
    "version": 4
}
Other Extensions

No response

Additional context

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.