From 1c77abe9095655e250713fef0996f1aa5c4c04b8 Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Mon, 14 Sep 2020 14:22:05 -0700 Subject: [PATCH] fuchsia: Centralize disabling of Wconversion Because of the multiple-worlds building of the Crashpad code in the Fuchsia tree (with the Fuchsia BUILDCONFIG.gn in particular) there's no good location to globally disable Wconversion for all of crashpad. This can be somewhat-improved by using a GN template crashpad_static_library() similar to the existing crashpad_executable() template. Includes mini_chromium DEPS roll: 68da43e Fix a couple trucation warnings 88ce866 build: set include dirs Bug: fuchsia:58162 Change-Id: I638fcf858c35b9a858ca2c410636f8c99603aed2 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2411131 Reviewed-by: Mark Mentovai Commit-Queue: Scott Graham --- DEPS | 2 +- build/crashpad_buildconfig.gni | 39 ++++++++++++++++++++++++++++++---- client/BUILD.gn | 9 +------- compat/BUILD.gn | 6 +----- minidump/BUILD.gn | 20 +---------------- snapshot/BUILD.gn | 24 +++------------------ util/BUILD.gn | 24 +++------------------ 7 files changed, 45 insertions(+), 79 deletions(-) diff --git a/DEPS b/DEPS index 444a9483..46f233f2 100644 --- a/DEPS +++ b/DEPS @@ -42,7 +42,7 @@ deps = { '7bde79cc274d06451bf65ae82c012a5d3e476b5a', 'crashpad/third_party/mini_chromium/mini_chromium': Var('chromium_git') + '/chromium/mini_chromium@' + - '3baa0e09ceaa071f6cbbd8fc718d6046533e1f1f', + '68da43e59f7ebcf39625fcef3a5303fc06240b42', 'crashpad/third_party/libfuzzer/src': Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' + 'fda403cf93ecb8792cb1d061564d89a6553ca020', diff --git a/build/crashpad_buildconfig.gni b/build/crashpad_buildconfig.gni index a8bf6cf8..51b99c3b 100644 --- a/build/crashpad_buildconfig.gni +++ b/build/crashpad_buildconfig.gni @@ -85,9 +85,10 @@ template("crashpad_executable") { } if (crashpad_is_in_fuchsia) { - fdio_config = [ "//build/config/fuchsia:fdio_config" ] - if (configs + fdio_config - fdio_config == configs) { - configs += fdio_config + conversion_config = [ "//build/config:Wno-conversion" ] + if (configs + conversion_config - conversion_config == configs) { + # TODO(https://fxbug.dev/58162): Decide if these are worth enabling. + configs += conversion_config } } } @@ -110,7 +111,37 @@ template("crashpad_loadable_module") { } if (crashpad_is_in_fuchsia) { - configs += [ "//build/config/fuchsia:fdio_config" ] + conversion_config = [ "//build/config:Wno-conversion" ] + if (configs + conversion_config - conversion_config == configs) { + # TODO(https://fxbug.dev/58162): Decide if these are worth enabling. + configs += conversion_config + } + } + } +} + +template("crashpad_static_library") { + static_library(target_name) { + forward_variables_from(invoker, + "*", + [ + "configs", + "remove_configs", + ]) + if (defined(invoker.remove_configs)) { + configs -= invoker.remove_configs + } + + if (defined(invoker.configs)) { + configs += invoker.configs + } + + if (crashpad_is_in_fuchsia) { + conversion_config = [ "//build/config:Wno-conversion" ] + if (configs + conversion_config - conversion_config == configs) { + # TODO(https://fxbug.dev/58162): Decide if these are worth enabling. + configs += conversion_config + } } } } diff --git a/client/BUILD.gn b/client/BUILD.gn index 9b2f7954..ca55ad42 100644 --- a/client/BUILD.gn +++ b/client/BUILD.gn @@ -19,7 +19,7 @@ if (crashpad_is_in_chromium) { set_sources_assignment_filter([]) } -static_library("client") { +crashpad_static_library("client") { sources = [ "annotation.cc", "annotation.h", @@ -116,7 +116,6 @@ static_library("client") { deps += [ "../third_party/fuchsia" ] if (crashpad_is_in_fuchsia) { deps += [ "//sdk/lib/fdio" ] - configs += [ "//build/config:Wno-conversion" ] } } } @@ -175,12 +174,6 @@ source_set("client_test") { if (crashpad_is_win) { data_deps += [ "../handler:crashpad_handler_console" ] } - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } if (crashpad_is_linux || crashpad_is_android) { diff --git a/compat/BUILD.gn b/compat/BUILD.gn index 6154f8f9..65c9b85a 100644 --- a/compat/BUILD.gn +++ b/compat/BUILD.gn @@ -60,7 +60,7 @@ template("compat_target") { not_needed([ "configs" ]) } } else { - static_library(target_name) { + crashpad_static_library(target_name) { forward_variables_from(invoker, "*", [ "configs" ]) if (!defined(configs)) { configs = [] @@ -177,8 +177,4 @@ compat_target("compat") { if (!crashpad_is_linux && !crashpad_is_android && !crashpad_is_fuchsia) { deps += [ "../third_party/glibc" ] } - - if (crashpad_is_in_fuchsia) { - configs = [ "//build/config:Wno-conversion" ] - } } diff --git a/minidump/BUILD.gn b/minidump/BUILD.gn index 810a1d7e..d07c1dd4 100644 --- a/minidump/BUILD.gn +++ b/minidump/BUILD.gn @@ -19,7 +19,7 @@ if (crashpad_is_in_chromium) { set_sources_assignment_filter([]) } -static_library("minidump") { +crashpad_static_library("minidump") { sources = [ "minidump_annotation_writer.cc", "minidump_annotation_writer.h", @@ -90,12 +90,6 @@ static_library("minidump") { "/wd4324", # 'struct' : structure was padded due to __declspec(align()) ] } - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } # :format is the only part of minidump that snapshot may depend on. @@ -154,12 +148,6 @@ static_library("test_support") { if (crashpad_is_win) { cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union } - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } source_set("minidump_test") { @@ -205,10 +193,4 @@ source_set("minidump_test") { } configs += [ "..:disable_ubsan" ] - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } diff --git a/snapshot/BUILD.gn b/snapshot/BUILD.gn index c1dfc049..49a809a6 100644 --- a/snapshot/BUILD.gn +++ b/snapshot/BUILD.gn @@ -22,7 +22,7 @@ if (crashpad_is_in_chromium) { set_sources_assignment_filter([]) } -static_library("snapshot") { +crashpad_static_library("snapshot") { sources = [ "annotation_snapshot.cc", "annotation_snapshot.h", @@ -242,6 +242,8 @@ static_library("snapshot") { public_configs = [ "..:crashpad_config" ] + configs = [ "..:disable_ubsan" ] + public_deps = [ ":context" ] deps = [ @@ -260,14 +262,6 @@ static_library("snapshot") { cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union libs = [ "powrprof.lib" ] } - - configs += [ "..:disable_ubsan" ] - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } # :context is the only part of snapshot that minidump may depend on. @@ -288,12 +282,6 @@ static_library("context") { if (crashpad_is_win) { cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union } - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } if (crashpad_is_linux) { @@ -482,12 +470,6 @@ source_set("snapshot_test") { ":crashpad_snapshot_test_image_reader_module", ] } - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } crashpad_loadable_module("crashpad_snapshot_test_module") { diff --git a/util/BUILD.gn b/util/BUILD.gn index e9b7e725..f35b840b 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -155,7 +155,7 @@ if (crashpad_is_mac || crashpad_is_ios) { } } -static_library("util") { +crashpad_static_library("util") { sources = [ "file/delimited_file_reader.cc", "file/delimited_file_reader.h", @@ -567,6 +567,8 @@ static_library("util") { public_configs = [ "..:crashpad_config" ] + configs = [ "..:disable_ubsan" ] + # Include generated files starting with "util". if (crashpad_is_in_fuchsia) { include_dirs = [ "$root_gen_dir/third_party/crashpad" ] @@ -622,14 +624,6 @@ static_library("util") { if (crashpad_is_android || crashpad_is_linux) { deps += [ "../third_party/lss" ] } - - configs += [ "..:disable_ubsan" ] - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } if (!crashpad_is_android && !crashpad_is_ios) { @@ -668,12 +662,6 @@ if (!crashpad_is_android && !crashpad_is_ios) { ] } } - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs = [ "//build/config:Wno-conversion" ] - } } } @@ -889,12 +877,6 @@ source_set("util_test") { ":crashpad_util_test_safe_terminate_process_test_child", ] } - - if (crashpad_is_in_fuchsia) { - # TODO(https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=58162): - # Delete the below and fix compiler warnings - configs += [ "//build/config:Wno-conversion" ] - } } if (crashpad_is_ios) {