[staging-next] libofx: fix build with gcc 16 (#566314)

This commit is contained in:
Martin Weinelt
2026-09-26 21:20:20 +00:00
committed by GitHub
2 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
From e326ba971fd40687d5e66fb2949e0d2f53e6d8fd Mon Sep 17 00:00:00 2001
From: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Sat, 22 Aug 2026 15:46:10 +0200
Subject: [PATCH] Use C++20 allocate()
https://github.com/libofx/libofx/issues/105
---
lib/tree.hh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/tree.hh b/lib/tree.hh
index 3b42b28f..6bc62aa9 100644
--- a/lib/tree.hh
+++ b/lib/tree.hh
@@ -467,8 +467,8 @@ tree<T, tree_node_allocator>::~tree()
template <class T, class tree_node_allocator>
void tree<T, tree_node_allocator>::head_initialise_()
{
- head = alloc_.allocate(1, 0); // MSVC does not have default second argument
- feet = alloc_.allocate(1, 0);
+ head = alloc_.allocate(1);
+ feet = alloc_.allocate(1);
head->parent = 0;
head->first_child = 0;
@@ -743,7 +743,7 @@ iter tree<T, tree_node_allocator>::append_child(iter position)
{
assert(position.node != head);
- tree_node* tmp = alloc_.allocate(1, 0);
+ tree_node* tmp = alloc_.allocate(1);
kp::constructor(&tmp->data);
tmp->first_child = 0;
tmp->last_child = 0;
@@ -773,7 +773,7 @@ iter tree<T, tree_node_allocator>::append_child(iter position, const T& x)
// the API change.
assert(position.node != head);
- tree_node* tmp = alloc_.allocate(1, 0);
+ tree_node* tmp = alloc_.allocate(1);
kp::constructor(&tmp->data, x);
tmp->first_child = 0;
tmp->last_child = 0;
@@ -833,7 +833,7 @@ iter tree<T, tree_node_allocator>::insert(iter position, const T& x)
position.node = feet; // Backward compatibility: when calling insert on a null node,
// insert before the feet.
}
- tree_node* tmp = alloc_.allocate(1, 0);
+ tree_node* tmp = alloc_.allocate(1);
kp::constructor(&tmp->data, x);
tmp->first_child = 0;
tmp->last_child = 0;
@@ -856,7 +856,7 @@ iter tree<T, tree_node_allocator>::insert(iter position, const T& x)
template <class T, class tree_node_allocator>
typename tree<T, tree_node_allocator>::sibling_iterator tree<T, tree_node_allocator>::insert(sibling_iterator position, const T& x)
{
- tree_node* tmp = alloc_.allocate(1, 0);
+ tree_node* tmp = alloc_.allocate(1);
kp::constructor(&tmp->data, x);
tmp->first_child = 0;
tmp->last_child = 0;
@@ -889,7 +889,7 @@ template <class T, class tree_node_allocator>
template <class iter>
iter tree<T, tree_node_allocator>::insert_after(iter position, const T& x)
{
- tree_node* tmp = alloc_.allocate(1, 0);
+ tree_node* tmp = alloc_.allocate(1);
kp::constructor(&tmp->data, x);
tmp->first_child = 0;
tmp->last_child = 0;
@@ -951,7 +951,7 @@ iter tree<T, tree_node_allocator>::replace(iter position, const iterator_base& f
// replace the node at position with head of the replacement tree at from
erase_children(position);
- tree_node* tmp = alloc_.allocate(1, 0);
+ tree_node* tmp = alloc_.allocate(1);
kp::constructor(&tmp->data, (*from));
tmp->first_child = 0;
tmp->last_child = 0;

View File

@@ -24,6 +24,12 @@ stdenv.mkDerivation (finalAttrs: {
sha256 = "sha256-KOQrEAt1jHrOpPQ7QbGUADe0i7sQXNH2fblPRzT0EIg=";
};
# C++20 changes the signature of std::allocator::allocate. Vendored patch
# from the approved PR to fix this.
# https://github.com/libofx/libofx/issues/105
# https://github.com/libofx/libofx/pull/106
patches = [ ./c++20-allocate.patch ];
preConfigure = "./autogen.sh";
configureFlags = [ "--with-opensp-includes=${opensp}/include/OpenSP" ];
nativeBuildInputs = [