mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-19 09:53:47 +00:00
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. <ucrt/corecrt.h> 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 <stdlib.h>. 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 <thakis@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org>
144 lines
4.3 KiB
Plaintext
144 lines
4.3 KiB
Plaintext
# Copyright 2017 The Crashpad Authors
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
import("../../build/crashpad_buildconfig.gni")
|
|
|
|
if (crashpad_is_in_chromium || crashpad_is_in_fuchsia || crashpad_is_in_dart) {
|
|
zlib_source = "external"
|
|
} else if (!crashpad_is_win && !crashpad_is_fuchsia) {
|
|
zlib_source = "system"
|
|
} else if (crashpad_is_standalone) {
|
|
zlib_source = "embedded"
|
|
} else if (crashpad_is_external) {
|
|
zlib_source = "external_with_embedded_build"
|
|
}
|
|
|
|
config("zlib_config") {
|
|
if (zlib_source == "external") {
|
|
defines = [ "CRASHPAD_ZLIB_SOURCE_EXTERNAL" ]
|
|
} else if (zlib_source == "system") {
|
|
defines = [ "CRASHPAD_ZLIB_SOURCE_SYSTEM" ]
|
|
} else if (zlib_source == "embedded") {
|
|
defines = [ "CRASHPAD_ZLIB_SOURCE_EMBEDDED" ]
|
|
include_dirs = [ "zlib" ]
|
|
} else if (zlib_source == "external_with_embedded_build") {
|
|
defines = [ "CRASHPAD_ZLIB_SOURCE_EXTERNAL_WITH_EMBEDDED_BUILD" ]
|
|
include_dirs = [ "../../../../zlib/src" ]
|
|
}
|
|
}
|
|
|
|
config("Wno-sign-compare") {
|
|
cflags = [ "-Wno-sign-compare" ]
|
|
}
|
|
|
|
if (zlib_source == "external") {
|
|
group("zlib") {
|
|
public_configs = [ ":zlib_config" ]
|
|
public_deps = [ "//third_party/zlib" ]
|
|
}
|
|
} else if (zlib_source == "system") {
|
|
source_set("zlib") {
|
|
public_configs = [ ":zlib_config" ]
|
|
libs = [ "z" ]
|
|
}
|
|
} else if (zlib_source == "embedded" ||
|
|
zlib_source == "external_with_embedded_build") {
|
|
static_library("zlib") {
|
|
if (zlib_source == "embedded") {
|
|
zlib_dir = "zlib"
|
|
} else if (zlib_source == "external_with_embedded_build") {
|
|
zlib_dir = "../../../../zlib/src"
|
|
}
|
|
sources = [
|
|
"$zlib_dir/adler32.c",
|
|
"$zlib_dir/compress.c",
|
|
"$zlib_dir/crc32.c",
|
|
"$zlib_dir/crc32.h",
|
|
"$zlib_dir/deflate.c",
|
|
"$zlib_dir/deflate.h",
|
|
"$zlib_dir/gzclose.c",
|
|
"$zlib_dir/gzguts.h",
|
|
"$zlib_dir/gzlib.c",
|
|
"$zlib_dir/gzread.c",
|
|
"$zlib_dir/gzwrite.c",
|
|
"$zlib_dir/infback.c",
|
|
"$zlib_dir/inffast.c",
|
|
"$zlib_dir/inffast.h",
|
|
"$zlib_dir/inffixed.h",
|
|
"$zlib_dir/inflate.c",
|
|
"$zlib_dir/inflate.h",
|
|
"$zlib_dir/inftrees.c",
|
|
"$zlib_dir/inftrees.h",
|
|
"$zlib_dir/trees.c",
|
|
"$zlib_dir/trees.h",
|
|
"$zlib_dir/uncompr.c",
|
|
"$zlib_dir/zconf.h",
|
|
"$zlib_dir/zlib.h",
|
|
"$zlib_dir/zutil.c",
|
|
"$zlib_dir/zutil.h",
|
|
"zlib_crashpad.h",
|
|
]
|
|
|
|
cflags = []
|
|
defines = [ "HAVE_STDARG_H" ]
|
|
public_configs = [ ":zlib_config" ]
|
|
|
|
if (crashpad_is_win) {
|
|
cflags += [
|
|
"/wd4131", # uses old-style declarator
|
|
"/wd4244", # conversion from 't1' to 't2', possible loss of data
|
|
"/wd4245", # conversion from 't1' to 't2', signed/unsigned mismatch
|
|
"/wd4267", # conversion from 'size_t' to 't', possible loss of data
|
|
"/wd4324", # structure was padded due to alignment specifier
|
|
"/wd4702", # unreachable code
|
|
]
|
|
} else {
|
|
defines += [
|
|
"HAVE_HIDDEN",
|
|
"HAVE_UNISTD_H",
|
|
]
|
|
}
|
|
|
|
if (crashpad_is_fuchsia) {
|
|
# Fuchsia build's default warnings include -Wsign-compare (indirectly)
|
|
configs += [ ":Wno-sign-compare" ]
|
|
}
|
|
|
|
if (crashpad_is_standalone) {
|
|
configs -= [ "//third_party/mini_chromium/mini_chromium/build/config:Wimplicit_fallthrough" ]
|
|
} else if (crashpad_is_external) {
|
|
configs -= [ "//../../mini_chromium/mini_chromium/build/config:Wimplicit_fallthrough" ]
|
|
}
|
|
|
|
if (zlib_source == "embedded") {
|
|
sources += [ "$zlib_dir/chromeconf.h" ]
|
|
|
|
if (current_cpu == "x86" || current_cpu == "x64") {
|
|
sources += [
|
|
"$zlib_dir/crc_folding.c",
|
|
]
|
|
if (!crashpad_is_win || crashpad_is_clang) {
|
|
cflags += [
|
|
"-msse4.2",
|
|
"-mpclmul",
|
|
]
|
|
}
|
|
if (crashpad_is_clang) {
|
|
cflags += [ "-Wno-incompatible-pointer-types" ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|