microsoft / microsoft/vscode-cpptools
Extension overrides C/C++ standard settings from configuration
@sean-mcmanus ci sta già lavorando.
Dal 8/7/2024.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
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:
- Create c_cpp_properties.json with selected cStandard and cppStandard older than C++17/C17.
- 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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.