Skip to content

Request: Allow merge of forcedInclude setting from base config when using compile_commands.json #8274

Open
@crackcomm

Description

@crackcomm

Bug type: General

Describe the bug

  • OS and Version: Latest Linux Mint
  • VS Code Version: 1.61
  • C/C++ Extension Version: v1.7.0

This bug should be pretty easy to reproduce, for example:

Create a header file suppress-warnings.h with contents:

#ifdef __INTELLISENSE__
// 20 - identifier is undefined
#pragma diag_suppress 20
#endif

Create main.cc with contents:

int main(int argc, char** argv) { fdsfsdsfd; }

Edit c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": ["${default}"],
            "defines": [],
            "compilerPath": "/usr/local/bin/clang++",
            "compileCommands": "${workspaceFolder}/compile_commands.json",
            "cStandard": "c17",
            "cppStandard": "gnu++20",
            "intelliSenseMode": "linux-clang-x64",
            "forcedInclude": [
                "${workspaceFolder}/suppress-warnings.h"
            ]
        }
    ],
    "version": 4
}

Example compile_commands.json (empty list won't break it):

[
  {
    "directory": "/path-to-workspace/build/src",
    "command": "true",
    "file": "/path-to-workspace/main.cc"
  }
]

Includes from forcedInclude are not included and do not suppress a warning.

If you comment compileCommands in c_cpp_properties.json - the forced include is included.

Expected behaviour:

forcedInclude is included when using compileCommands

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions