Skip to content

_CONTROL_FLOW_GUARD IntelliSense bug #14310

@juan-amd

Description

@juan-amd

Environment

  • OS and Version: Windows 11
  • VS Code Version: 1.112.0
  • C/C++ Extension Version: 1.31.2

Bug Summary and Steps to Reproduce

Bug Summary:
_CONTROL_FLOW_GUARD defined by MSVC compiler not showing up in C++ IntelliSense properly.

From the official Microsoft documentation:
_CONTROL_FLOW_GUARD defined as 1 when the /guard:cf (Enable Control Flow Guard) compiler option is set. Otherwise, undefined.

Source: https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

Steps to reproduce:

  1. Compile a project with control flow guard enabled
if (MSVC)
    add_compile_options(/guard:cf)
    add_link_options(/GUARD:CF)
endif()
  1. Add C++ code to ensure this is being set properly.
#ifndef _CONTROL_FLOW_GUARD
#error "Control flow guard is not enabled!"
#endif
Image

It's important to note that _MT is another predefined-macro defined by the MSVC compiler. However, that one doesn't have an IntelliSense issue.

Configuration and Logs

Can't supply log. When I ran C/C++ Log Diagnostics proprietary company info was getting logged.

This issue is super easy to reproduce I've seen it on other developers machines for a while now.

Other Extensions

Only the standard C/C++/CMake Microsoft extensions

Additional context

Link to open-source version of project:
https://github.com/GPUOpen-Tools/gpu_performance_api

Permalink to problematic code in question:
https://github.com/GPUOpen-Tools/gpu_performance_api/blob/7976216f2848956030e15143a0057a3fe65600f7/source/gpu_perf_api_counters/gpu_perf_api_counters.cc#L55

Metadata

Metadata

Assignees

Labels

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

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions