From 443e019a99a66cd7ca5e10a7045cdca2da7d7d22 Mon Sep 17 00:00:00 2001 From: thestig Date: Sat, 7 Mar 2015 19:56:33 -0800 Subject: [PATCH] Linux: Enable ODR violation detection. (try 2) BUG=449754 Review URL: https://codereview.chromium.org/988633004 Cr-Original-Commit-Position: refs/heads/master@{#319577} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 82d64ef43c1d15e1cc25d4b0d38dc314a0f565c0 --- common.gypi | 8 ++++++++ config/compiler/BUILD.gn | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common.gypi b/common.gypi index 85c3b03f3..fd2fc1a27 100644 --- a/common.gypi +++ b/common.gypi @@ -4490,6 +4490,14 @@ # '-Wl,--threads', # '-Wl,--thread-count=4', ], + 'conditions': [ + # TODO(thestig): Enable this for disabled cases. + [ 'buildtype!="Official" and chromeos==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan==0 and ubsan_vptr==0', { + 'ldflags': [ + '-Wl,--detect-odr-violations', + ], + }], + ], }], ], 'conditions': [ diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn index acdf45e6e..0145175ae 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn @@ -78,7 +78,7 @@ if (!is_win) { # # Base compiler configuration. # -# See also "runtime_library" below for related stuff and a discusison about +# See also "runtime_library" below for related stuff and a discussion about # where stuff should go. Put warning related stuff in the "warnings" config. config("compiler") { @@ -399,6 +399,13 @@ config("compiler") { #"-Wl,--threads", #"-Wl,--thread-count=4", ] + + # TODO(thestig): Make this flag work with GN. + #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan || is_msan)) { + # ldflags += [ + # "-Wl,--detect-odr-violations", + # ] + #} } if (linux_use_bundled_binutils) { @@ -719,7 +726,6 @@ config("default_warnings") { if (is_win) { cflags = [ "/WX", # Treat warnings as errors. - # Warnings permanently disabled: # TODO(GYP) The GYP build doesn't have this globally enabled but disabled @@ -774,7 +780,6 @@ config("default_warnings") { # have to turn off this warning (and be careful about how object # destruction happens in such cases). "/wd4611", - # Warnings to evaluate and possibly fix/reenable later: "/wd4100", # Unreferenced formal function parameter.