Skip to content

C and CUDA files in compile_commands.json are misinterpreted as C++ files #13471

Closed

Description

Environment

  • OS and Version: Ubuntu 24.04
  • VS Code Version: 1.99.0
  • C/C++ Extension Version: 1.24.5

Bug Summary and Steps to Reproduce

While editing a .c file, vscode shows this warning for the code uint8_t *ptr = malloc(size):

a value of type "void *" cannot be assigned to an entity of type "uint8_t *" (aka "unsigned char *")C/C++(513)

I believe that's a C++ warning that should not happen in a C program.

I have a compile_commands.json that does provide the compile command for that specific file and it produces no warning. The command starts with ccache cc ... with cc symlink to /usr/bin/gcc.

Other Extensions

No response

Additional context

No response

Activity

  1. Colengms commented on Apr 8, 2025

    @Colengms
    Contributor

    Hi Xavier Claessens (@xclaesse) . Thanks for reporting this. It looks like 1.24.5 has a regression related to C and CUDA source files in compile_commands.json being interpreted as C++. We have a fix in progress that should go into our next prerelease.

  2. changed the title [-]C++ warnings shown in C file[/-] [+]C and CUDA files in `compile_commands.json` are misinterpreted as C++ files[/+] on Apr 8, 2025
  3. moved this from In progress to Done in cpptoolson Apr 9, 2025
  4. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    regressionA bug that didn't exist in a previous release
    on Apr 9, 2025
  5. sywe1 commented on Apr 10, 2025

    @sywe1

    Are there any workarounds? My workspace is populated with error squiggles. Many thanks for considering my request.

  6. sean-mcmanus commented on Apr 11, 2025

    @sean-mcmanus
    Contributor

    sywe1 The fix is available with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.25.0 . I'm not sure if there's a workaround.

  7. xclaesse commented on Apr 11, 2025

    @xclaesse
    Author

    I can confirm my issue is fixed with cpptools pre-release. Thanks!

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

Metadata

Metadata

Labels

Feature: Compile CommandsLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous release

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions