Skip to content

Intellisense broken for functions in tgmath, e.g. sqrt #5337

Closed

Description

@lprc

Type: LanguageService

Describe the bug

  • OS and Version: Linux Mint 19.3 Cinnamon
  • VS Code Version: 1.43.2
  • C/C++ Extension Version: 0.27.0
  • Other extensions you installed (and if the issue persists after disabling them): none
  • Does this issue involve using SSH remote to run the extension on a remote machine?: no
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

Intellisense seems to be broken for functions included via tgmath as it underlines the functions complaining about the return type being void instead of float (or whatever the type of the variable the result should be assigned to is). I disabled all other extensions and this issue still persists.

Steps to reproduce

  1. Create a file main.c with the following content
#include <tgmath.h>
#include <stdio.h>

int main(void)
{
    float a = 16;
    float b = sqrt(a);

    printf("sqrt(%f) = %f\n", a, b);
    return 0;
}
  1. See that sqrt is underlined red by the Intellisense engine.
  2. Check that you can compile the program just fine using the command gcc main.c -o main -Wall -std=c99 -lm

Expected behavior

sqrt should not be marked as an error.

Logs
-------- Diagnostics - 21.4.2020, 13:12:12
Version: 0.27.0
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "c11",
    "cppStandard": "c++17",
    "intelliSenseMode": "clang-x64",
    "compilerArgs": [],
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ /home/simon/test/main.c ]:
    /home/simon/test/main.c
Translation Unit Configurations:
[ /home/simon/test/main.c ]:
    Process ID: 4786
    Memory Usage: 14 MB
    Compiler Path: /usr/bin/gcc
    Includes:
        /usr/lib/gcc/x86_64-linux-gnu/7/include
        /usr/local/include
        /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c11
    IntelliSense Mode: gcc-x64
    Other Flags:
        --gcc
        --gnu_version=70500
Total Memory Usage: 14 MB
Dateiausschluss: **/.git
Dateiausschluss: **/.svn
Dateiausschluss: **/.hg
Dateiausschluss: **/CVS
Dateiausschluss: **/.DS_Store
Dateiausschluss: **/.vscode
Suchausschluss: **/node_modules
Suchausschluss: **/bower_components
Suchausschluss: **/*.code-search
Suchausschluss: **/.vscode
Füllen Sie den Cache für die Includevervollständigung auf.
Dateien werden ermittelt...
  Ordner wird verarbeitet (rekursiv): /usr/lib/gcc/x86_64-linux-gnu/7/include/
  Ordner wird verarbeitet (rekursiv): /usr/local/include/
  Ordner wird verarbeitet (rekursiv): /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/
  Ordner wird verarbeitet (rekursiv): /usr/include/
  Ordner wird verarbeitet (rekursiv): /home/simon/test/
  Dateiermittlung: 3941 Datei(en) verarbeitet
  0 Datei(en) aus Datenbank entfernt
Die Ermittlung von Dateien ist abgeschlossen.
Verbleibende Dateien werden analysiert...
  Analyse: 0 Datei(en) verarbeitet
Die Analyse verbleibender Dateien ist abgeschlossen.

Screenshots

grafik

Additional context

Activity

  1. sean-mcmanus commented on Apr 21, 2020

    @sean-mcmanus
    Contributor

    I'm not able to repro the bug on Linux with gcc8. Can you provide more repro details, such as the output of running C/C++: Log Diagnostics from the VS Code Command Palette?

  2. lprc commented on Apr 22, 2020

    @lprc
    Author

    Sure, here's the output of C/C++: Log Diagnostics (was also already in the issue description):

    -------- Diagnostics - 22.4.2020, 09:49:27
    Version: 0.27.0
    Current Configuration:
    {
        "name": "Linux",
        "includePath": [
            "${workspaceFolder}/**"
        ],
        "defines": [],
        "compilerPath": "/usr/bin/gcc",
        "cStandard": "c11",
        "cppStandard": "c++17",
        "intelliSenseMode": "clang-x64",
        "compilerArgs": [],
        "browse": {
            "path": [
                "${workspaceFolder}/**"
            ],
            "limitSymbolsToIncludedHeaders": true
        }
    }
    Translation Unit Mappings:
    [ /home/simon/test/main.c ]:
        /home/simon/test/main.c
    Translation Unit Configurations:
    [ /home/simon/test/main.c ]:
        Process ID: 4197
        Memory Usage: 13 MB
        Compiler Path: /usr/bin/gcc
        Includes:
            /usr/lib/gcc/x86_64-linux-gnu/7/include
            /usr/local/include
            /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
            /usr/include/x86_64-linux-gnu
            /usr/include
        Standard Version: c11
        IntelliSense Mode: gcc-x64
        Other Flags:
            --gcc
            --gnu_version=70500
    Total Memory Usage: 13 MB
    

    Anything else I can do?
    I tried changing the IntelliSense mode and c-standard but that didn't solve it. I'm running with gcc 7.5.0 if that matters. Seems like gcc 8 isn't listed in apt yet for Linux Mint.

  3. lprc commented on Apr 22, 2020

    @lprc
    Author

    I just tried the previous version of the extension (0.26.3) which works just fine. Here's the log output again:

    -------- Diagnostics - 22.4.2020, 13:25:13
    Version: 0.26.3
    Current Configuration:
    {
        "name": "Linux",
        "includePath": [
            "${workspaceFolder}/**"
        ],
        "defines": [],
        "compilerPath": "/usr/bin/gcc",
        "cStandard": "c11",
        "cppStandard": "c++17",
        "intelliSenseMode": "gcc-x64",
        "compilerArgs": [],
        "browse": {
            "path": [
                "${workspaceFolder}/**"
            ],
            "limitSymbolsToIncludedHeaders": true
        }
    }
    Translation Unit Mappings:
    [ /home/simon/test/main.c ]:
        /home/simon/test/main.c
    Translation Unit Configurations:
    [ /home/simon/test/main.c ]:
        Process ID: 15243
        Memory Usage: 16 MB
        Compiler Path: /usr/bin/gcc
        Includes:
            /usr/lib/gcc/x86_64-linux-gnu/7/include
            /usr/local/include
            /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
            /usr/include/x86_64-linux-gnu
            /usr/include
        Standard Version: c11
        IntelliSense Mode: gcc-x64
        Other Flags:
            --gcc
            --gnu_version=70500
    Total Memory Usage: 16 MB
    

    I also checked the issue on another machine (also Linux Mint), still the same error with the current version 0.27.0.

  4. github-actions commented on Jan 17, 2021

    @github-actions

    Hey Sean McManus (@sean-mcmanus), this issue might need further attention.

    SimonH (@lprc), you can help us out by closing this issue if the problem no longer exists, or adding more information.

  5. github-actions commented on Mar 19, 2021

    @github-actions

    This issue has been closed automatically because it needs more information and has not had recent activity.

  6. locked and limited conversation to collaborators on May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Language Servicemore info neededThe issue report is not actionable in its current statenot reproingWe're not able to reproduce the issue (it's unlikely to get fixed until we find one).

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions