fix build: Disable array-bounds warnings in btree

This commit is contained in:
John Colvin committed 2022-10-03 15:48:45 -04:00
1 parent 296cb8532b
commit 3aec53cfbd
1 file changed
+20 -2
+20 -2
View File
@@ -560,10 +560,25 @@ class btree_node {
}
// Getters/setter for the child at position i in the node.
btree_node* child(int i) const { return fields_.children[i]; }
btree_node** mutable_child(int i) { return &fields_.children[i]; }
btree_node* child(int i) const {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
return fields_.children[i];
#pragma GCC diagnostic pop
}
btree_node** mutable_child(int i) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
return &fields_.children[i];
#pragma GCC diagnostic pop
}
void set_child(int i, btree_node *c) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
*mutable_child(i) = c;
#pragma GCC diagnostic pop
c->fields_.parent = this;
c->fields_.position = static_cast<typename Params::node_count_type>(i);
}
@@ -2059,7 +2074,10 @@ void btree<P>::rebalance_or_split(iterator *iter) {
// and a pointer to the rightmost node. So we create a new internal node
// and move all of the items on the current root into the new node.
parent = new_internal_node(parent);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
parent->set_child(0, parent);
#pragma GCC diagnostic pop
parent->swap(root());
node = parent;
}