git: 4b98fe9def2d - stable/13 - Fix GoogleTest 1.14.0 import

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Tue, 01 Apr 2025 05:31:03 UTC
The branch stable/13 has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b98fe9def2d182c45bc86fc6716c47e957902c3

commit 4b98fe9def2d182c45bc86fc6716c47e957902c3
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2023-08-18 11:28:13 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2025-04-01 05:30:20 +0000

    Fix GoogleTest 1.14.0 import
    
    - Prune headers and tests no longer installed after the upgrade.
    - Remove GoogleTest-related files when MK_GOOGLETEST == no.
    - Disable `-Werror` with gcc to unbreak the gcc12 CI run with
      `lib/googletest`. Any issues found by g++ will be filed
      upstream and hopefully resolved in a future version.
    - Remove clang -Werror issues which are resolved in version 1.14.0 to
      avoid masking valid issues.
    
    Conflicts:
            ObsoleteFiles.inc
            tools/build/mk/OptionalObsoleteFiles.inc
    
    MFC after:      1 week
    MFC with:       28f6c2f292806bf31230a959bc4b19d7081669a7
    
    (cherry picked from commit 0c785f06020f3b02e34c97eb27fecd3af8eb2a7b)
---
 ObsoleteFiles.inc                        |  16 ++++
 lib/googletest/tests/gmock_main/Makefile |   1 +
 lib/googletest/tests/gtest/Makefile      |   1 +
 lib/googletest/tests/gtest_main/Makefile |   1 +
 share/mk/googletest.test.inc.mk          |  11 ---
 tools/build/mk/OptionalObsoleteFiles.inc | 157 ++++++++++++++++---------------
 6 files changed, 98 insertions(+), 89 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index eca0397d899a..7d17e95aca27 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -1419,6 +1419,22 @@ OLD_FILES+=usr/share/certs/trusted/E-Tugra_Global_Root_CA_ECC_v3.pem
 OLD_FILES+=usr/share/certs/trusted/E-Tugra_Global_Root_CA_RSA_v3.pem
 OLD_FILES+=usr/share/certs/trusted/Hongkong_Post_Root_CA_1.pem
 
+# 20230807: GoogleTest 1.14.0 upgrade.
+OLD_FILES+=usr/include/private/gmock/gmock-generated-actions.h
+OLD_FILES+=usr/include/private/gmock/gmock-generated-function-mockers.h
+OLD_FILES+=usr/include/private/gmock/gmock-generated-matchers.h
+OLD_FILES+=usr/include/private/gmock/gmock-generated-nice-strict.h
+OLD_FILES+=usr/include/private/gmock/internal/gmock-generated-internal-utils.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-linked_ptr.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-param-util-generated.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-tuple.h
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-actions_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-function-mockers_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-internal-utils_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-matchers_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers_test
+OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-linked-ptr-test
+
 # 20230806: Removal of support for the VTOC8 partitioning scheme
 OLD_FILES+=usr/include/sys/disk/vtoc.h
 OLD_FILES+=usr/include/sys/vtoc.h
diff --git a/lib/googletest/tests/gmock_main/Makefile b/lib/googletest/tests/gmock_main/Makefile
index 737c64b653a4..7523b585ac2c 100644
--- a/lib/googletest/tests/gmock_main/Makefile
+++ b/lib/googletest/tests/gmock_main/Makefile
@@ -34,5 +34,6 @@ CXXFLAGS.clang+=	-Wno-error=inconsistent-missing-override
 CXXFLAGS.clang+=	-Wno-error=missing-variable-declarations
 CXXFLAGS.clang+=	-Wno-error=sign-compare
 CXXFLAGS.clang+=	-Wno-error=unused-parameter
+MK_WERROR.gcc=		no
 
 .include <bsd.test.mk>
diff --git a/lib/googletest/tests/gtest/Makefile b/lib/googletest/tests/gtest/Makefile
index e95101738322..0000167dfe70 100644
--- a/lib/googletest/tests/gtest/Makefile
+++ b/lib/googletest/tests/gtest/Makefile
@@ -36,6 +36,7 @@ SRCS.googletest-param-test-test=       \
 LIBADD+=	gtest
 
 CXXFLAGS.clang+=	-Wno-error=missing-variable-declarations
+MK_WERROR.gcc=		no
 
 # XXX: explicitly listing -lpthread is incorrect. src.libnames.mk should be
 #      handling this.
diff --git a/lib/googletest/tests/gtest_main/Makefile b/lib/googletest/tests/gtest_main/Makefile
index 49831d7513af..3124042f8b95 100644
--- a/lib/googletest/tests/gtest_main/Makefile
+++ b/lib/googletest/tests/gtest_main/Makefile
@@ -38,5 +38,6 @@ LIBADD.gtest_unittest+=		pthread
 
 CXXFLAGS.clang+=	-Wno-error=missing-variable-declarations
 CXXFLAGS.clang+=	-Wno-error=unused-but-set-variable
+MK_WERROR.gcc=		no
 
 .include <bsd.test.mk>
diff --git a/share/mk/googletest.test.inc.mk b/share/mk/googletest.test.inc.mk
index 2034e12eaf30..05415775448b 100644
--- a/share/mk/googletest.test.inc.mk
+++ b/share/mk/googletest.test.inc.mk
@@ -1,4 +1,3 @@
-
 GTESTS_CXXFLAGS+= -DGTEST_HAS_POSIX_RE=1
 GTESTS_CXXFLAGS+= -DGTEST_HAS_PTHREAD=1
 GTESTS_CXXFLAGS+= -DGTEST_HAS_STREAM_REDIRECTION=1
@@ -6,16 +5,6 @@ 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
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index be2c26296828..a9436af31b77 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -2215,88 +2215,82 @@ OLD_FILES+=usr/share/man/man1/llvm-profdata.1.gz
 .endif
 
 .if ${MK_GOOGLETEST} == no
-OLD_FILES+=usr/include/gmock/gmock-actions.h
-OLD_FILES+=usr/include/gmock/gmock-cardinalities.h
-OLD_FILES+=usr/include/gmock/gmock-generated-actions.h
-OLD_FILES+=usr/include/gmock/gmock-generated-function-mockers.h
-OLD_FILES+=usr/include/gmock/gmock-generated-matchers.h
-OLD_FILES+=usr/include/gmock/gmock-generated-nice-strict.h
-OLD_FILES+=usr/include/gmock/gmock-matchers.h
-OLD_FILES+=usr/include/gmock/gmock-more-actions.h
-OLD_FILES+=usr/include/gmock/gmock-more-matchers.h
-OLD_FILES+=usr/include/gmock/gmock-spec-builders.h
-OLD_FILES+=usr/include/gmock/gmock.h
-OLD_FILES+=usr/include/gmock/internal/custom/gmock-generated-actions.h
-OLD_FILES+=usr/include/gmock/internal/custom/gmock-matchers.h
-OLD_FILES+=usr/include/gmock/internal/custom/gmock-port.h
-OLD_FILES+=usr/include/gmock/internal/gmock-generated-internal-utils.h
-OLD_FILES+=usr/include/gmock/internal/gmock-internal-utils.h
-OLD_FILES+=usr/include/gmock/internal/gmock-port.h
-OLD_DIRS+=usr/include/gmock
-OLD_FILES+=usr/include/gtest/gtest_pred_impl.h
-OLD_FILES+=usr/include/gtest/gtest_prod.h
-OLD_FILES+=usr/include/gtest/gtest-death-test.h
-OLD_FILES+=usr/include/gtest/gtest-message.h
-OLD_FILES+=usr/include/gtest/gtest-param-test.h
-OLD_FILES+=usr/include/gtest/gtest-printers.h
-OLD_FILES+=usr/include/gtest/gtest-spi.h
-OLD_FILES+=usr/include/gtest/gtest-test-part.h
-OLD_FILES+=usr/include/gtest/gtest-typed-test.h
-OLD_FILES+=usr/include/gtest/gtest.h
-OLD_FILES+=usr/include/gtest/internal/custom/gtest-port.h
-OLD_FILES+=usr/include/gtest/internal/custom/gtest-printers.h
-OLD_FILES+=usr/include/gtest/internal/custom/gtest.h
-OLD_FILES+=usr/include/gtest/internal/gtest-death-test-internal.h
-OLD_FILES+=usr/include/gtest/internal/gtest-filepath.h
-OLD_FILES+=usr/include/gtest/internal/gtest-internal.h
-OLD_FILES+=usr/include/gtest/internal/gtest-linked_ptr.h
-OLD_FILES+=usr/include/gtest/internal/gtest-param-util-generated.h
-OLD_FILES+=usr/include/gtest/internal/gtest-param-util.h
-OLD_FILES+=usr/include/gtest/internal/gtest-port-arch.h
-OLD_FILES+=usr/include/gtest/internal/gtest-port.h
-OLD_FILES+=usr/include/gtest/internal/gtest-string.h
-OLD_FILES+=usr/include/gtest/internal/gtest-tuple.h
-OLD_FILES+=usr/include/gtest/internal/gtest-type-util.h
-OLD_DIRS+=usr/include/gtest
-OLD_FILES+=usr/lib/libprivategmock_main.a
-OLD_FILES+=usr/lib/libprivategmock_main.so
-OLD_LIBS+=usr/lib/libprivategmock_main.so.0
-OLD_FILES+=usr/lib/libprivategmock_main_p.a
+OLD_FILES+=usr/include/private/gmock/gmock-actions.h
+OLD_FILES+=usr/include/private/gmock/gmock-cardinalities.h
+OLD_FILES+=usr/include/private/gmock/gmock-function-mocker.h
+OLD_FILES+=usr/include/private/gmock/gmock-matchers.h
+OLD_FILES+=usr/include/private/gmock/gmock-more-actions.h
+OLD_FILES+=usr/include/private/gmock/gmock-more-matchers.h
+OLD_FILES+=usr/include/private/gmock/gmock-nice-strict.h
+OLD_FILES+=usr/include/private/gmock/gmock-spec-builders.h
+OLD_FILES+=usr/include/private/gmock/gmock.h
+OLD_FILES+=usr/include/private/gmock/internal/custom/gmock-generated-actions.h
+OLD_FILES+=usr/include/private/gmock/internal/custom/gmock-matchers.h
+OLD_FILES+=usr/include/private/gmock/internal/custom/gmock-port.h
+OLD_FILES+=usr/include/private/gmock/internal/gmock-internal-utils.h
+OLD_FILES+=usr/include/private/gmock/internal/gmock-port.h
+OLD_FILES+=usr/include/private/gmock/internal/gmock-pp.h
+OLD_FILES+=usr/include/private/gtest/gtest-assertion-result.h
+OLD_FILES+=usr/include/private/gtest/gtest-death-test.h
+OLD_FILES+=usr/include/private/gtest/gtest-matchers.h
+OLD_FILES+=usr/include/private/gtest/gtest-message.h
+OLD_FILES+=usr/include/private/gtest/gtest-param-test.h
+OLD_FILES+=usr/include/private/gtest/gtest-printers.h
+OLD_FILES+=usr/include/private/gtest/gtest-spi.h
+OLD_FILES+=usr/include/private/gtest/gtest-test-part.h
+OLD_FILES+=usr/include/private/gtest/gtest-typed-test.h
+OLD_FILES+=usr/include/private/gtest/gtest.h
+OLD_FILES+=usr/include/private/gtest/gtest_pred_impl.h
+OLD_FILES+=usr/include/private/gtest/gtest_prod.h
+OLD_FILES+=usr/include/private/gtest/internal/custom/gtest-port.h
+OLD_FILES+=usr/include/private/gtest/internal/custom/gtest-printers.h
+OLD_FILES+=usr/include/private/gtest/internal/custom/gtest.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-death-test-internal.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-filepath.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-internal.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-param-util.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-port-arch.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-port.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-string.h
+OLD_FILES+=usr/include/private/gtest/internal/gtest-type-util.h
 OLD_FILES+=usr/lib/libprivategmock.a
-OLD_FILES+=usr/lib/libprivategmock.so
-OLD_LIBS+=usr/lib/libprivategmock.so.0
 OLD_FILES+=usr/lib/libprivategmock_p.a
-OLD_FILES+=usr/lib/libprivategtest_main.a
-OLD_FILES+=usr/lib/libprivategtest_main.so
-OLD_LIBS+=usr/lib/libprivategtest_main.so.0
-OLD_FILES+=usr/lib/libprivategtest_main_p.a
+OLD_LIBS+=usr/lib/libprivategmock.so
+OLD_LIBS+=usr/lib/libprivategmock.so.0
+OLD_FILES+=usr/lib/libprivategmock_main.a
+OLD_FILES+=usr/lib/libprivategmock_main_p.a
+OLD_LIBS+=usr/lib/libprivategmock_main.so
+OLD_LIBS+=usr/lib/libprivategmock_main.so.0
 OLD_FILES+=usr/lib/libprivategtest.a
-OLD_FILES+=usr/lib/libprivategtest.so
-OLD_LIBS+=usr/lib/libprivategtest.so.0
 OLD_FILES+=usr/lib/libprivategtest_p.a
-OLD_FILES+=usr/tests/lib/googletest/gmock/gmock_stress_test
+OLD_LIBS+=usr/lib/libprivategtest.so
+OLD_LIBS+=usr/lib/libprivategtest.so.0
+OLD_FILES+=usr/lib/libprivategtest_main.a
+OLD_FILES+=usr/lib/libprivategtest_main_p.a
+OLD_LIBS+=usr/lib/libprivategtest_main.so
+OLD_LIBS+=usr/lib/libprivategtest_main.so.0
+OLD_FILES+=usr/tests/lib/googletest/Kyuafile
 OLD_FILES+=usr/tests/lib/googletest/gmock/Kyuafile
-OLD_DIRS+=usr/tests/lib/googletest/gmock
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_ex_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_link_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_test
+OLD_FILES+=usr/tests/lib/googletest/gmock/gmock_stress_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/Kyuafile
 OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-actions_test
 OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-cardinalities_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-ex_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-actions_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-function-mockers_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-internal-utils_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-matchers_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-function-mocker_test
 OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-internal-utils_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers-arithmetic_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers-comparisons_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers-containers_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers-misc_test
 OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-more-actions_test
 OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-nice-strict_test
 OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-port_test
 OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-spec-builders_test
-OLD_FILES+=usr/tests/lib/googletest/gmock_main/Kyuafile
-OLD_DIRS+=usr/tests/lib/googletest/gmock_main
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_ex_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_link_test
+OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_test
+OLD_FILES+=usr/tests/lib/googletest/gtest/Kyuafile
 OLD_FILES+=usr/tests/lib/googletest/gtest/googletest-param-test-test
-OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_all_test
+OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-unittest-api_test
 OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_environment_test
 OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_no_test_unittest
 OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_premature_exit_test
@@ -2308,9 +2302,9 @@ OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-death-test_ex_nocatch_test
 OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-unittest-api_test
 OLD_FILES+=usr/tests/lib/googletest/gtest/Kyuafile
 OLD_DIRS+=usr/tests/lib/googletest/gtest
+OLD_FILES+=usr/tests/lib/googletest/gtest_main/Kyuafile
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-death-test-test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-filepath-test
-OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-linked-ptr-test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-listener-test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-message-test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-options-test
@@ -2318,21 +2312,17 @@ OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-port-test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-printers-test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-test-part-test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_help_test_
+OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest-typed-test_test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_main_unittest
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_pred_impl_unittest
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_prod_test
+OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_skip_in_environment_setup_test
+OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_skip_test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_sole_header_test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_unittest
-OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_xml_outfile1_test_
-OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_xml_outfile2_test_
-OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest-typed-test_test
-OLD_FILES+=usr/tests/lib/googletest/gtest_main/Kyuafile
-OLD_DIRS+=usr/tests/lib/googletest/gtest_main
-OLD_FILES+=usr/tests/lib/googletest/Kyuafile
-OLD_DIRS+=usr/tests/lib/googletest/
 OLD_FILES+=usr/tests/share/examples/tests/googletest/Kyuafile
-OLD_FILES+=usr/tests/share/examples/tests/googletest/sample1_unittest
 OLD_FILES+=usr/tests/share/examples/tests/googletest/sample10_unittest
+OLD_FILES+=usr/tests/share/examples/tests/googletest/sample1_unittest
 OLD_FILES+=usr/tests/share/examples/tests/googletest/sample2_unittest
 OLD_FILES+=usr/tests/share/examples/tests/googletest/sample3_unittest
 OLD_FILES+=usr/tests/share/examples/tests/googletest/sample4_unittest
@@ -2340,6 +2330,17 @@ OLD_FILES+=usr/tests/share/examples/tests/googletest/sample5_unittest
 OLD_FILES+=usr/tests/share/examples/tests/googletest/sample6_unittest
 OLD_FILES+=usr/tests/share/examples/tests/googletest/sample7_unittest
 OLD_FILES+=usr/tests/share/examples/tests/googletest/sample8_unittest
+OLD_DIRS+=usr/include/private/gmock/
+OLD_DIRS+=usr/include/private/gmock/internal
+OLD_DIRS+=usr/include/private/gmock/internal/custom
+OLD_DIRS+=usr/include/private/gtest/
+OLD_DIRS+=usr/include/private/gtest/internal
+OLD_DIRS+=usr/include/private/gtest/internal/custom
+OLD_DIRS+=usr/tests/lib/googletest
+OLD_DIRS+=usr/tests/lib/googletest/gmock
+OLD_DIRS+=usr/tests/lib/googletest/gmock_main
+OLD_DIRS+=usr/tests/lib/googletest/gtest
+OLD_DIRS+=usr/tests/lib/googletest/gtest_main
 OLD_DIRS+=usr/tests/share/examples/tests/googletest
 .endif