Skip to content

Commit

Permalink
[upstream_utils] Update to foonathan memory 0.7-3
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Aug 26, 2023
1 parent a0c029a commit 8823dc4
Show file tree
Hide file tree
Showing 63 changed files with 196 additions and 261 deletions.
2 changes: 1 addition & 1 deletion upstream_utils/update_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def run_global_replacements(memory_files):


def main():
upstream_root = clone_repo("https://github.com/foonathan/memory", "v0.7-2")
upstream_root = clone_repo("https://github.com/foonathan/memory", "v0.7-3")
wpilib_root = get_repo_root()
wpiutil = os.path.join(wpilib_root, "wpiutil")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED
#define WPI_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED
Expand Down Expand Up @@ -52,7 +51,7 @@ namespace wpi
aligned_allocator& operator=(aligned_allocator&& other) noexcept
{
allocator_type::operator=(detail::move(other));
min_alignment_ = other.min_alignment_;
min_alignment_ = other.min_alignment_;
return *this;
}
/// @}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED
#define WPI_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED
Expand Down Expand Up @@ -126,7 +125,7 @@ namespace wpi
WPI_REQUIRES(
(!std::is_base_of<allocator_storage, typename std::decay<Alloc>::type>::value))>
allocator_storage(Alloc&& alloc,
WPI_SFINAE(new storage_policy(detail::forward<Alloc>(alloc))))
WPI_SFINAE(new storage_policy(std::declval<Alloc>())))
: storage_policy(detail::forward<Alloc>(alloc))
{
}
Expand All @@ -136,8 +135,10 @@ namespace wpi
/// \requires The expression <tt>new storage_policy(other.get_allocator())</tt> must be well-formed,
/// otherwise this constructor does not participate in overload resolution.
template <class OtherPolicy>
allocator_storage(const allocator_storage<OtherPolicy, Mutex>& other,
WPI_SFINAE(new storage_policy(other.get_allocator())))
allocator_storage(
const allocator_storage<OtherPolicy, Mutex>& other,
WPI_SFINAE(new storage_policy(
std::declval<const allocator_storage<OtherPolicy, Mutex>&>().get_allocator())))
: storage_policy(other.get_allocator())
{
}
Expand Down Expand Up @@ -165,7 +166,7 @@ namespace wpi
/// @{
/// \effects Copies the \c allocator_storage object.
/// \requires The \c StoragePolicy must be copyable.
allocator_storage(const allocator_storage&) = default;
allocator_storage(const allocator_storage&) = default;
allocator_storage& operator=(const allocator_storage&) = default;
/// @}

Expand Down Expand Up @@ -296,9 +297,9 @@ namespace wpi
return detail::lock_allocator(get_allocator(), static_cast<actual_mutex&>(*this));
}

auto lock() const noexcept -> WPI_IMPL_DEFINED(decltype(
detail::lock_allocator(std::declval<const storage_policy>().get_allocator(),
std::declval<actual_mutex&>())))
auto lock() const noexcept -> WPI_IMPL_DEFINED(decltype(detail::lock_allocator(
std::declval<const storage_policy>().get_allocator(),
std::declval<actual_mutex&>())))
{
return detail::lock_allocator(get_allocator(), static_cast<actual_mutex&>(*this));
}
Expand Down Expand Up @@ -552,9 +553,9 @@ namespace wpi
{
using storage = detail::reference_storage_impl<
typename allocator_traits<RawAllocator>::allocator_type,
decltype(
detail::reference_type(typename allocator_traits<RawAllocator>::is_stateful{},
is_shared_allocator<RawAllocator>{}))>;
decltype(detail::reference_type(typename allocator_traits<
RawAllocator>::is_stateful{},
is_shared_allocator<RawAllocator>{}))>;

public:
using allocator_type = typename allocator_traits<RawAllocator>::allocator_type;
Expand All @@ -580,7 +581,7 @@ namespace wpi
/// @{
/// \effects Copies the \c allocator_reference object.
/// Only copies the pointer to it in the stateful case.
reference_storage(const reference_storage&) noexcept = default;
reference_storage(const reference_storage&) noexcept = default;
reference_storage& operator=(const reference_storage&) noexcept = default;
/// @}

Expand Down Expand Up @@ -795,17 +796,17 @@ namespace wpi
: public base_allocator,
private detail::reference_storage_impl<
typename allocator_traits<RawAllocator>::allocator_type,
decltype(
detail::reference_type(typename allocator_traits<RawAllocator>::is_stateful{},
is_shared_allocator<RawAllocator>{}))>
decltype(detail::reference_type(typename allocator_traits<
RawAllocator>::is_stateful{},
is_shared_allocator<RawAllocator>{}))>
{
using traits = allocator_traits<RawAllocator>;
using composable = is_composable_allocator<typename traits::allocator_type>;
using storage = detail::reference_storage_impl<
typename allocator_traits<RawAllocator>::allocator_type,
decltype(detail::reference_type(typename allocator_traits<
RawAllocator>::is_stateful{},
is_shared_allocator<RawAllocator>{}))>;
is_shared_allocator<RawAllocator>{}))>;

