Enable -Wexit-time-destructors and -Wglobal-constructors.
This CL enables -Wexit-time-destructors and -Wglobal-constructors on rtc_static_library and rtc_source_set build targets. It also adds the possibility to suppress these warnings because they trigger in a few places. The long term goal is to avoid regressions on this and remove all the suppressions. Bug: webrtc:9693 Change-Id: I4c1ecc137ef9e87ec5e66981ce95d96fb082727c Reviewed-on: https://webrtc-review.googlesource.com/98380 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24604}
This commit is contained in:

committed by
Commit Bot

parent
47c48b8032
commit
96ede16a4e
26
BUILD.gn
26
BUILD.gn
@ -166,6 +166,32 @@ config("common_inherited_config") {
|
||||
}
|
||||
}
|
||||
|
||||
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
|
||||
# as soon as WebRTC compiles without it.
|
||||
config("no_exit_time_destructors") {
|
||||
if (is_clang) {
|
||||
cflags = [ "-Wno-exit-time-destructors" ]
|
||||
}
|
||||
}
|
||||
|
||||
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
|
||||
# as soon as WebRTC compiles without it.
|
||||
config("no_global_constructors") {
|
||||
if (is_clang) {
|
||||
cflags = [ "-Wno-global-constructors" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("rtc_prod_config") {
|
||||
# Ideally, WebRTC production code (but not test code) should have these flags.
|
||||
if (is_clang) {
|
||||
cflags = [
|
||||
"-Wexit-time-destructors",
|
||||
"-Wglobal-constructors",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
config("common_config") {
|
||||
cflags = []
|
||||
cflags_c = []
|
||||
|
@ -1156,6 +1156,10 @@ rtc_source_set("neteq_test_tools") {
|
||||
|
||||
rtc_source_set("neteq_tools") {
|
||||
visibility += webrtc_default_visibility
|
||||
configs += [
|
||||
"../..:no_exit_time_destructors",
|
||||
"../..:no_global_constructors",
|
||||
]
|
||||
sources = [
|
||||
"neteq/tools/fake_decode_from_file.cc",
|
||||
"neteq/tools/fake_decode_from_file.h",
|
||||
|
@ -147,6 +147,7 @@ rtc_source_set("audio_device_name") {
|
||||
}
|
||||
|
||||
rtc_source_set("windows_core_audio_utility") {
|
||||
public_configs = [ "../..:no_global_constructors" ]
|
||||
if (is_win && !build_with_chromium) {
|
||||
sources = [
|
||||
"win/core_audio_utility_win.cc",
|
||||
@ -303,6 +304,7 @@ rtc_source_set("audio_device_impl") {
|
||||
defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
|
||||
} else {
|
||||
if (is_linux) {
|
||||
configs += [ "../../..:no_global_constructors" ]
|
||||
sources += [
|
||||
"linux/alsasymboltable_linux.cc",
|
||||
"linux/alsasymboltable_linux.h",
|
||||
@ -320,6 +322,7 @@ rtc_source_set("audio_device_impl") {
|
||||
defines += [ "WEBRTC_USE_X11" ]
|
||||
}
|
||||
if (rtc_include_pulse_audio) {
|
||||
configs += [ "../..:no_exit_time_destructors" ]
|
||||
sources += [
|
||||
"linux/audio_device_pulse_linux.cc",
|
||||
"linux/audio_device_pulse_linux.h",
|
||||
|
@ -9,6 +9,7 @@
|
||||
import("../../../../webrtc.gni")
|
||||
|
||||
rtc_source_set("rnn_vad") {
|
||||
configs += [ "../../../..:no_global_constructors" ]
|
||||
sources = [
|
||||
"common.h",
|
||||
"features_extraction.cc",
|
||||
|
@ -23,6 +23,7 @@ rtc_static_library("bbr") {
|
||||
|
||||
rtc_source_set("bbr_controller") {
|
||||
visibility = [ ":*" ]
|
||||
configs += [ "../../..:no_global_constructors" ]
|
||||
sources = [
|
||||
"bbr_network_controller.cc",
|
||||
"bbr_network_controller.h",
|
||||
|
@ -17,7 +17,10 @@ config("bwe_test_logging") {
|
||||
}
|
||||
|
||||
rtc_static_library("goog_cc") {
|
||||
configs += [ ":bwe_test_logging" ]
|
||||
configs += [
|
||||
":bwe_test_logging",
|
||||
"../../..:no_global_constructors",
|
||||
]
|
||||
sources = [
|
||||
"goog_cc_factory.cc",
|
||||
"goog_cc_network_control.cc",
|
||||
|
@ -26,6 +26,7 @@ rtc_static_library("pcc_controller") {
|
||||
"pcc_network_controller.cc",
|
||||
"pcc_network_controller.h",
|
||||
]
|
||||
configs += [ "../../..:no_global_constructors" ]
|
||||
deps = [
|
||||
":bitrate_controller",
|
||||
":monitor_interval",
|
||||
|
@ -33,6 +33,10 @@ rtc_static_library("remote_bitrate_estimator") {
|
||||
|
||||
if (rtc_enable_bwe_test_logging) {
|
||||
defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1" ]
|
||||
configs += [
|
||||
"../..:no_exit_time_destructors",
|
||||
"../..:no_global_constructors",
|
||||
]
|
||||
sources += [ "test/bwe_test_logging.cc" ]
|
||||
} else {
|
||||
defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0" ]
|
||||
|
@ -71,6 +71,8 @@ if (!build_with_chromium) {
|
||||
rtc_source_set("video_capture_internal_impl_objc") {
|
||||
visibility = [ ":video_capture_internal_impl" ]
|
||||
|
||||
configs += [ "../..:no_global_constructors" ]
|
||||
|
||||
deps = [
|
||||
":video_capture_module",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
|
@ -14,6 +14,7 @@ if (is_android) {
|
||||
|
||||
rtc_static_library("ortc") {
|
||||
defines = []
|
||||
configs += [ "..:no_exit_time_destructors" ]
|
||||
sources = [
|
||||
"ortcfactory.cc",
|
||||
"ortcfactory.h",
|
||||
|
@ -117,6 +117,7 @@ rtc_source_set("rtc_pc") {
|
||||
rtc_static_library("peerconnection") {
|
||||
visibility = [ "*" ]
|
||||
cflags = []
|
||||
configs += [ "..:no_exit_time_destructors" ]
|
||||
sources = [
|
||||
"audiotrack.cc",
|
||||
"audiotrack.h",
|
||||
|
@ -208,6 +208,10 @@ rtc_source_set("logging") {
|
||||
"../../webrtc_overrides/rtc_base/logging.h",
|
||||
]
|
||||
} else {
|
||||
configs += [
|
||||
"..:no_exit_time_destructors",
|
||||
"..:no_global_constructors",
|
||||
]
|
||||
sources = [
|
||||
"logging.cc",
|
||||
"logging.h",
|
||||
@ -881,6 +885,10 @@ rtc_static_library("rtc_base_generic") {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
configs += [
|
||||
"..:no_exit_time_destructors",
|
||||
"..:no_global_constructors",
|
||||
]
|
||||
sources += [
|
||||
"win32socketinit.cc",
|
||||
"win32socketinit.h",
|
||||
|
@ -531,6 +531,7 @@ if (is_ios || is_mac) {
|
||||
|
||||
rtc_static_library("videocodec_objc") {
|
||||
visibility = [ "*" ]
|
||||
configs += [ "..:no_global_constructors" ]
|
||||
sources = [
|
||||
"objc/components/video_codec/RTCCodecSpecificInfoH264+Private.h",
|
||||
"objc/components/video_codec/RTCCodecSpecificInfoH264.h",
|
||||
@ -585,6 +586,7 @@ if (is_ios || is_mac) {
|
||||
}
|
||||
|
||||
rtc_static_library("vpx_codec_constants") {
|
||||
configs += [ "..:no_global_constructors" ]
|
||||
sources = [
|
||||
"objc/api/video_codec/RTCVideoCodecConstants.h",
|
||||
"objc/api/video_codec/RTCVideoCodecConstants.mm",
|
||||
@ -664,6 +666,7 @@ if (is_ios || is_mac) {
|
||||
}
|
||||
|
||||
rtc_static_library("mediaconstraints_objc") {
|
||||
configs += [ "..:no_global_constructors" ]
|
||||
sources = [
|
||||
"objc/api/peerconnection/RTCMediaConstraints+Private.h",
|
||||
"objc/api/peerconnection/RTCMediaConstraints.h",
|
||||
@ -775,6 +778,10 @@ if (is_ios || is_mac) {
|
||||
"audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
|
||||
"software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove.
|
||||
]
|
||||
configs += [
|
||||
"..:no_exit_time_destructors",
|
||||
"..:no_global_constructors",
|
||||
]
|
||||
sources = [
|
||||
"objc/api/peerconnection/RTCAudioSource+Private.h",
|
||||
"objc/api/peerconnection/RTCAudioSource.h",
|
||||
|
@ -602,6 +602,11 @@ if (is_android) {
|
||||
# considered public and are subject to change.
|
||||
visibility = [ "*" ]
|
||||
|
||||
configs += [
|
||||
"../..:no_exit_time_destructors",
|
||||
"../..:no_global_constructors",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"src/jni/androidnetworkmonitor_jni.h",
|
||||
"src/jni/pc/androidnetworkmonitor.h",
|
||||
|
@ -14,6 +14,7 @@ import("../webrtc.gni")
|
||||
|
||||
rtc_static_library("system_wrappers") {
|
||||
visibility = [ "*" ]
|
||||
configs += [ "..:no_exit_time_destructors" ]
|
||||
sources = [
|
||||
"include/clock.h",
|
||||
"include/cpu_info.h",
|
||||
@ -144,6 +145,7 @@ rtc_source_set("field_trial_default") {
|
||||
|
||||
rtc_source_set("runtime_enabled_features_default") {
|
||||
visibility = [ "*" ]
|
||||
configs += [ "..:no_global_constructors" ]
|
||||
sources = [
|
||||
"source/runtime_enabled_features_default.cc",
|
||||
]
|
||||
|
@ -266,6 +266,7 @@ rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
|
||||
# Common configs to remove or add in all rtc targets.
|
||||
rtc_remove_configs = []
|
||||
rtc_add_configs = rtc_common_configs
|
||||
rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
|
||||
|
||||
set_defaults("rtc_test") {
|
||||
configs = rtc_add_configs
|
||||
@ -426,6 +427,10 @@ template("rtc_source_set") {
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined(testonly) || !testonly) {
|
||||
configs += rtc_prod_configs
|
||||
}
|
||||
|
||||
configs += invoker.configs
|
||||
configs -= rtc_remove_configs
|
||||
configs -= invoker.suppressed_configs
|
||||
@ -530,6 +535,10 @@ template("rtc_static_library") {
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined(testonly) || !testonly) {
|
||||
configs += rtc_prod_configs
|
||||
}
|
||||
|
||||
configs += invoker.configs
|
||||
configs -= rtc_remove_configs
|
||||
configs -= invoker.suppressed_configs
|
||||
|
Reference in New Issue
Block a user