microsoft / microsoft/vscode-cpptools

C23 features aren't supported

Offen
#10,696 46 Kommentare 190 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Environment
  • OS and Version: Ubuntu 22.04
  • VS Code Version: 1.76.2
  • C/C++ Extension Version: 1.15.0
  • If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce

Bug Summary:

There was an issue (#10615) that allows you to select c23/gnu23 as your compiler version, but the actual new language features are not implemented yet. Obviously this stuff is bleeding edge, but I struggled trying to get it to work and I wanted to submit an issue.

I would be happy to work on adding these features to the C/C++ language server, but I would need to be pointed in the right direction.

Steps to reproduce:

  1. Set your C standard version to c23 or gnu23
  2. Open the following code with IntelliSense active
enum TestEnum : short
{
    TEST_ENUM_VALUE,
};

void doSomething() {
    int * test1 = nullptr;
    bool test2 = true; // without #include <stdbool.h>
    enum TestEnum test3 = TEST_ENUM_VALUE;
}
  1. Verify that these all generate "Problems"
    image

  2. Compile with -std=gnu2x or equivalent, on a very new compiler (I used clang 17) and verify that there are no errors

Expected behavior:
Generate the same errors that clang 17 would, or equivalent

Configuration and Logs
{
    "configurations": [
        {
            "name": "Linux",
            "compilerPath": "/usr/bin/clang-17",
            "cStandard": "c23",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}

-------- Diagnostics - 3/17/2023, 1:56:58 AM
Version: 1.15.0
Current Configuration:
{
    "name": "Linux",
    "compilerPath": "/usr/bin/clang-17",
    "cStandard": "c23",
    "compileCommands": "WORKSPACE/build/compile_commands.json",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": false,
    "intelliSenseModeIsExplicit": false,
    "rawCompilerPath": "/usr/bin/clang-17",
    "mergeConfigurations": false,
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ WORKSPACE/src/test.c ]:
    WORKSPACE/src/test.c
Translation Unit Configurations:
[ WORKSPACE/src/test.c ]:
    Process ID: 3852781
    Memory Usage: 544 MB
    Compiler Path: /usr/bin/clang-17
    Includes:
        /usr/lib/llvm-17/lib/clang/17/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c23
    IntelliSense Mode: linux-clang-x64
    Other Flags:
        --clang
        --clang_version=170000
    compile_commands.json entry:
        directory: WORKSPACE/build
        file: WORKSPACE/src/test.c
        command: /usr/bin/clang   -g -std=gnu2x -o WORKSPACE/build/src/test.c.o -c WORKSPACE/src/test.c
        output: CMakeFiles/slwjson.dir/src/test.c.o
Total Memory Usage: 544 MB
Browse Paths from compile_commands.json, from workspace folder: WORKSPACE
    WORKSPACE/src
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.

Rechercherichtung

Beginnen Sie mit der IntelliSense-Behandlung des C/C++-Sprachservers für die Standards c23 und gnu23 unter Verwendung des Beispiels in WORKSPACE/src/test.c und der bereitgestellten clang 17-Konfiguration. Reproduzieren Sie die gemeldeten Problems und überprüfen Sie anschließend, dass die C23 enum-Syntax, nullptr und die Verwendung von bool mit Diagnosen akzeptiert werden, die clang 17 entsprechen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c
Bereich
compilers, devtools
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

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