Skip to content

Fix compiling python_uwp.cpp with clang-cl on Windows #131291

@chris-eibl

Description

@chris-eibl

clang-cl fails with the following error when compiling python_uwp.cpp:

1>In file included from ..\PC\python_uwp.cpp:14:
1>In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt\winrt\Windows.ApplicationModel.h:9:
1>In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt\winrt/base.h:56:
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\experimental/coroutine(29,2): error : The <experimental/coroutine>, <experimental/generator>, and <experimental/resumable> headers do not support Clang, but the C++20 <coroutine> header does.

Let's fix it using

#if defined(__clang__)
#define _SILENCE_CLANG_COROUTINE_MESSAGE
#endif

before including the respective header.

This only happens when IncludeUwp is set in case of building with build.bat or in the Visual Studio IDE, because there always all projects are built.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions