microsoft / microsoft/vscode-cpptools

C23 features aren't supported

Aperta
#10,696 46 commenti 190 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Feature Request Language Service parser
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Iniziare dalla gestione IntelliSense degli standard c23 e gnu23 da parte del language server C/C++, utilizzando l'esempio in WORKSPACE/src/test.c e la configurazione clang 17 fornita. Riprodurre i Problems segnalati, quindi verificare che la sintassi enum di C23, nullptr e l'uso di bool siano accettati con diagnostica corrispondente a quella di clang 17.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c
Ambito
compilers, devtools
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.