Build certain gtest/gmock tests with -Wno-unused-private-field

Fuchsia is using a newer Clang than I was using on macOS when I wrote
these GN targets, and -Wunused-private-field can now detect these
violations.

Change-Id: If71eb74f6453957aa92852cbe53356e325c7b635
Reviewed-on: https://chromium-review.googlesource.com/833195
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Mark Mentovai 2017-12-18 15:26:15 -05:00 committed by Commit Bot
parent 1764594bff
commit b51adda8d2
3 changed files with 60 additions and 4 deletions

View File

@ -147,6 +147,13 @@ test("gtest_param_test") {
deps = [
":gtest",
]
if (is_clang) {
cflags_cc = [
# For gtest/googlemock/test/gmock-matchers_test.ccs Unstreamable::value_.
"-Wno-unused-private-field",
]
}
}
test("gtest_premature_exit_test") {
@ -221,12 +228,13 @@ config("gmock_private_config") {
config("gmock_public_config") {
include_dirs = [ "gtest/googlemock/include" ]
# The MOCK_METHODn() macros do not specify “override”, which triggers this
# warning in users: “error: 'Method' overrides a member function but is not
# marked 'override' [-Werror,-Winconsistent-missing-override]”. Suppress these
# warnings until https://github.com/google/googletest/issues/533 is fixed.
if (is_clang) {
cflags_cc = [
# The MOCK_METHODn() macros do not specify “override”, which triggers this
# warning in users: “error: 'Method' overrides a member function but is
# not marked 'override' [-Werror,-Winconsistent-missing-override]”.
# Suppress these warnings until
# https://github.com/google/googletest/issues/533 is fixed.
"-Wno-inconsistent-missing-override",
]
}
@ -306,6 +314,14 @@ test("gmock_all_test") {
":gmock_main",
":gtest",
]
if (is_clang) {
cflags_cc = [
# For gtest/googlemock/test/gmock-matchers_test.ccs
# testing::gmock_matchers_test::Unprintable::c_.
"-Wno-unused-private-field",
]
}
}
test("gmock_link_test") {

View File

@ -168,6 +168,26 @@
'<(gmock_dir)/test/gmock-spec-builders_test.cc',
'<(gmock_dir)/test/gmock_test.cc',
],
'conditions': [
['clang!=0', {
# For gtest/googlemock/test/gmock-matchers_test.ccs
# Unstreamable::value_.
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'WARNING_CFLAGS': [
'-Wno-unused-private-field',
],
},
}],
['OS=="linux" or OS=="android"', {
'cflags': [
'-Wno-unused-private-field',
],
}],
],
}],
],
},
{
'target_name': 'gmock_link_test',

View File

@ -216,6 +216,26 @@
'<(gtest_dir)/test/gtest-param-test_test.cc',
'<(gtest_dir)/test/gtest-param-test_test.h',
],
'conditions': [
['clang!=0', {
# For gtest/googlemock/test/gmock-matchers_test.ccs
# Unstreamable::value_.
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'WARNING_CFLAGS': [
'-Wno-unused-private-field',
],
},
}],
['OS=="linux" or OS=="android"', {
'cflags': [
'-Wno-unused-private-field',
],
}],
],
}],
],
},
{
'target_name': 'gtest_premature_exit_test',