googletest: fix build with gcc-15
PATCH 1/1 googletest: fix build with gcc-15
From: Martin Jansa <[email protected]>
* some recipes which use googletest fail with:
gtest/src/gtest_main.cc:32: recipe-sysroot/usr/include/c++/15.0.1/ciso646:46:4: error: #warning "<ciso646> is deprecated in C++17, use <version> to detect implementation-specific macros" [-Werror=cpp]
46 | # warning "<ciso646> is deprecated in C++17, use <version> to detect implementation-specific macros"
| ^~~~~~~backport a fix for this.
* see https://github.com/google/googletest/issues/4701
Signed-off-by Martin Jansa <[email protected]>
--- .../googletest/googletest/gtest-ciso646.patch | 26 +++++++++++++++++++ .../googletest/googletest_1.16.0.bb | 4 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-test/googletest/googletest/gtest-ciso646.patch
meta-oe/recipes-test/googletest/googletest/gtest-ciso646.patch new file +26 -0
@@ -0,0 +1,26 @@ +https://github.com/google/googletest/issues/4701 + +taken from fedora: +https://src.fedoraproject.org/rpms/gtest/c/b3fe6f803a1e554971f70e1c3f55aa5fcb377b1b?branch=rawhide + +Upstream-Status: Pending +Signed-off-by: Martin Jansa <[email protected]> + +--- ./googletest/include/gtest/internal/gtest-port.h.orig 2025-01-27 03:39:18.963893931 +0000 ++++ ./googletest/include/gtest/internal/gtest-port.h 2025-01-28 13:57:51.381081952 +0000 +@@ -288,11 +288,11 @@ + + // Detect C++ feature test macros as gracefully as possible. + // MSVC >= 19.15, Clang >= 3.4.1, and GCC >= 4.1.2 support feature test macros. +-#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L && \ +- (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<version>)) ++#if GTEST_INTERNAL_HAS_INCLUDE(<version>) || \ ++ (GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L && !defined(__has_include)) + #include <version> // C++20 and later +-#elif (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<ciso646>)) +-#include <ciso646> // Pre-C++20 ++#else ++#include <cerrno> // Pre-C++20 + #endif + + #include <ctype.h> // for isspace, etc
meta-oe/recipes-test/googletest/googletest_1.16.0.bb +3 -1
@@ -8,7 +8,9 @@ PROVIDES += "gmock gtest" S = "${WORKDIR}/git" SRCREV = "6910c9d9165801d8827d628cb72eb7ea9dd538c5" -SRC_URI = "git://github.com/google/googletest.git;branch=v1.16.x;protocol=https" +SRC_URI = "git://github.com/google/googletest.git;branch=v1.16.x;protocol=https \ + file://gtest-ciso646.patch \ +" inherit cmake pkgconfig