'Why is VSCode's Intellisense unable to parse #if defined(__GNUC__)?

I use Atom, CLion for kernel module development and I'd like to give VSCode a try.

Intellisense can't find some types and macros such as all the uint*_t, u*, dev_t, DECLARE_BITMAP().

After a quick look at the types.h, it seems all these types/macros are defined after #if defined(__GNUC__).

  • Is it a known issue?
  • How to solve that? The kernel headers are full of those #if defined().

Here is my c_cpp_properties.json:

{
    "configurations": [
        {
            "defines": [
                "__GNUC__",
                "__KERNEL__",
                "_GNU_SOURCE",
                "MODULE",
            ],
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/src/kernels/3.10.0-1127.8.2.el7.x86_64/include/**",
                "/usr/src/kernels/3.10.0-1127.8.2.el7.x86_64/arch/x86/include/**"
            ],
            "compilerPath": "/opt/rh/devtoolset-7/root/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source