public:
// non stateful
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_ALLOCATOR_TRAITS_HPP_INCLUDED
#define WPI_MEMORY_ALLOCATOR_TRAITS_HPP_INCLUDED
Expand Down Expand Up @@ -375,12 +374,12 @@ namespace wpi

template <typename T>
struct has_invalid_alloc_function
: std::is_same<decltype(
traits_detail::allocate_node(traits_detail::full_concept{},
std::declval<typename allocator_traits<
T>::allocator_type&>(),
0, 0)),
traits_detail::error>
: std::is_same<
decltype(traits_detail::allocate_node(traits_detail::full_concept{},
std::declval<typename allocator_traits<
T>::allocator_type&>(),
0, 0)),
traits_detail::error>
{
};

Expand Down Expand Up @@ -564,13 +563,12 @@ namespace wpi

template <typename T>
struct has_invalid_try_dealloc_function
: std::is_same<
decltype(
traits_detail::try_deallocate_node(traits_detail::full_concept{},
std::declval<typename allocator_traits<
T>::allocator_type&>(),
nullptr, 0, 0)),
traits_detail::error>
: std::is_same<decltype(traits_detail::
try_deallocate_node(traits_detail::full_concept{},
std::declval<typename allocator_traits<
T>::allocator_type&>(),
nullptr, 0, 0)),
traits_detail::error>
{
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

/// \file
/// Configuration macros.
Expand Down Expand Up @@ -140,7 +139,7 @@
/// Set to `1` to disable automatic lifetime managment of the per-thread stack,
/// requires managing it through the \ref wpi::memory::temporary_stack_initializer.
/// Set to `0` to disable the per-thread stack completely.
/// \ref get_temporary_stack() will abort the program upon call.
/// \ref wpi::memory::get_temporary_stack() will abort the program upon call.
/// \ingroup allocator
#define WPI_MEMORY_TEMPORARY_STACK_MODE 2
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_CONTAINER_HPP_INCLUDED
#define WPI_MEMORY_CONTAINER_HPP_INCLUDED
Expand Down Expand Up @@ -276,8 +275,9 @@ namespace wpi
/// @{

/// Contains the node size of a node based STL container with a specific type.
/// These classes are auto-generated and only available if the tools are build and without
/// cross-compiling.
///
/// This trait is auto-generated and may not be available depending on the build configuration,
/// especially when doing cross compilation.
template <typename T>
struct forward_list_node_size : std::integral_constant<std::size_t, implementation_defined>
{
Expand Down Expand Up @@ -314,25 +314,30 @@ namespace wpi
{
};

/// \copydoc forward_list_node_size
/// Contains the node size of a node based STL container with a specific type.
///
/// This trait is auto-generated and may not be available depending on the build configuration,
/// especially when doing cross compilation.
///
/// \notes `T` is always the `value_type` of the container, e.g. `std::pair<const Key, Value>`.
template <typename T>
struct map_node_size : std::integral_constant<std::size_t, implementation_defined>
{
};

/// \copydoc forward_list_node_size
/// \copydoc map_node_size
template <typename T>
struct multimap_node_size : std::integral_constant<std::size_t, implementation_defined>
{
};

/// \copydoc forward_list_node_size
/// \copydoc map_node_size
template <typename T>
struct unordered_map_node_size : std::integral_constant<std::size_t, implementation_defined>
{
};

/// \copydoc forward_list_node_size
/// \copydoc map_node_size
template <typename T>
struct unordered_multimap_node_size
: std::integral_constant<std::size_t, implementation_defined>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DEBUGGING_HPP_INCLUDED
#define WPI_MEMORY_DEBUGGING_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DEFAULT_ALLOCATOR_HPP_INCLUDED
#define WPI_MEMORY_DEFAULT_ALLOCATOR_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DELETER_HPP_INCLUDED
#define WPI_MEMORY_DELETER_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_ALIGN_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_ALIGN_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_ASSERT_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_ASSERT_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DEBUG_HELPERS_HPP_INCLUDED
#define WPI_MEMORY_DEBUG_HELPERS_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_EBO_STORAGE_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_EBO_STORAGE_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAILL_FREE_LIST_HPP_INCLUDED
#define WPI_MEMORY_DETAILL_FREE_LIST_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP
#define WPI_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_ILOG2_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_ILOG2_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_LOWLEVEL_ALLOCATOR_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_LOWLEVEL_ALLOCATOR_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_SMALL_FREE_LIST_HPP_INCLUDED
#define WPI_MEMORY_DETAIL_SMALL_FREE_LIST_HPP_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_DETAIL_UTILITY_HPP
#define WPI_MEMORY_DETAIL_UTILITY_HPP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

/// \file
/// The exception classes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2015-2021 Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
// SPDX-License-Identifier: Zlib

#ifndef WPI_MEMORY_FALLBACK_ALLOCATOR_HPP_INCLUDED
#define WPI_MEMORY_FALLBACK_ALLOCATOR_HPP_INCLUDED
Expand Down
Loading

0 comments on commit 8823dc4

Please sign in to comment.