Disable [[clang::musttail]] on Windows entirely.
Some Windows tests in Chromium crash mysteriously, and we also
see mysterious crashes in our own Test-Win2019-Clang-GCE-CPU-
AVX2-x86_64-Release-All:
https://screenshot.googleplex.com/Ai3P3FhEtR4iUSJ
Change-Id: I80926ab09a31a843908ab0148a7f303deb5cf464
Bug: b/305974160
Reviewed-on: https://skia-review.googlesource.com/c/skcms/+/782616
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/ninja/msvs b/ninja/msvs
index 809d09e..d8880a7 100644
--- a/ninja/msvs
+++ b/ninja/msvs
@@ -1,5 +1,5 @@
cl = cl.exe
-cflags = /W4 /wd"4200" /wd"4201" /wd"4204" /wd"4221" /DSKCMS_MUSTTAIL=
+cflags = /W4 /wd"4200" /wd"4201" /wd"4204" /wd"4221"
out = out/msvs$mode
exe = .exe
builddir = $out
diff --git a/src/skcms_internals.h b/src/skcms_internals.h
index 028f78d..6586073 100644
--- a/src/skcms_internals.h
+++ b/src/skcms_internals.h
@@ -27,13 +27,23 @@
#endif
#ifndef SKCMS_MUSTTAIL
- // Sanitizers do not work well with [[clang::musttail]], and corrupt src/dst pointers.
- // Clang 18 runs into an ICE on Android with [[clang::musttail]]. (crbug.com/1504548)
- // Tail-calls are a fairly new, optional feature in wasm and won't work everywhere.
+ // [[clang::musttail]] is great for performance, but it's not well supported and we run into
+ // a variety of problems when we use it. Fortunately, it's an optional feature that doesn't
+ // affect correctness, and usually the compiler will generate a tail-call even for us
+ // whether or not we force it to do so.
+ //
+ // Known limitations:
+ // - Sanitizers do not work well with [[clang::musttail]], and corrupt src/dst pointers.
+ // (https://github.com/llvm/llvm-project/issues/70849)
+ // - Clang 18 runs into an ICE on Android with [[clang::musttail]].
+ // (http://crbug.com/1504548)
+ // - Windows builds generate incorrect code with [[clang::musttail]] and crash mysteriously.
+ // - Wasm tail-calls were only introduced in 2023 and aren't a mainstream feature yet.
#if __has_cpp_attribute(clang::musttail) && !__has_feature(memory_sanitizer) \
&& !__has_feature(address_sanitizer) \
&& !defined(__EMSCRIPTEN__) \
- && !defined(__ANDROID__)
+ && !defined(ANDROID) && !defined(__ANDROID__) \
+ && !defined(_WIN32) && !defined(__SYMBIAN32__)
#define SKCMS_MUSTTAIL [[clang::musttail]]
#else
#define SKCMS_MUSTTAIL