Closed leidegre closed 2 months ago
Could you provide the code snippet that is causing the issue?
Does this issue persist when all other extension except for C/C++ are disabled?
If I try to goto the definition of the _countof macro I end up here, in vcruntime.h. __crt_countof
happens to be the same length as the incorrectly colored tokens, so it is somehow mistaking _countof
for __crt_countof
(it's five additional characters that gets colored incorrectly).
#ifdef __cplusplus
extern "C++"
{
template <typename _CountofType, size_t _SizeOfArray>
char (*__countof_helper(_UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
#define __crt_countof(_Array) (sizeof(*__countof_helper(_Array)) + 0)
}
#else
#define __crt_countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
#endif
The actual definition of _countof
is in stdlib.h and looks like this
#ifndef _countof
#define _countof __crt_countof
#endif
This happens with all other extensions disabled.
Hi @leidegre I can repro this issue with 1.20.5, but it appears to be fixed in the latest prerelease (1.21.0). Closing as fixed.
@Colengms Looks good on my machine now after update. Thanks!
Environment
Bug Summary and Steps to Reproduce
This looks correct but note the extra whitespace after the first left parenthesis.
In the video below you can see what happens as I just change the whitespace.
https://github.com/microsoft/vscode-cpptools/assets/63085/63108375-e1a6-4c78-bff7-d1098a57c190
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
But everywhere else it is not
Configuration and Logs
Other Extensions
No response
Additional context
No response