Merge r357342 from the clang1000-import branch:

Work around two -Werror warning issues in googletest, which have been
solved upstream in the mean time.

The first issue is because one of googletest's generated headers contain
classes with a user-declared copy assignment operator, but rely on the
generation by the compiler of an implicit copy constructor, which is now
deprecated:

/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-param-util-generated.h:5284:8: error: definition of implicit copy constructor for 'CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
  void operator=(const CartesianProductHolder3& other);
       ^
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/gtest-param-test.h:1277:10: note: in implicit copy constructor for 'testing::internal::CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' first required here
  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
         ^
/usr/src/tests/sys/fs/fusefs/io.cc:534:2: note: in instantiation of function template specialization 'testing::Combine<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' requested here
        Combine(Bool(),                                 /* async read */
        ^

For now, silence the warning using -Wno-deprecated-copy.

The second issue is because one of the googlemock test programs attempts
to use "unsigned wchar_t" and "signed wchar_t", which are non-standard
and at best, hazily defined:

contrib/googletest/googlemock/test/gmock-actions_test.cc:111:37: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0U, BuiltInDefaultValue<unsigned wchar_t>::Get());
                                    ^
contrib/googletest/googlemock/test/gmock-actions_test.cc:112:36: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
                                   ^

For now, silence the warning using -Wno-signed-unsigned-wchar.

MFC after:	3 days
This commit is contained in:
dim 2020-01-31 19:06:01 +00:00
parent d57fc34f88
commit 4716074cdc

View File

@ -5,6 +5,18 @@ GTESTS_CXXFLAGS+= -DGTEST_HAS_PTHREAD=1
GTESTS_CXXFLAGS+= -DGTEST_HAS_STREAM_REDIRECTION=1
GTESTS_CXXFLAGS+= -frtti
.include <bsd.compiler.mk>
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 100000
# Required until googletest is upgraded to a more recent version (after
# upstream commit efecb0bfa687cf87836494f5d62868485c00fb66).
GTESTS_CXXFLAGS+= -Wno-deprecated-copy
# Required until googletest is upgraded to a more recent version (after
# upstream commit d44b137fd104dfffdcdea103f7de11b9eccc45c2).
GTESTS_CXXFLAGS+= -Wno-signed-unsigned-wchar
.endif
# XXX: src.libnames.mk should handle adding this directory for libgtest's,
# libgmock's, etc, headers.
CXXFLAGS+= -I${DESTDIR}${INCLUDEDIR}/private