clang-tidy fails on standalone headers with GCC cross-compiler predefines, but succeeds with compilation database
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- cmake, cpp, typescript, vscode
- Bereich
- build-system, devtools
Rechercherichtung
Start with the attached clang-tidy_log.txt and compare the synthesized header command against compile_commands.json for the including .cpp file. Reproduce the C++23 CMake project case, then verify that header analysis succeeds without the reported GCC predefined-macro errors while still producing ordinary header diagnostics.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Environment
Environment
VS Code 1.140.0, Ubuntu 22.04.5
C/C++ extension 1.34.4; bundled clang-tidy 23.1.0
CMake Tools 1.24.42; GCC 13.4.0 cross-compiler and its SDK libstdc++ headers
C++23 CMake project; CMAKE_EXPORT_COMPILE_COMMANDS=ON
C_Cpp.codeAnalysis.clangTidy.enabled=true and useBuildPath=true
c_cpp_properties.json sets compileCommands and uses the CMake Tools configuration provider
Bug Summary and Steps to Reproduce
Reproduction
- Configure a C++23 CMake target containing a .cpp that includes a project .h. The header includes SDK C++ headers such as .
- Confirm compile_commands.json has an entry for the .cpp, but none for the .h.
- Open or save the header with automatic clang-tidy analysis enabled.
- Compare this with analyzing the .cpp, or running bundled clang-tidy with -p .
Actual behavior
The extension analyzes the header using synthesized arguments after --, rather than -p. The logged command includes -std=gnu++23, SDK include paths, and hundreds of GCC predefined macros passed as -D__.... Clang-tidy reports errors in SDK libstdc++ headers involving _Float32, _Float64, and bf16, followed by too many errors emitted and Error while processing
Replaying the logged header command fails. Replaying that same command with only GCC -D__.../-U__... arguments removed succeeds and still produces ordinary header diagnostics. Direct clang-tidy -p
also succeeds.Expected behavior
Header analysis should use a compatible command associated with the including translation unit, or avoid passing GCC-only predefined macros as explicit arguments to Clang.
Impact
The processing error appears on headers after opening or saving them, despite successful project builds, and makes header diagnostics unreliable.
Configuration and Logs
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++23",
"intelliSenseMode": "gcc-x64",
"compileCommands": "${workspaceFolder}/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
Other Extensions
No response
Additional context
No response
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 44
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/vscode-cpptools
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
microsoft/vscode-cpptools#14820 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Language Service more info needed
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
microsoft/vscode-cpptools#14819 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
microsoft/vscode-cpptools#14817 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Language Service more info needed
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 15/100
microsoft/vscode-cpptools#14816 ·
Maintainer antworten meist innerhalb von 1 Tag
-
False C/C++(65) after rapid snippet replacement: identical source gets different diagnosticsEvtl. vergeben @Colengms hat das vor 1 Tag übernommen. Offeninvestigate: repro Language Service
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
microsoft/vscode-cpptools#14807 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in microsoft/vscode-cpptools
Ähnliche Issues
-
[bug] diagnostics.dumpBody:Buffer 形态请求(透传 lane)跳过 dumps/ 落盘,仅留 raw/-unknown-Evtl. vergeben @ranxianglei hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
ranxianglei/billion-context#2421 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
platformatic/mcp#216 ·
Maintainer antworten meist innerhalb von 1 Tag
-
pending triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
nuxt/test-utils#1842 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
MoonshotAI/kimi-code#4146 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
farbenmeer/tapi#531 ·