Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

clang-tidy fails on standalone headers with GCC cross-compiler predefines, but succeeds with compilation database

Ouverte
#14,815 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
55/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
cmake, cpp, typescript, vscode

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

  1. Configure a C++23 CMake target containing a .cpp that includes a project .h. The header includes SDK C++ headers such as .
  2. Confirm compile_commands.json has an entry for the .cpp, but none for the .h.
  3. Open or save the header with automatic clang-tidy analysis enabled.
  4. 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

. The .cpp analysis succeeds.

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.

clang-tidy_log.txt

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

Langage dominant
TypeScript
Étoiles
6.2k
Forks
1.7k
Merge moyen
1 j 29 min
PR mergées (30 j)
43

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/vscode-cpptools

Toutes les issues de microsoft/vscode-cpptools

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.