Commit ab3b65fe authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Make the Windows 10.0.19041 SDK compatible with clang-cl

The Windows 10.0.19041 SDK modifies module.h so that it passes a lambda
to InitOnceExecuteOnce. This works poorly because it is not possible to
specify the calling convention of a lambda, and the callback requires a
specific and non-default calling convention.

This code works with VC++ because VC++ lambdas provide all possible
calling conventions. It works with 64-bit builds with clang-cl because
there is only one calling convention. But it fails on 32-bit builds with
clang-cl.

This define tells module.h to use the old singleton technique. The
Microsoft developer who wrote the new technique has been made aware. See
the bug for details.

This change is a NOP for packaged toolchain users until we switch the
packaged toolchain to the new SDK, but it avoids problems for developers
who install the new SDK and build with it.

Bug: 1089996
Change-Id: I38d9748b9def3038320ee106676a1f5e60f7349f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2232766
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarJesse McKenna <jessemckenna@google.com>
Reviewed-by: default avatarDavid Bienvenu <davidbienvenu@google.com>
Cr-Commit-Position: refs/heads/master@{#775746}
parent 93b62554
......@@ -82,6 +82,10 @@ config("compiler") {
# Don't look for includes in %INCLUDE%.
cflags += [ "/X" ]
# Required to make the 19041 SDK compatible with clang-cl.
# See https://crbug.com/1089996 issue #2 for details.
cflags += [ "/D__WRL_ENABLE_FUNCTION_STATICS__" ]
# Tell clang which version of MSVC to emulate.
cflags += [ "-fmsc-version=1916" ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment