Skip to content

Semantic token for _countof macro specifically is incorrect #12408

@leidegre

Description

@leidegre

Environment

  • OS and Version: Windows 11 [Version 10.0.22631.3737]
  • VS Code Version: 1.90.2
  • C/C++ Extension Version: 1.20.5
  • If using SSH remote, specify OS of remote machine: n/a

Bug Summary and Steps to Reproduce

This looks correct but note the extra whitespace after the first left parenthesis.

image

In the video below you can see what happens as I just change the whitespace.

Code_V520w8ayKx.mp4

image

image

It's incorrectly somehow counting part of the macro arguments as the macro itself. This seems to happen everywhere the _countof macro is used except inside other macros.

For example, here it's correct

image

But everywhere else it is not

image

Configuration and Logs

{
  "version": 4, 
  "configurations": [
    {
      "name": "Win32 (Debug)",
      "includePath": ["third-party/include", "src"],
      "defines": ["_DEBUG", "_CRT_SECURE_NO_WARNINGS"],
      "compilerArgs": ["/W4", "/wd4100", "/WX"],
      "windowsSdkVersion": "10.0.22621.0",
      "compilerPath": "cl.exe",
      "cStandard": "c17",
      "cppStandard": "c++20",
      "intelliSenseMode": "windows-msvc-x64"
    }
  ]
}

I don't have a "C/C++: Log Diagnostics" command in VS Code.

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Language ServicefixedCheck the Milestone for the release in which the fix is or will be available.

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions