Compare commits

...

10 Commits

Author SHA1 Message Date
joaquintides 11e05a3c4c updated package-lock.json (#328) 2025-10-21 20:47:01 +02:00
joaquintides e9ca2a2def added /doc/html/unordered.html redirect (#327)
* added /doc/html/unordered.html redirect
* added trailing newline
2025-10-20 09:04:57 +02:00
joaquintides 9c8da06481 raised Antora version requirements (#326) 2025-10-19 17:02:32 +02:00
Peter Dimov e01b7b52a6 BOOST_TEST_THROWS requires a semicolon after https://github.com/boostorg/core/pull/205 2025-10-18 17:53:23 +03:00
Sam Darwin 4ec5cb59cd Drone: llvm apt installation (#323) 2025-10-15 09:40:04 +02:00
joaquintides 09d6416755 made boost::unordered_[multi](map|set)::[const_][local_]iterator instantiable with incomplete value_type (#321)
* made boost::unordered_[multi](map|set)::[const_][local_]iterator instantiable with incomplete value_type
* qualified name to avoid self-definition
2025-10-12 13:14:16 +02:00
joaquintides 4b76ac84ec removed ccache for macos-13 (#320) 2025-10-11 17:49:06 +02:00
Alexander Grund dcc485bcb5 Update Link to regression test matrix in README (#316)
* Update Link to regression test matrix in README

* Use boost.org instead of boost.io
2025-09-19 09:07:03 +02:00
joaquintides cc9a787f14 microoptimized unchecked_countr_zero for GCC/Clang 2025-08-26 17:08:01 +02:00
Braden Ganetsky 6fd63ab727 Fix pretty-printers not working when constexpr variables are optimized away (#315)
* Move unordered_printers.hpp into 'detail', where it should have been from the beginning

This is not a public header. It is only meant to be consumed as a transitive include.

* Store self.table instead of self.val

* Fix pretty-printers not working when constexpr variables are optimized away

Also do a few other things.
* `groups` and `elements` are now stored inside `self`
* `mask`, `n0`, and `n` aren't declared ahead of their first assignment
* Remove trailing whitespace

* Update the generated pretty-printer header
2025-08-22 10:15:49 +02:00
15 changed files with 2172 additions and 1667 deletions
+4 -1
View File
@@ -34,8 +34,9 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
commands:
[
'set -e',
'echo $DRONE_STAGE_MACHINE',
'uname -a',
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
'curl -sSL --retry 5 https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm-snapshot.gpg',
] +
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
(if packages != "" then [ 'apt-get update', 'apt-get -y install ' + packages ] else []) +
@@ -66,6 +67,8 @@ local macos_pipeline(name, environment, xcode_version = "12.2", osx_version = "c
environment: environment + { "DEVELOPER_DIR": "/Applications/Xcode-" + xcode_version + ".app/Contents/Developer" },
commands:
[
'echo $DRONE_STAGE_MACHINE',
'sw_vers',
'uname -a',
'export LIBRARY=' + library,
'./.drone/drone.sh',
+2 -2
View File
@@ -117,8 +117,8 @@ jobs:
stdlib: libc++, install: 'clang-18 libc++-18-dev libc++abi-18-dev', ccache_key: "tsan" }
# OSX, clang
- { compiler: clang, cxxstd: '11,14,17,20,2b', os: 'macos-13', sanitize: yes, ccache_key: "san1" }
- { compiler: clang, cxxstd: '11,14,17,20,2b', os: 'macos-13', thread-sanitize: yes, targets: 'libs/unordered/test//cfoa_tests', ccache_key: "tsan" }
- { compiler: clang, cxxstd: '11,14,17,20,2b', os: 'macos-13', sanitize: yes, ccache: no, ccache_key: "san1" }
- { compiler: clang, cxxstd: '11,14,17,20,2b', os: 'macos-13', thread-sanitize: yes, targets: 'libs/unordered/test//cfoa_tests', ccache: no, ccache_key: "tsan" }
- { compiler: clang, cxxstd: '11,14,17,20,2b', os: 'macos-14' }
- { compiler: clang, cxxstd: '11,14,17,20,2b', os: 'macos-15' }
+2 -2
View File
@@ -1,7 +1,7 @@
# Boost.Unordered
[![Branch](https://img.shields.io/badge/branch-master-brightgreen.svg)](https://github.com/boostorg/unordered/tree/master) [![CI](https://github.com/boostorg/unordered/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/unordered/actions/workflows/ci.yml) [![Drone status](https://img.shields.io/drone/build/boostorg/unordered/master?server=https%3A%2F%2Fdrone.cpp.al&logo=drone&logoColor=%23CCCCCC&label=CI)](https://drone.cpp.al/boostorg/unordered) [![Build status](https://img.shields.io/appveyor/build/cppalliance/unordered/master?logo=appveyor&label=CI)](https://ci.appveyor.com/project/cppalliance/unordered/branch/master) [![codecov](https://codecov.io/gh/boostorg/unordered/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/unordered/branch/master) [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/unordered.html) [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/unordered/index.html) [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/unordered.html)<br/>
[![Branch](https://img.shields.io/badge/branch-develop-brightgreen.svg)](https://github.com/boostorg/unordered/tree/develop) [![CI](https://github.com/boostorg/unordered/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/unordered/actions/workflows/ci.yml) [![Drone status](https://img.shields.io/drone/build/boostorg/unordered/develop?server=https%3A%2F%2Fdrone.cpp.al&logo=drone&logoColor=%23CCCCCC&label=CI)](https://drone.cpp.al/boostorg/unordered) [![Build status](https://img.shields.io/appveyor/build/cppalliance/unordered/develop?logo=appveyor&label=CI)](https://ci.appveyor.com/project/cppalliance/unordered/branch/develop) [![codecov](https://codecov.io/gh/boostorg/unordered/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/unordered/branch/develop) [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/unordered.html) [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/unordered/index.html) [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/unordered.html)<br/>
[![Branch](https://img.shields.io/badge/branch-master-brightgreen.svg)](https://github.com/boostorg/unordered/tree/master) [![CI](https://github.com/boostorg/unordered/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/unordered/actions/workflows/ci.yml) [![Drone status](https://img.shields.io/drone/build/boostorg/unordered/master?server=https%3A%2F%2Fdrone.cpp.al&logo=drone&logoColor=%23CCCCCC&label=CI)](https://drone.cpp.al/boostorg/unordered) [![Build status](https://img.shields.io/appveyor/build/cppalliance/unordered/master?logo=appveyor&label=CI)](https://ci.appveyor.com/project/cppalliance/unordered/branch/master) [![codecov](https://codecov.io/gh/boostorg/unordered/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/unordered/branch/master) [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/unordered.html) [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/unordered/index.html) [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://regression.boost.org/master/developer/unordered.html)<br/>
[![Branch](https://img.shields.io/badge/branch-develop-brightgreen.svg)](https://github.com/boostorg/unordered/tree/develop) [![CI](https://github.com/boostorg/unordered/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/unordered/actions/workflows/ci.yml) [![Drone status](https://img.shields.io/drone/build/boostorg/unordered/develop?server=https%3A%2F%2Fdrone.cpp.al&logo=drone&logoColor=%23CCCCCC&label=CI)](https://drone.cpp.al/boostorg/unordered) [![Build status](https://img.shields.io/appveyor/build/cppalliance/unordered/develop?logo=appveyor&label=CI)](https://ci.appveyor.com/project/cppalliance/unordered/branch/develop) [![codecov](https://codecov.io/gh/boostorg/unordered/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/unordered/branch/develop) [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/unordered.html) [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/unordered/index.html) [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://regression.boost.org/develop/developer/unordered.html)<br/>
[![BSL 1.0](https://img.shields.io/badge/license-BSL_1.0-blue.svg)](https://www.boost.org/users/license.html) <img alt="C++11 required" src="https://img.shields.io/badge/standard-C%2b%2b11-blue.svg"> <img alt="Header-only library" src="https://img.shields.io/badge/build-header--only-blue.svg">
Boost.Unordered offers a catalog of hash containers with different standards compliance levels, performances and intented usage scenarios:
+1
View File
@@ -7,3 +7,4 @@ cd "$SCRIPT_DIR"
npm ci
npx antora unordered-playbook.yml
cp -f html/index.html html/unordered.html
+1920 -1541
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,7 +1,7 @@
{
"devDependencies": {
"@antora/cli": "3.1.10",
"@antora/site-generator": "3.1.10",
"antora": "3.1.10"
"@antora/cli": ">=3.1.14",
"@antora/site-generator": ">=3.1.14",
"antora": ">=3.1.14"
}
}
+40 -42
View File
@@ -1,4 +1,4 @@
# Copyright 2024 Braden Ganetsky
# Copyright 2024-2025 Braden Ganetsky
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
@@ -14,7 +14,7 @@ class BoostUnorderedHelpers:
return n.cast(underlying_type)
else:
return n
def maybe_unwrap_foa_element(e):
if f"{e.type.strip_typedefs()}".startswith("boost::unordered::detail::foa::element_type<"):
return e["p"]
@@ -45,14 +45,15 @@ class BoostUnorderedPointerCustomizationPoint:
class BoostUnorderedFcaPrinter:
def __init__(self, val):
self.val = BoostUnorderedHelpers.maybe_unwrap_reference(val)
self.name = f"{self.val.type.strip_typedefs()}".split("<")[0]
val = BoostUnorderedHelpers.maybe_unwrap_reference(val)
self.table = val["table_"]
self.name = f"{val.type.strip_typedefs()}".split("<")[0]
self.name = self.name.replace("boost::unordered::", "boost::")
self.is_map = self.name.endswith("map")
self.cpo = BoostUnorderedPointerCustomizationPoint(self.val["table_"]["buckets_"]["buckets"])
self.cpo = BoostUnorderedPointerCustomizationPoint(self.table["buckets_"]["buckets"])
def to_string(self):
size = self.val["table_"]["size_"]
size = self.table["size_"]
return f"{self.name} with {size} elements"
def display_hint(self):
@@ -60,7 +61,7 @@ class BoostUnorderedFcaPrinter:
def children(self):
def generator():
grouped_buckets = self.val["table_"]["buckets_"]
grouped_buckets = self.table["buckets_"]
size = grouped_buckets["size_"]
buckets = grouped_buckets["buckets"]
@@ -83,7 +84,7 @@ class BoostUnorderedFcaPrinter:
count += 1
node = self.cpo.to_address(node.dereference()["next"])
bucket_index += 1
return generator()
class BoostUnorderedFcaIteratorPrinter:
@@ -118,7 +119,7 @@ class BoostUnorderedFoaTableCoreCumulativeStatsPrinter:
yield "", member
yield "", self.val[member]
return generator()
class BoostUnorderedFoaCumulativeStatsPrinter:
def __init__(self, val):
self.val = val
@@ -127,7 +128,7 @@ class BoostUnorderedFoaCumulativeStatsPrinter:
def display_hint(self):
return "map"
def children(self):
def generator():
yield "", "count"
@@ -154,14 +155,20 @@ class BoostUnorderedFoaCumulativeStatsPrinter:
class BoostUnorderedFoaPrinter:
def __init__(self, val):
self.val = BoostUnorderedHelpers.maybe_unwrap_reference(val)
self.name = f"{self.val.type.strip_typedefs()}".split("<")[0]
val = BoostUnorderedHelpers.maybe_unwrap_reference(val)
self.table = val["table_"]
self.name = f"{val.type.strip_typedefs()}".split("<")[0]
self.name = self.name.replace("boost::unordered::", "boost::")
self.is_map = self.name.endswith("map")
self.cpo = BoostUnorderedPointerCustomizationPoint(self.val["table_"]["arrays"]["groups_"])
self.cpo = BoostUnorderedPointerCustomizationPoint(self.table["arrays"]["groups_"])
self.groups = self.cpo.to_address(self.table["arrays"]["groups_"])
self.elements = self.cpo.to_address(self.table["arrays"]["elements_"])
self.N = 15 # `self.groups.dereference()["N"]` may be optimized out
self.sentinel_ = 1 # `self.groups.dereference()["sentinel_"]` may be optimized out
def to_string(self):
size = BoostUnorderedHelpers.maybe_unwrap_atomic(self.val["table_"]["size_ctrl"]["size"])
size = BoostUnorderedHelpers.maybe_unwrap_atomic(self.table["size_ctrl"]["size"])
return f"{self.name} with {size} elements"
def display_hint(self):
@@ -191,30 +198,21 @@ class BoostUnorderedFoaPrinter:
m = group["m"]
at = lambda b: BoostUnorderedHelpers.maybe_unwrap_atomic(m[b]["n"])
N = group["N"]
sentinel_ = group["sentinel_"]
if self.is_regular_layout(group):
return pos == N-1 and at(N-1) == sentinel_
return pos == self.N-1 and at(self.N-1) == self.sentinel_
else:
return pos == N-1 and (at(0) & 0x4000400040004000) == 0x4000 and (at(1) & 0x4000400040004000) == 0
return pos == self.N-1 and (at(0) & 0x4000400040004000) == 0x4000 and (at(1) & 0x4000400040004000) == 0
def children(self):
def generator():
table = self.val["table_"]
groups = self.cpo.to_address(table["arrays"]["groups_"])
elements = self.cpo.to_address(table["arrays"]["elements_"])
pc_ = groups.cast(gdb.lookup_type("unsigned char").pointer())
p_ = elements
pc_ = self.groups.cast(gdb.lookup_type("unsigned char").pointer())
p_ = self.elements
first_time = True
mask = 0
n0 = 0
n = 0
count = 0
while p_ != 0:
# This if block mirrors the condition in the begin() call
if (not first_time) or (self.match_occupied(groups.dereference()) & 1):
if (not first_time) or (self.match_occupied(self.groups.dereference()) & 1):
pointer = BoostUnorderedHelpers.maybe_unwrap_foa_element(p_)
value = self.cpo.to_address(pointer).dereference()
if self.is_map:
@@ -228,17 +226,17 @@ class BoostUnorderedFoaPrinter:
count += 1
first_time = False
n0 = pc_.cast(gdb.lookup_type("uintptr_t")) % groups.dereference().type.sizeof
n0 = pc_.cast(gdb.lookup_type("uintptr_t")) % self.groups.dereference().type.sizeof
pc_ = self.cpo.next(pc_, -n0)
mask = (self.match_occupied(pc_.cast(groups.type).dereference()) >> (n0+1)) << (n0+1)
mask = (self.match_occupied(pc_.cast(self.groups.type).dereference()) >> (n0+1)) << (n0+1)
while mask == 0:
pc_ = self.cpo.next(pc_, groups.dereference().type.sizeof)
p_ = self.cpo.next(p_, groups.dereference()["N"])
mask = self.match_occupied(pc_.cast(groups.type).dereference())
pc_ = self.cpo.next(pc_, self.groups.dereference().type.sizeof)
p_ = self.cpo.next(p_, self.N)
mask = self.match_occupied(pc_.cast(self.groups.type).dereference())
n = BoostUnorderedHelpers.countr_zero(mask)
if self.is_sentinel(pc_.cast(groups.type).dereference(), n):
if self.is_sentinel(pc_.cast(self.groups.type).dereference(), n):
p_ = 0
else:
pc_ = self.cpo.next(pc_, n)
@@ -284,7 +282,7 @@ def boost_unordered_build_pretty_printer():
add_template_printer("boost::unordered::concurrent_flat_set", BoostUnorderedFoaPrinter)
add_template_printer("boost::unordered::concurrent_node_map", BoostUnorderedFoaPrinter)
add_template_printer("boost::unordered::concurrent_node_set", BoostUnorderedFoaPrinter)
add_template_printer("boost::unordered::detail::foa::table_iterator", BoostUnorderedFoaIteratorPrinter)
add_concrete_printer("boost::unordered::detail::foa::table_core_cumulative_stats", BoostUnorderedFoaTableCoreCumulativeStatsPrinter)
@@ -301,7 +299,7 @@ gdb.printing.register_pretty_printer(gdb.current_objfile(), boost_unordered_buil
class BoostUnorderedFoaGetStatsMethod(gdb.xmethod.XMethod):
def __init__(self):
gdb.xmethod.XMethod.__init__(self, "get_stats")
def get_worker(self, method_name):
if method_name == "get_stats":
return BoostUnorderedFoaGetStatsWorker()
@@ -312,19 +310,19 @@ class BoostUnorderedFoaGetStatsWorker(gdb.xmethod.XMethodWorker):
def get_result_type(self, obj):
return gdb.lookup_type("boost::unordered::detail::foa::table_core_cumulative_stats")
def __call__(self, obj):
try:
return obj["table_"]["cstats"]
except gdb.error:
print("Error: Binary was compiled without stats. Recompile with `BOOST_UNORDERED_ENABLE_STATS` defined.")
return
class BoostUnorderedFoaMatcher(gdb.xmethod.XMethodMatcher):
def __init__(self):
gdb.xmethod.XMethodMatcher.__init__(self, 'BoostUnorderedFoaMatcher')
self.methods = [BoostUnorderedFoaGetStatsMethod()]
def match(self, class_type, method_name):
template_name = f"{class_type.strip_typedefs()}".split("<")[0]
regex = "^boost::unordered::(unordered|concurrent)_(flat|node)_(map|set)$"
@@ -380,12 +378,12 @@ class MyFancyPtrPrinter:
def boost_to_address(fancy_ptr):
...
return ...
# Equivalent to `operator+()`
def boost_next(raw_ptr, offset):
...
return ...
...
```
"""
+34 -8
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2024 Joaquin M Lopez Munoz.
// Copyright (C) 2022-2025 Joaquin M Lopez Munoz.
// Copyright (C) 2022 Christian Mazakas
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -134,11 +134,37 @@ namespace boost {
namespace unordered {
namespace detail {
template <class ValueType, class VoidPtr> struct node;
// access to node::value_type and node::pointer for incomplete node
template<class Node> struct node_value_type_impl;
template <class ValueType, class VoidPtr>
struct node_value_type_impl<node<ValueType, VoidPtr>>
{
typedef ValueType type;
};
template<class Node> using node_value_type =
typename node_value_type_impl<Node>::type;
template<class Node> struct node_pointer_impl;
template <class ValueType, class VoidPtr>
struct node_pointer_impl<node<ValueType, VoidPtr>>
{
typedef typename boost::pointer_traits<VoidPtr>::template rebind_to<
node<ValueType, VoidPtr>>::type type;
};
template<class Node> using node_pointer =
typename node_pointer_impl<Node>::type;
template <class ValueType, class VoidPtr> struct node
{
typedef ValueType value_type;
typedef typename boost::pointer_traits<VoidPtr>::template rebind_to<
node>::type node_pointer;
typedef node_value_type<node> value_type;
typedef detail::node_pointer<node> node_pointer;
node_pointer next;
opt_storage<value_type> buf;
@@ -304,10 +330,10 @@ namespace boost {
template <class Node> struct grouped_local_bucket_iterator
{
typedef typename Node::node_pointer node_pointer;
typedef detail::node_pointer<Node> node_pointer;
public:
typedef typename Node::value_type value_type;
typedef detail::node_value_type<Node> value_type;
typedef value_type element_type;
typedef value_type* pointer;
typedef value_type& reference;
@@ -370,10 +396,10 @@ namespace boost {
template <class Node> struct const_grouped_local_bucket_iterator
{
typedef typename Node::node_pointer node_pointer;
typedef detail::node_pointer<Node> node_pointer;
public:
typedef typename Node::value_type const value_type;
typedef detail::node_value_type<Node> const value_type;
typedef value_type const element_type;
typedef value_type const* pointer;
typedef value_type const& reference;
+3 -1
View File
@@ -29,7 +29,7 @@
#include <boost/unordered/detail/mulx.hpp>
#include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/unordered/unordered_printers.hpp>
#include <boost/unordered/detail/unordered_printers.hpp>
#include <climits>
#include <cmath>
#include <cstddef>
@@ -923,6 +923,8 @@ inline unsigned int unchecked_countr_zero(int x)
unsigned long r;
_BitScanForward(&r,(unsigned long)x);
return (unsigned int)r;
#elif defined(BOOST_GCC)||defined(BOOST_CLANG)
return (unsigned int)__builtin_ctz((unsigned int)x);
#else
BOOST_UNORDERED_ASSUME(x!=0);
return (unsigned int)boost::core::countr_zero((unsigned int)x);
@@ -21,7 +21,7 @@
#include <boost/unordered/detail/serialize_tracked_address.hpp>
#include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/unordered/unordered_printers.hpp>
#include <boost/unordered/detail/unordered_printers.hpp>
#include <boost/assert.hpp>
#include <boost/core/allocator_traits.hpp>
@@ -969,7 +969,7 @@ namespace boost {
template <class Node, class Bucket> class iterator
{
public:
typedef typename Node::value_type value_type;
typedef typename detail::node_value_type<Node> value_type;
typedef value_type element_type;
typedef value_type* pointer;
typedef value_type& reference;
@@ -1023,7 +1023,7 @@ namespace boost {
}
private:
typedef typename Node::node_pointer node_pointer;
typedef detail::node_pointer<Node> node_pointer;
typedef grouped_bucket_iterator<Bucket> bucket_iterator;
node_pointer p;
@@ -1076,7 +1076,7 @@ namespace boost {
template <class Node, class Bucket> class c_iterator
{
public:
typedef typename Node::value_type value_type;
typedef typename detail::node_value_type<Node> value_type;
typedef value_type const element_type;
typedef value_type const* pointer;
typedef value_type const& reference;
@@ -1131,7 +1131,7 @@ namespace boost {
}
private:
typedef typename Node::node_pointer node_pointer;
typedef detail::node_pointer<Node> node_pointer;
typedef grouped_bucket_iterator<Bucket> bucket_iterator;
node_pointer p;
@@ -1,11 +1,11 @@
// Copyright 2024 Braden Ganetsky
// Copyright 2024-2025 Braden Ganetsky
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// Generated on 2024-08-25T17:48:54
// Generated on 2025-08-21T03:09:19
#ifndef BOOST_UNORDERED_UNORDERED_PRINTERS_HPP
#define BOOST_UNORDERED_UNORDERED_PRINTERS_HPP
#ifndef BOOST_UNORDERED_DETAIL_UNORDERED_PRINTERS_HPP
#define BOOST_UNORDERED_DETAIL_UNORDERED_PRINTERS_HPP
#ifndef BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS
#if defined(__ELF__)
@@ -14,7 +14,7 @@
#pragma clang diagnostic ignored "-Woverlength-strings"
#endif
__asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
".ascii \"\\4gdb.inlined-script.BOOST_UNORDERED_UNORDERED_PRINTERS_HPP\\n\"\n"
".ascii \"\\4gdb.inlined-script.BOOST_UNORDERED_DETAIL_UNORDERED_PRINTERS_HPP\\n\"\n"
".ascii \"import gdb.printing\\n\"\n"
".ascii \"import gdb.xmethod\\n\"\n"
".ascii \"import re\\n\"\n"
@@ -58,14 +58,15 @@ __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
".ascii \"class BoostUnorderedFcaPrinter:\\n\"\n"
".ascii \" def __init__(self, val):\\n\"\n"
".ascii \" self.val = BoostUnorderedHelpers.maybe_unwrap_reference(val)\\n\"\n"
".ascii \" self.name = f\\\"{self.val.type.strip_typedefs()}\\\".split(\\\"<\\\")[0]\\n\"\n"
".ascii \" val = BoostUnorderedHelpers.maybe_unwrap_reference(val)\\n\"\n"
".ascii \" self.table = val[\\\"table_\\\"]\\n\"\n"
".ascii \" self.name = f\\\"{val.type.strip_typedefs()}\\\".split(\\\"<\\\")[0]\\n\"\n"
".ascii \" self.name = self.name.replace(\\\"boost::unordered::\\\", \\\"boost::\\\")\\n\"\n"
".ascii \" self.is_map = self.name.endswith(\\\"map\\\")\\n\"\n"
".ascii \" self.cpo = BoostUnorderedPointerCustomizationPoint(self.val[\\\"table_\\\"][\\\"buckets_\\\"][\\\"buckets\\\"])\\n\"\n"
".ascii \" self.cpo = BoostUnorderedPointerCustomizationPoint(self.table[\\\"buckets_\\\"][\\\"buckets\\\"])\\n\"\n"
".ascii \" def to_string(self):\\n\"\n"
".ascii \" size = self.val[\\\"table_\\\"][\\\"size_\\\"]\\n\"\n"
".ascii \" size = self.table[\\\"size_\\\"]\\n\"\n"
".ascii \" return f\\\"{self.name} with {size} elements\\\"\\n\"\n"
".ascii \" def display_hint(self):\\n\"\n"
@@ -73,7 +74,7 @@ __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
".ascii \" def children(self):\\n\"\n"
".ascii \" def generator():\\n\"\n"
".ascii \" grouped_buckets = self.val[\\\"table_\\\"][\\\"buckets_\\\"]\\n\"\n"
".ascii \" grouped_buckets = self.table[\\\"buckets_\\\"]\\n\"\n"
".ascii \" size = grouped_buckets[\\\"size_\\\"]\\n\"\n"
".ascii \" buckets = grouped_buckets[\\\"buckets\\\"]\\n\"\n"
@@ -167,14 +168,20 @@ __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
".ascii \"class BoostUnorderedFoaPrinter:\\n\"\n"
".ascii \" def __init__(self, val):\\n\"\n"
".ascii \" self.val = BoostUnorderedHelpers.maybe_unwrap_reference(val)\\n\"\n"
".ascii \" self.name = f\\\"{self.val.type.strip_typedefs()}\\\".split(\\\"<\\\")[0]\\n\"\n"
".ascii \" val = BoostUnorderedHelpers.maybe_unwrap_reference(val)\\n\"\n"
".ascii \" self.table = val[\\\"table_\\\"]\\n\"\n"
".ascii \" self.name = f\\\"{val.type.strip_typedefs()}\\\".split(\\\"<\\\")[0]\\n\"\n"
".ascii \" self.name = self.name.replace(\\\"boost::unordered::\\\", \\\"boost::\\\")\\n\"\n"
".ascii \" self.is_map = self.name.endswith(\\\"map\\\")\\n\"\n"
".ascii \" self.cpo = BoostUnorderedPointerCustomizationPoint(self.val[\\\"table_\\\"][\\\"arrays\\\"][\\\"groups_\\\"])\\n\"\n"
".ascii \" self.cpo = BoostUnorderedPointerCustomizationPoint(self.table[\\\"arrays\\\"][\\\"groups_\\\"])\\n\"\n"
".ascii \" self.groups = self.cpo.to_address(self.table[\\\"arrays\\\"][\\\"groups_\\\"])\\n\"\n"
".ascii \" self.elements = self.cpo.to_address(self.table[\\\"arrays\\\"][\\\"elements_\\\"])\\n\"\n"
".ascii \" self.N = 15 # `self.groups.dereference()[\\\"N\\\"]` may be optimized out\\n\"\n"
".ascii \" self.sentinel_ = 1 # `self.groups.dereference()[\\\"sentinel_\\\"]` may be optimized out\\n\"\n"
".ascii \" def to_string(self):\\n\"\n"
".ascii \" size = BoostUnorderedHelpers.maybe_unwrap_atomic(self.val[\\\"table_\\\"][\\\"size_ctrl\\\"][\\\"size\\\"])\\n\"\n"
".ascii \" size = BoostUnorderedHelpers.maybe_unwrap_atomic(self.table[\\\"size_ctrl\\\"][\\\"size\\\"])\\n\"\n"
".ascii \" return f\\\"{self.name} with {size} elements\\\"\\n\"\n"
".ascii \" def display_hint(self):\\n\"\n"
@@ -204,30 +211,21 @@ __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
".ascii \" m = group[\\\"m\\\"]\\n\"\n"
".ascii \" at = lambda b: BoostUnorderedHelpers.maybe_unwrap_atomic(m[b][\\\"n\\\"])\\n\"\n"
".ascii \" N = group[\\\"N\\\"]\\n\"\n"
".ascii \" sentinel_ = group[\\\"sentinel_\\\"]\\n\"\n"
".ascii \" if self.is_regular_layout(group):\\n\"\n"
".ascii \" return pos == N-1 and at(N-1) == sentinel_\\n\"\n"
".ascii \" return pos == self.N-1 and at(self.N-1) == self.sentinel_\\n\"\n"
".ascii \" else:\\n\"\n"
".ascii \" return pos == N-1 and (at(0) & 0x4000400040004000) == 0x4000 and (at(1) & 0x4000400040004000) == 0\\n\"\n"
".ascii \" return pos == self.N-1 and (at(0) & 0x4000400040004000) == 0x4000 and (at(1) & 0x4000400040004000) == 0\\n\"\n"
".ascii \" def children(self):\\n\"\n"
".ascii \" def generator():\\n\"\n"
".ascii \" table = self.val[\\\"table_\\\"]\\n\"\n"
".ascii \" groups = self.cpo.to_address(table[\\\"arrays\\\"][\\\"groups_\\\"])\\n\"\n"
".ascii \" elements = self.cpo.to_address(table[\\\"arrays\\\"][\\\"elements_\\\"])\\n\"\n"
".ascii \" pc_ = groups.cast(gdb.lookup_type(\\\"unsigned char\\\").pointer())\\n\"\n"
".ascii \" p_ = elements\\n\"\n"
".ascii \" pc_ = self.groups.cast(gdb.lookup_type(\\\"unsigned char\\\").pointer())\\n\"\n"
".ascii \" p_ = self.elements\\n\"\n"
".ascii \" first_time = True\\n\"\n"
".ascii \" mask = 0\\n\"\n"
".ascii \" n0 = 0\\n\"\n"
".ascii \" n = 0\\n\"\n"
".ascii \" count = 0\\n\"\n"
".ascii \" while p_ != 0:\\n\"\n"
".ascii \" # This if block mirrors the condition in the begin() call\\n\"\n"
".ascii \" if (not first_time) or (self.match_occupied(groups.dereference()) & 1):\\n\"\n"
".ascii \" if (not first_time) or (self.match_occupied(self.groups.dereference()) & 1):\\n\"\n"
".ascii \" pointer = BoostUnorderedHelpers.maybe_unwrap_foa_element(p_)\\n\"\n"
".ascii \" value = self.cpo.to_address(pointer).dereference()\\n\"\n"
".ascii \" if self.is_map:\\n\"\n"
@@ -241,17 +239,17 @@ __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
".ascii \" count += 1\\n\"\n"
".ascii \" first_time = False\\n\"\n"
".ascii \" n0 = pc_.cast(gdb.lookup_type(\\\"uintptr_t\\\")) % groups.dereference().type.sizeof\\n\"\n"
".ascii \" n0 = pc_.cast(gdb.lookup_type(\\\"uintptr_t\\\")) % self.groups.dereference().type.sizeof\\n\"\n"
".ascii \" pc_ = self.cpo.next(pc_, -n0)\\n\"\n"
".ascii \" mask = (self.match_occupied(pc_.cast(groups.type).dereference()) >> (n0+1)) << (n0+1)\\n\"\n"
".ascii \" mask = (self.match_occupied(pc_.cast(self.groups.type).dereference()) >> (n0+1)) << (n0+1)\\n\"\n"
".ascii \" while mask == 0:\\n\"\n"
".ascii \" pc_ = self.cpo.next(pc_, groups.dereference().type.sizeof)\\n\"\n"
".ascii \" p_ = self.cpo.next(p_, groups.dereference()[\\\"N\\\"])\\n\"\n"
".ascii \" mask = self.match_occupied(pc_.cast(groups.type).dereference())\\n\"\n"
".ascii \" pc_ = self.cpo.next(pc_, self.groups.dereference().type.sizeof)\\n\"\n"
".ascii \" p_ = self.cpo.next(p_, self.N)\\n\"\n"
".ascii \" mask = self.match_occupied(pc_.cast(self.groups.type).dereference())\\n\"\n"
".ascii \" n = BoostUnorderedHelpers.countr_zero(mask)\\n\"\n"
".ascii \" if self.is_sentinel(pc_.cast(groups.type).dereference(), n):\\n\"\n"
".ascii \" if self.is_sentinel(pc_.cast(self.groups.type).dereference(), n):\\n\"\n"
".ascii \" p_ = 0\\n\"\n"
".ascii \" else:\\n\"\n"
".ascii \" pc_ = self.cpo.next(pc_, n)\\n\"\n"
@@ -411,4 +409,4 @@ __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
#endif // defined(__ELF__)
#endif // !defined(BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS)
#endif // !defined(BOOST_UNORDERED_UNORDERED_PRINTERS_HPP)
#endif // !defined(BOOST_UNORDERED_DETAIL_UNORDERED_PRINTERS_HPP)
+1
View File
@@ -362,6 +362,7 @@ local CFOA_TESTS =
pmr_allocator_tests
stats_tests
node_handle_allocator_tests
incomplete_tests
;
for local test in $(CFOA_TESTS)
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2025 Joaquin M Lopez Munoz.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_UNORDERED_CFOA_TESTS
#include "../unordered/incomplete_test.cpp"
+114 -23
View File
@@ -1,17 +1,28 @@
// Copyright 2009 Daniel James.
// Copyright 2022-2023 Christian Mazakas.
// Copyright 2025 Joaquin M Lopez Munoz
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "../helpers/unordered.hpp"
#ifdef BOOST_UNORDERED_CFOA_TESTS
#include <boost/unordered/concurrent_flat_set.hpp>
#include <boost/unordered/concurrent_flat_map.hpp>
#include <boost/unordered/concurrent_node_map.hpp>
#include <boost/unordered/concurrent_node_set.hpp>
#endif
#include <utility>
namespace x {
struct D
{
#ifdef BOOST_UNORDERED_FOA_TESTS
#if defined(BOOST_UNORDERED_CFOA_TESTS)
boost::concurrent_flat_map<D, D> x;
boost::concurrent_node_map<D, D> y;
#elif defined(BOOST_UNORDERED_FOA_TESTS)
boost::unordered_flat_map<D, D> x;
boost::unordered_node_map<D, D> y;
#else
@@ -30,26 +41,36 @@ namespace incomplete_test {
// Declare some instances
#ifdef BOOST_UNORDERED_FOA_TESTS
#if defined(BOOST_UNORDERED_CFOA_TESTS)
typedef boost::concurrent_flat_map<value, value, hash, equals,
allocator<std::pair<value const, value> > >
map1;
typedef boost::concurrent_flat_set<value, hash, equals, allocator<value> > set1;
typedef boost::concurrent_node_map<value, value, hash, equals,
allocator<std::pair<value const, value> > >
map2;
typedef boost::concurrent_node_set<value, hash, equals, allocator<value> >
set2;
#elif defined(BOOST_UNORDERED_FOA_TESTS)
typedef boost::unordered_flat_map<value, value, hash, equals,
allocator<std::pair<value const, value> > >
map;
typedef boost::unordered_flat_set<value, hash, equals, allocator<value> > set;
map1;
typedef boost::unordered_flat_set<value, hash, equals, allocator<value> > set1;
typedef boost::unordered_node_map<value, value, hash, equals,
allocator<std::pair<value const, value> > >
multimap;
map2;
typedef boost::unordered_node_set<value, hash, equals, allocator<value> >
multiset;
set2;
#else
typedef boost::unordered_map<value, value, hash, equals,
allocator<std::pair<value const, value> > >
map;
map1;
typedef boost::unordered_multimap<value, value, hash, equals,
allocator<std::pair<value const, value> > >
multimap;
typedef boost::unordered_set<value, hash, equals, allocator<value> > set;
map2;
typedef boost::unordered_set<value, hash, equals, allocator<value> > set1;
typedef boost::unordered_multiset<value, hash, equals, allocator<value> >
multiset;
set2;
#endif
// Now define the types which are stored as members, as they are needed for
@@ -132,24 +153,60 @@ namespace incomplete_test {
boost::unordered_multiset<struct4, hash, equals, allocator<struct4> > x;
};
#endif
// Now define the value type.
struct value
{
};
// Create some instances.
incomplete_test::map m1;
incomplete_test::multimap m2;
incomplete_test::set s1;
incomplete_test::multiset s2;
incomplete_test::map1 m1;
#ifndef BOOST_UNORDERED_CFOA_TESTS
incomplete_test::map1::iterator itm1;
incomplete_test::map1::const_iterator citm1;
#ifndef BOOST_UNORDERED_FOA_TESTS
incomplete_test::map1::local_iterator litm1;
incomplete_test::map1::const_local_iterator clitm1;
#endif
#endif
incomplete_test::map2 m2;
#ifndef BOOST_UNORDERED_CFOA_TESTS
incomplete_test::map2::iterator itm2;
incomplete_test::map2::const_iterator citm2;
#ifndef BOOST_UNORDERED_FOA_TESTS
incomplete_test::map2::local_iterator litm2;
incomplete_test::map2::const_local_iterator clitm2;
#endif
#endif
incomplete_test::set1 s1;
#ifndef BOOST_UNORDERED_CFOA_TESTS
incomplete_test::set1::iterator its1;
incomplete_test::set1::const_iterator cits1;
#ifndef BOOST_UNORDERED_FOA_TESTS
incomplete_test::set1::local_iterator lits1;
incomplete_test::set1::const_local_iterator clits1;
#endif
#endif
incomplete_test::set2 s2;
#ifndef BOOST_UNORDERED_CFOA_TESTS
incomplete_test::set2::iterator its2;
incomplete_test::set2::const_iterator cits2;
#ifndef BOOST_UNORDERED_FOA_TESTS
incomplete_test::set2::local_iterator lits2;
incomplete_test::set2::const_local_iterator clits2;
#endif
#endif
incomplete_test::struct1 c1;
incomplete_test::struct2 c2;
incomplete_test::struct3 c3;
incomplete_test::struct4 c4;
// Now define the value type.
struct value
{
};
// Now declare, but don't define, the operators required for comparing
// elements.
@@ -171,11 +228,45 @@ namespace incomplete_test {
void use_types()
{
incomplete_test::value x;
m1[x] = x;
m2.insert(std::make_pair(x, x));
s1.insert(x);
s2.insert(x);
m1.insert(std::make_pair(x, x));
#ifndef BOOST_UNORDERED_CFOA_TESTS
itm1 = m1.begin();
citm1 = m1.cbegin();
#ifndef BOOST_UNORDERED_FOA_TESTS
litm1 = m1.begin(0);
clitm1 = m1.cbegin(0);
#endif
#endif
m2.insert(std::make_pair(x, x));
#ifndef BOOST_UNORDERED_CFOA_TESTS
itm2 = m2.begin();
citm2 = m2.cbegin();
#ifndef BOOST_UNORDERED_FOA_TESTS
litm2 = m2.begin(0);
clitm2 = m2.cbegin(0);
#endif
#endif
s1.insert(x);
#ifndef BOOST_UNORDERED_CFOA_TESTS
its1 = s1.begin();
cits1 = s1.cbegin();
#ifndef BOOST_UNORDERED_FOA_TESTS
lits1 = s1.begin(0);
clits1 = s1.cbegin(0);
#endif
#endif
s2.insert(x);
#ifndef BOOST_UNORDERED_CFOA_TESTS
its2 = s2.begin();
cits2 = s2.cbegin();
#ifndef BOOST_UNORDERED_FOA_TESTS
lits2 = s2.begin(0);
clits2 = s2.cbegin(0);
#endif
#endif
c1.x.insert(std::make_pair(c1, c1));
c2.x.insert(std::make_pair(c2, c2));
c3.x.insert(c3);
+4 -4
View File
@@ -1689,14 +1689,14 @@ template <class UnorderedMap> void test_map_transparent_at(UnorderedMap*)
map.at(0) = 7331;
BOOST_TEST_EQ(key::count_, key_count);
BOOST_TEST_THROWS(map.at(4), std::out_of_range)
BOOST_TEST_THROWS(map.at(4), std::out_of_range);
BOOST_TEST_EQ(key::count_, key_count);
UnorderedMap const& m = map;
BOOST_TEST_EQ(m.at(0), 7331);
BOOST_TEST_EQ(key::count_, key_count);
BOOST_TEST_THROWS(m.at(4), std::out_of_range)
BOOST_TEST_THROWS(m.at(4), std::out_of_range);
BOOST_TEST_EQ(key::count_, key_count);
}
@@ -1719,7 +1719,7 @@ template <class UnorderedMap> void test_map_non_transparent_at(UnorderedMap*)
BOOST_TEST_EQ(key::count_, key_count + 1);
key_count = key::count_;
BOOST_TEST_THROWS(map.at(4), std::out_of_range)
BOOST_TEST_THROWS(map.at(4), std::out_of_range);
BOOST_TEST_EQ(key::count_, key_count + 1);
key_count = key::count_;
@@ -1728,7 +1728,7 @@ template <class UnorderedMap> void test_map_non_transparent_at(UnorderedMap*)
BOOST_TEST_EQ(key::count_, key_count + 1);
key_count = key::count_;
BOOST_TEST_THROWS(m.at(4), std::out_of_range)
BOOST_TEST_THROWS(m.at(4), std::out_of_range);
BOOST_TEST_EQ(key::count_, key_count + 1);
}