robin_hood: update to version version 3.11.5

* spot/priv/robin_hood.hh: Update.
* spot/priv/Makefile.am: Patch ROBIN_HOOD_IS_TRIVIALLY_COPYABLE to
work around an issue with clang on Arch linux.
This commit is contained in:
Alexandre Duret-Lutz 2023-01-23 15:25:06 +01:00
parent a9c457f93f
commit 3aba452b5b
2 changed files with 37 additions and 16 deletions

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8 -*-
## Copyright (C) 2013-2019, 2021-2022 Laboratoire de Recherche et
## Copyright (C) 2013-2019, 2021-2023 Laboratoire de Recherche et
## Développement de l'Epita (LRDE).
##
## This file is part of Spot, a model checking library.
@ -43,5 +43,11 @@ RH = $(GH)/robin-hood-hashing/master/src/include/robin_hood.h
.PHONY: update
update:
wget $(RH) -O robin_hood.tmp || curl $(RH) -o robin_hood.tmp
sed 's/std::malloc/malloc/' robin_hood.tmp > $(srcdir)/robin_hood.hh
## Do not use std::malloc but malloc, because gnulib may replace it by
## rpl_malloc instead. Also disable to tests of __GNUC__ about
## ROBIN_HOOD_IS_TRIVIALLY_COPYABLE because (1) all versions of G++ we
## support have std::is_trivially_copyable, and (2) clang define
## __GNUC__ to some value that fail this test, and then warn that
## __has_trivial_copy is obsoleted.
sed 's/std::malloc/malloc/;/https:\/\/stackoverflow.com\/a\/31798726/{n;s/defined.*/false/}' robin_hood.tmp > $(srcdir)/robin_hood.hh
rm -f robin_hood.tmp

View file

@ -36,7 +36,7 @@
// see https://semver.org/
#define ROBIN_HOOD_VERSION_MAJOR 3 // for incompatible API changes
#define ROBIN_HOOD_VERSION_MINOR 11 // for adding functionality in a backwards-compatible manner
#define ROBIN_HOOD_VERSION_PATCH 3 // for backwards-compatible bug fixes
#define ROBIN_HOOD_VERSION_PATCH 5 // for backwards-compatible bug fixes
#include <algorithm>
#include <cstdlib>
@ -206,7 +206,7 @@ static Counts& counts() {
// workaround missing "is_trivially_copyable" in g++ < 5.0
// See https://stackoverflow.com/a/31798726/48181
#if defined(__GNUC__) && __GNUC__ < 5
#if false
# define ROBIN_HOOD_IS_TRIVIALLY_COPYABLE(...) __has_trivial_copy(__VA_ARGS__)
#else
# define ROBIN_HOOD_IS_TRIVIALLY_COPYABLE(...) std::is_trivially_copyable<__VA_ARGS__>::value
@ -1820,6 +1820,12 @@ public:
InsertionState::key_found != idxAndState.second);
}
template <typename... Args>
iterator emplace_hint(const_iterator position, Args&&... args) {
(void)position;
return emplace(std::forward<Args>(args)...).first;
}
template <typename... Args>
std::pair<iterator, bool> try_emplace(const key_type& key, Args&&... args) {
return try_emplace_impl(key, std::forward<Args>(args)...);
@ -1831,16 +1837,15 @@ public:
}
template <typename... Args>
std::pair<iterator, bool> try_emplace(const_iterator hint, const key_type& key,
Args&&... args) {
iterator try_emplace(const_iterator hint, const key_type& key, Args&&... args) {
(void)hint;
return try_emplace_impl(key, std::forward<Args>(args)...);
return try_emplace_impl(key, std::forward<Args>(args)...).first;
}
template <typename... Args>
std::pair<iterator, bool> try_emplace(const_iterator hint, key_type&& key, Args&&... args) {
iterator try_emplace(const_iterator hint, key_type&& key, Args&&... args) {
(void)hint;
return try_emplace_impl(std::move(key), std::forward<Args>(args)...);
return try_emplace_impl(std::move(key), std::forward<Args>(args)...).first;
}
template <typename Mapped>
@ -1854,16 +1859,15 @@ public:
}
template <typename Mapped>
std::pair<iterator, bool> insert_or_assign(const_iterator hint, const key_type& key,
Mapped&& obj) {
iterator insert_or_assign(const_iterator hint, const key_type& key, Mapped&& obj) {
(void)hint;
return insertOrAssignImpl(key, std::forward<Mapped>(obj));
return insertOrAssignImpl(key, std::forward<Mapped>(obj)).first;
}
template <typename Mapped>
std::pair<iterator, bool> insert_or_assign(const_iterator hint, key_type&& key, Mapped&& obj) {
iterator insert_or_assign(const_iterator hint, key_type&& key, Mapped&& obj) {
(void)hint;
return insertOrAssignImpl(std::move(key), std::forward<Mapped>(obj));
return insertOrAssignImpl(std::move(key), std::forward<Mapped>(obj)).first;
}
std::pair<iterator, bool> insert(const value_type& keyval) {
@ -1871,10 +1875,20 @@ public:
return emplace(keyval);
}
iterator insert(const_iterator hint, const value_type& keyval) {
(void)hint;
return emplace(keyval).first;
}
std::pair<iterator, bool> insert(value_type&& keyval) {
return emplace(std::move(keyval));
}
iterator insert(const_iterator hint, value_type&& keyval) {
(void)hint;
return emplace(std::move(keyval)).first;
}
// Returns 1 if key is found, 0 otherwise.
size_t count(const key_type& key) const { // NOLINT(modernize-use-nodiscard)
ROBIN_HOOD_TRACE(this)
@ -2308,13 +2322,14 @@ private:
auto const numElementsWithBuffer = calcNumElementsWithBuffer(max_elements);
// calloc also zeroes everything
// malloc & zero mInfo. Faster than calloc everything.
auto const numBytesTotal = calcNumBytesTotal(numElementsWithBuffer);
ROBIN_HOOD_LOG("std::calloc " << numBytesTotal << " = calcNumBytesTotal("
<< numElementsWithBuffer << ")")
mKeyVals = reinterpret_cast<Node*>(
detail::assertNotNull<std::bad_alloc>(std::calloc(1, numBytesTotal)));
detail::assertNotNull<std::bad_alloc>(malloc(numBytesTotal)));
mInfo = reinterpret_cast<uint8_t*>(mKeyVals + numElementsWithBuffer);
std::memset(mInfo, 0, numBytesTotal - numElementsWithBuffer * sizeof(Node));
// set sentinel
mInfo[numElementsWithBuffer] = 1;