Skip to content

On Windows, both gcc/clang and MS extensions should be supported in clang mode, instead of switching to msvc modeΒ #3387

@leximayfield

Description

@leximayfield

Type: LanguageService
Describe the bug

  • Window 17763
  • VS Code 1.32.3
  • C++ 0.22.1
  • Visual Studio Code incorrectly highlights __attribute__((foo)) syntax as a problem on Windows.

To Reproduce

  1. Use the following c_cpp_properties.json:
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.17763.0",
            "compilerPath": "C:/Program Files/LLVM/bin/clang-cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}
  1. Create a function definition with an attribute, such as __attribute((unused)).
  2. Note the error messages that appear around the attribute. For me, I saw the following error messages:
  • unnamed prototyped parameters not allowed when body is present
  • expected a type specifier

Expected behavior
I expect Visual Studio Code to not point this out as a problem, because this syntax works just fine when using clang.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions