GTest: Fix compiler warning with GCC 15

`<ciso646>` is deprecated in C++17, and now GCC 15 has started to complain,
so include an upstream commit that fixes this.

Pull Request: https://projects.blender.org/blender/blender/pulls/139417
This commit is contained in:
Lukas Stockner
2025-06-26 02:03:34 +02:00
parent e460ae24cb
commit 7842b27326
3 changed files with 43 additions and 5 deletions

View File

@@ -3,4 +3,4 @@ URL: https://github.com/google/googletest
License: SPDX:BSD-3-Clause License: SPDX:BSD-3-Clause
Copyright: Copyright 2007, Google Inc. All rights reserved. Copyright: Copyright 2007, Google Inc. All rights reserved.
Upstream version: 1.15.2 (b514bdc898e2951020cbdca1304b75f5950d1f59) Upstream version: 1.15.2 (b514bdc898e2951020cbdca1304b75f5950d1f59)
Local modifications: None Local modifications: Apply patches/gcc15.patch

View File

@@ -288,10 +288,14 @@
// Detect C++ feature test macros as gracefully as possible. // 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. // 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>)) // GCC15 warns that <ciso646> is deprecated in C++17 and suggests using
#include <version> // C++20 and later // <version> instead, even though <version> is not available in C++17 mode prior
#elif (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<ciso646>)) // to GCC9.
#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L || \
GTEST_INTERNAL_HAS_INCLUDE(<version>)
#include <version> // C++20 or <version> support.
#else
#include <ciso646> // Pre-C++20 #include <ciso646> // Pre-C++20
#endif #endif

34
extern/gtest/patches/gcc15.patch vendored Normal file
View File

@@ -0,0 +1,34 @@
From 00b2154e8e4bbb1ab0b22580c9f19fbfd3f56c04 Mon Sep 17 00:00:00 2001
From: Derek Mauro <dmauro@google.com>
Date: Tue, 29 Apr 2025 06:12:50 -0700
Subject: [PATCH] Fix GCC15 warning that <ciso646> is deprecated in C++17
PiperOrigin-RevId: 752706554
Change-Id: I83d35b693efdaabcc63d15169dbf19d63163a563
---
googletest/include/gtest/internal/gtest-port.h | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 4cfc16c03e..25b7d194db 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -282,10 +282,14 @@
// 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>))
-#include <version> // C++20 and later
-#elif (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE(<ciso646>))
+//
+// GCC15 warns that <ciso646> is deprecated in C++17 and suggests using
+// <version> instead, even though <version> is not available in C++17 mode prior
+// to GCC9.
+#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L || \
+ GTEST_INTERNAL_HAS_INCLUDE(<version>)
+#include <version> // C++20 or <version> support.
+#else
#include <ciso646> // Pre-C++20
#endif