Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple automatically setting the _WIN32 macro when the -fms-extensions compiler argument is specified #13188

Open
ddritzenhoff opened this issue Jan 24, 2025 · 1 comment
Labels
bug Language Service Visual Studio Inherited from Visual Studio

Comments

@ddritzenhoff
Copy link

Feature Request

Hey, happy new year :)

As the title suggests, I'd love a way to stop the _WIN32 macro from being automatically defined when the -fms-extensions compiler argument is specified. I'm currently working on the MsQuic repository, which supports multiple different platforms (e.g. Windows, Linux, MacOS), and it uses some features that aren't native to clang c17 such as compounded anonymous structs (seen here and used here). You can fix this problem by adding -fms-extensions to the compiler arguments, which implicitly defines _WIN32. I’m working on MsQuic for Linux, so I get cannot open source file "windows.h” errors as a consequence. Leaving -fms-extensions out also doesn’t work, as then the compounded anonymous structs aren’t recognized anymore and generate errors themselves.

Similar issues can be found in #2432 and #2363, but it seems as if nobody has had exactly the one I'm facing now. Adding -U_WIN32 to the compiler arguments also doesn't seem to work.

  • OS and Version: Linux Ubuntu 24.04.1 LTS
  • VS Code Version: 1.96.3
  • C/C++ Extension Version: 1.22.11
  • Other extensions you installed (and if the issue persists after disabling them): It's irrelevant, as the related issue is based on C extensions.

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/include/libnl3/**",
                "/usr/include/bpf",
                "/usr/include/xdp"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "QUIC_EVENTS_STUB",
                "QUIC_LOGS_STUB",
                "CX_PLATFORM_LINUX"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-clang-x64",
            "compilerArgs": [
                "-fms-extensions"
            ]
        }
    ],
    "version": 4
}
@bobbrow
Copy link
Member

bobbrow commented Jan 31, 2025

Thank you for reporting this. We have forwarded the report to our team who manages the IntelliSense compiler. Issue 2356245.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Language Service Visual Studio Inherited from Visual Studio
Projects
Status: No status
Development

No branches or pull requests

2 participants