microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intellisense generates _MSC_VER for clang-like compiler on linux when using -fms-extensions

Yangff opened this issue · comments

Environment

Version: 1.90.0-insider (user setup)
Commit: 5e68ffd760038bb156894a87f896910be510accd
Date: 2024-05-15T08:29:12.858Z
Electron: 29.3.1
ElectronBuildId: 9464424
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22635
WSL: Archlinux on WSL

Bug Summary and Steps to Reproduce

I think this is the same problem as #10940 but just happen on linux+clang.
I can't include stdandard library becauese it cannot find vcruntime_exception.h, which is caused by -fms-extensions which introduced _MSC_VER macro.
I'm using zig cc so the command is zig-c++ ... but in the config file I'm being specific that this is a clang.

I also tried all I can do to force cpptools to not include vcruntime_exception.h but all failed.
that includes:

  1. create a vcruntime_exception.h in .vscode and put it into includePath.
  2. add _LIBCPP_ABI_FORCE_ITANIUM macro in all way I can try
  3. remove _MSC_VER and _WIN32 macros by creating a fix-cpptools.h and put it into forcedInclude.
    All of them failed, idk why but the cpptools just can't stop assuming it's a msvc compiler and try to find the vcruntime_exception.h, ignoring all previous settings.
    I also tried to re-install the extension but got no luck.

Configuration and Logs

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/.vscode",
            ],
            "defines": [
                "_LIBCPP_ABI_FORCE_ITANIUM=1"
            ],
            "cStandard": "c17",
            "cppStandard": "c++23",
            "intelliSenseMode": "linux-clang-x64",
            "compileCommands": ".vscode/compile_commands.json",
            "forcedInclude": [
                ".vscode/fix-cpptools.h"
            ],
            "compilerArgs": [
                "-D_LIBCPP_ABI_FORCE_ITANIUM"
            ]
        }
    ],
    "version": 4
}

image

Other Extensions

No response

Additional context

No response

@Yangff We're already tracking this issue with #10396 .