From 32a2c250a3246a1fd046dd018d81387012b0575d Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Thu, 27 Feb 2025 14:14:49 -0500 Subject: [PATCH] =?UTF-8?q?zlib:=20don=E2=80=99t=20define=20=5F=5Fclang=5F?= =?UTF-8?q?=5F=20for=20win-arm64=20with=20MSVC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Defining __clang__ when MSVC was used to build zlib was added in 761c6fe8be0e (https://chromium-review.googlesource.com/c/1347773, 2018-12-12) to overcome a problem where the non-clang codepath normally used by MSVC contained SSE4.2 (x86-specific) intrinsics. Since zlib in Chromium 9d4ec9349a1b (https://chromium-review.googlesource.com/c/1960893, 2019-12-12—exactly one year later!), zlib changed and the __clang__ workaround was no longer necessary, but evidently not harmful, either. At some point, the Windows SDK improved its clang compatibility, and its headers gained some macros to disable clang warnings when being built with clang. offers _UCRT_DISABLE_CLANG_WARNINGS, which expands to _Pragma("clang diagnostic push") and similar when clang is in use, determined by __clang__ being defined. MSVC doesn’t understand these pragmas, and raises warning C4068 (unknown pragma), which causes a build failure when warnings are treated as errors. _UCRT_DISABLE_CLANG_WARNINGS was used in many headers easily seen by zlib, such as . Because the __clang__ workaround is no longer necessary, was always wrong, and since MSVC can now build zlib for win-arm64 without it, just remove it. Bug: 42310164, 399670190 Change-Id: I9c0a811db5cf5a623f2988f13c8216e16cc56168 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6309922 Reviewed-by: Nico Weber Commit-Queue: Mark Mentovai --- third_party/zlib/BUILD.gn | 6 ------ 1 file changed, 6 deletions(-) diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn index 92069a57..9c243979 100644 --- a/third_party/zlib/BUILD.gn +++ b/third_party/zlib/BUILD.gn @@ -103,12 +103,6 @@ if (zlib_source == "external") { "/wd4324", # structure was padded due to alignment specifier "/wd4702", # unreachable code ] - if (current_cpu == "arm64" && !crashpad_is_clang) { - # Select code path for clang in zlib to avoid using MSVC x86/x64 - # intrinsics for Windows ARM64. - # TODO: https://crashpad.chromium.org/bug/267 - defines += [ "__clang__" ] - } } else { defines += [ "HAVE_HIDDEN",