diff mbox series

[meta-oe] abseil-cpp: Backport a patch to build code that uses C++17 with GCC 15

Message ID 20250601205433.550936-1-pkj@axis.com
State Accepted
Headers show
Series [meta-oe] abseil-cpp: Backport a patch to build code that uses C++17 with GCC 15 | expand

Commit Message

Peter Kjellerstedt June 1, 2025, 8:54 p.m. UTC
GCC 15 seems to be confused about when the <version> header was
introduced (C++20) and expects it to be used with C++17.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 ...g-that-ciso646-is-deprecated-in-C-17.patch | 43 +++++++++++++++++++
 .../abseil-cpp/abseil-cpp_20250127.1.bb       |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0005-Fix-GCC15-warning-that-ciso646-is-deprecated-in-C-17.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0005-Fix-GCC15-warning-that-ciso646-is-deprecated-in-C-17.patch b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0005-Fix-GCC15-warning-that-ciso646-is-deprecated-in-C-17.patch
new file mode 100644
index 0000000000..7fe9ab4708
--- /dev/null
+++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0005-Fix-GCC15-warning-that-ciso646-is-deprecated-in-C-17.patch
@@ -0,0 +1,43 @@ 
+From aa102147cdfff3aa971e61038a6455bff6828350 Mon Sep 17 00:00:00 2001
+From: Derek Mauro <dmauro@google.com>
+Date: Tue, 29 Apr 2025 06:23:36 -0700
+Subject: [PATCH] Fix GCC15 warning that <ciso646> is deprecated in C++17
+
+PiperOrigin-RevId: 752709743
+Change-Id: I4d6b52bca913d888818e1380268089743b03ca2b
+Upstream-Status: Backport [https://github.com/abseil/abseil-cpp/commit/5f3435aba00bcd7f12062d2e8e1839b4eaf1a575]
+---
+ absl/hash/internal/hash.h | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h
+index f4a0d785..6937f413 100644
+--- a/absl/hash/internal/hash.h
++++ b/absl/hash/internal/hash.h
+@@ -26,13 +26,25 @@
+ 
+ #include "absl/base/config.h"
+ 
++// 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 defined(__has_include)
++#if __has_include(<version>)
++#define ABSL_INTERNAL_VERSION_HEADER_AVAILABLE 1
++#endif
++#endif
++
+ // For feature testing and determining which headers can be included.
+-#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
++#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L || \
++    ABSL_INTERNAL_VERSION_HEADER_AVAILABLE
+ #include <version>
+ #else
+ #include <ciso646>
+ #endif
+ 
++#undef ABSL_INTERNAL_VERSION_HEADER_AVAILABLE
++
+ #include <algorithm>
+ #include <array>
+ #include <bitset>
diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.1.bb b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.1.bb
index 5368dfaada..39c3b0b6db 100644
--- a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.1.bb
+++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.1.bb
@@ -14,6 +14,7 @@  SRC_URI = "git://github.com/abseil/abseil-cpp;branch=${BRANCH};protocol=https \
            file://0002-Remove-maes-option-from-cross-compilation.patch \
            file://0003-Remove-neon-option-from-cross-compilation.patch \
            file://0004-abseil-ppc-fixes.patch \
+           file://0005-Fix-GCC15-warning-that-ciso646-is-deprecated-in-C-17.patch \
            "
 
 S = "${WORKDIR}/git"