microsoft / microsoft/vscode-cpptools

Intellisense on Linux with clang++ and -fms-extensions defines _WIN32

Open
#10,396 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows 11 22000.1455
  • VS Code Version: 1.74.3
  • C/C++ Extension Version: v1.14.0
  • If using SSH remote, specify OS of remote machine: Debian 11
Bug Summary and Steps to Reproduce

Bug Summary:

Intellisense on Linux with clang++ and -fms-extensions defines _WIN32 that lead to incorrect output.

Steps to reproduce:

  1. Create simple CMake C++ project on wsl (or clear Debian 11)
  2. Set compiler clang++-15
  3. Add compiler flag -fms-extensions with target_compile_options
  4. Intellisense defines _WIN32

Expected behavior:

No _WIN32 on linux

Configuration and Logs
{
  "configurations": [
    {
      "name": "Linux",
      "includePath": [
        "${workspaceFolder}/**"
      ],
      "defines": [],
      "compilerPath": "/usr/bin/clang++-15",
      "cStandard": "c17",
      "cppStandard": "c++20",
      "intelliSenseMode": "linux-clang-x64",
      "configurationProvider": "ms-vscode.cmake-tools"
    }
  ],
  "version": 4
}
Other Extensions

CMake Tools v1.12.27
CMake v0.0.17

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the reported CMake project on Debian or WSL using clang++-15, -fms-extensions, and the shown IntelliSense configuration. Compare the compiler-defined macros with IntelliSense's results; done means _WIN32 is not defined for this Linux configuration while the flag remains enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, linux
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.