From 4440c940da38c03e1b0baf4e7462d3f7f0816b75 Mon Sep 17 00:00:00 2001 From: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Date: Thu, 1 Sep 2022 15:36:50 +0800 Subject: [PATCH 01/19] Add vcpkg installation instructions (#137) --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index c13db8e..b2dcab5 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,18 @@ To use an installed library: See https://memory.foonathan.net/md_doc_installation.html for a detailed guide. +## Building foonathan-memory - Using vcpkg + +You can download and install foonathan-memory using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + ./vcpkg install foonathan-memory + +The foonathan-memory port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + ## Documentation Full documentation can be found at https://memory.foonathan.net/. From 87a21399ff677594757100ffcbabdb26f8cf6278 Mon Sep 17 00:00:00 2001 From: Matt Cross Date: Thu, 8 Sep 2022 15:54:56 -0400 Subject: [PATCH 02/19] Address issue #138 - workaround command line quoting issue for types with spaces, and also address std lib implementations that wrap value types in some containers in a conatiner type of the same size. (#139) Co-authored-by: Matt Cross --- cmake/get_align_of.cpp | 4 ++++ cmake/get_container_node_sizes.cmake | 6 ++++-- cmake/get_node_size.cpp | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cmake/get_align_of.cpp b/cmake/get_align_of.cpp index 236faac..787af7d 100644 --- a/cmake/get_align_of.cpp +++ b/cmake/get_align_of.cpp @@ -9,4 +9,8 @@ struct align_of template using get_align_of = align_of; +// Workaround for environments that have issues passing in type names with spaces +using LONG_LONG = long long; +using LONG_DOUBLE = long double; + get_align_of dummy; diff --git a/cmake/get_container_node_sizes.cmake b/cmake/get_container_node_sizes.cmake index 772ca12..90f220a 100644 --- a/cmake/get_container_node_sizes.cmake +++ b/cmake/get_container_node_sizes.cmake @@ -4,7 +4,9 @@ # is being processed. set(_THIS_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(_DEBUG_GET_CONTAINER_NODE_SIZES OFF) +if(NOT DEFINED _DEBUG_GET_CONTAINER_NODE_SIZES) + set(_DEBUG_GET_CONTAINER_NODE_SIZES OFF) +endif() function(_gcns_debug_message) if(_DEBUG_GET_CONTAINER_NODE_SIZES) @@ -50,7 +52,7 @@ function(unique_aligned_types result_types result_alignments) set(alignments ) set(types ) - set(all_types char bool short int long "long long" float double "long double") + set(all_types char bool short int long LONG_LONG float double LONG_DOUBLE) foreach(type IN LISTS all_types ) get_alignof_type("${type}" alignment) _gcns_debug_message("Alignment of '${type}' is '${alignment}'") diff --git a/cmake/get_node_size.cpp b/cmake/get_node_size.cpp index dc6475c..a2e377e 100644 --- a/cmake/get_node_size.cpp +++ b/cmake/get_node_size.cpp @@ -53,7 +53,7 @@ template::value>, + !is_same::value && (sizeof(InitialType) != sizeof(T))>, private State { template @@ -201,6 +201,10 @@ int test_container() } #endif // SHARED_PTR_STATEFUL_CONTAINER +// Workaround for environments that have issues passing in type names with spaces +using LONG_LONG = long long; +using LONG_DOUBLE = long double; + #ifdef TEST_TYPES template int test_all(std::tuple) From 9a17798bed548c9645dadf639e62375ae3564a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 28 Sep 2022 10:54:15 +0200 Subject: [PATCH 03/19] Remove old `FOONATHAN_THREAD_LOCAL` macros Fixes #142. --- src/temporary_allocator.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/temporary_allocator.cpp b/src/temporary_allocator.cpp index c4a7c3b..a29fab6 100644 --- a/src/temporary_allocator.cpp +++ b/src/temporary_allocator.cpp @@ -216,9 +216,8 @@ temporary_stack& foonathan::memory::get_temporary_stack(std::size_t initial_size namespace { - FOONATHAN_THREAD_LOCAL alignas( - temporary_stack) char temporary_stack_storage[sizeof(temporary_stack)]; - FOONATHAN_THREAD_LOCAL bool is_created = false; + thread_local alignas(temporary_stack) char temporary_stack_storage[sizeof(temporary_stack)]; + thread_local bool is_created = false; temporary_stack& get() noexcept { From df48e667a4fc98a121d1a83f05e975b835d9a7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 7 Oct 2022 11:07:55 +0200 Subject: [PATCH 04/19] Don't generate node sizes if it already exists Fixes #143. --- cmake/configuration.cmake | 6 ------ doc/options.md | 2 -- src/CMakeLists.txt | 6 ++++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake index 2ad1b0f..116dafb 100644 --- a/cmake/configuration.cmake +++ b/cmake/configuration.cmake @@ -61,13 +61,7 @@ option(FOONATHAN_MEMORY_CHECK_ALLOCATION_SIZE "whether or not the size of the allocation will be checked" ON) set(FOONATHAN_MEMORY_DEFAULT_ALLOCATOR heap_allocator CACHE STRING "the default implementation allocator for higher-level ones") -set(FOONATHAN_MEMORY_MEMORY_RESOURCE_HEADER "" CACHE STRING - "the header of the memory_resource class used") -set(FOONATHAN_MEMORY_MEMORY_RESOURCE std::memory_resource CACHE STRING - "the memory_resource class used") option(FOONATHAN_MEMORY_EXTERN_TEMPLATE "whether or not common template instantiations are already provided by the library" ON) set(FOONATHAN_MEMORY_TEMPORARY_STACK_MODE 2 CACHE STRING "set to 0 to disable the per-thread stack completely, to 1 to disable the nitfy counter and to 2 to enable everything") -set(FOONATHAN_MEMORY_CONTAINER_NODE_SIZES_IMPL container_node_sizes_impl.hpp CACHE FILEPATH - "the path of the header that defines the node sizes and alignments if pre-generated.") diff --git a/doc/options.md b/doc/options.md index dcb7246..161eda6 100644 --- a/doc/options.md +++ b/doc/options.md @@ -12,8 +12,6 @@ You can create as many build types as you want. There are the following variables available to configure it: -* `COMP_HAS_*`: specifies compatibility options, that is, whether a certain C++ feature is available under your compiler. They are automatically detected by CMake, so there is usually no need to change them. - * `FOONATHAN_MEMORY_BUILD_EXAMPLES/_TESTS`: whether or not to build examples or tests. If this is `OFF` their CMake scripts are not even included. It is `ON` for standalone builds and `OFF` if used in `add_subdirectory()`. * `FOONATHAN_MEMORY_BUILD_TOOLS`: whether or not build the tools. Unlike the other two options, this is always `ON`. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2735c1e..c09cc10 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -76,8 +76,10 @@ set(src # configure config file configure_file("config.hpp.in" "${CMAKE_CURRENT_BINARY_DIR}/config_impl.hpp") -# generate container_node_sizes.hpp -get_container_node_sizes(${CMAKE_CURRENT_BINARY_DIR}/container_node_sizes_impl.hpp) +# generate container_node_sizes.hpp if necessary +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/container_node_sizes_impl.hpp) + get_container_node_sizes(${CMAKE_CURRENT_BINARY_DIR}/container_node_sizes_impl.hpp) +endif() add_library(foonathan_memory ${detail_header} ${header} ${src}) target_include_directories(foonathan_memory PUBLIC $ # for client in subdirectory From d0daa6d5d74d19288cd41840febdc64a770b0802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 25 Nov 2022 18:47:45 +0100 Subject: [PATCH 05/19] Fix MacOS CI --- .github/workflows/feature_ci.yml | 2 +- .github/workflows/main_ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/feature_ci.yml b/.github/workflows/feature_ci.yml index a479a46..c1041cb 100644 --- a/.github/workflows/feature_ci.yml +++ b/.github/workflows/feature_ci.yml @@ -45,7 +45,7 @@ jobs: xcode: ['11', '13'] sharedlibs: [OFF, ON] - runs-on: macos-latest + runs-on: macos-11 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index 32e0120..d375099 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -56,7 +56,7 @@ jobs: - '13' sharedlibs: [OFF, ON] - runs-on: macos-latest + runs-on: macos-11 steps: - uses: actions/checkout@v2 From 3144037b6376057777e84149b5e59e91e01c0ec8 Mon Sep 17 00:00:00 2001 From: Yves Delley Date: Mon, 28 Nov 2022 10:43:01 +0100 Subject: [PATCH 06/19] Fix issue 145 compile on VS 2022 (#146) --- .github/workflows/main_ci.yml | 5 +++-- include/foonathan/memory/allocator_storage.hpp | 4 ++-- include/foonathan/memory/std_allocator.hpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index d375099..65c7be5 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -81,8 +81,9 @@ jobs: matrix: build_type: [Debug, Release] sharedlibs: [OFF, ON] + std: [14, 17, 20] - runs-on: windows-2019 + runs-on: windows-2022 steps: - uses: actions/checkout@v2 @@ -91,7 +92,7 @@ jobs: - name: Configure shell: bash working-directory: build/ - run: cmake $GITHUB_WORKSPACE -G"Visual Studio 16 2019" -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} + run: cmake $GITHUB_WORKSPACE -G"Visual Studio 17 2022" -DCMAKE_CXX_STANDARD=${{matrix.std}} -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} - name: Build working-directory: build/ run: cmake --build . --config ${{matrix.build_type}} diff --git a/include/foonathan/memory/allocator_storage.hpp b/include/foonathan/memory/allocator_storage.hpp index 6c22029..4df7bd1 100644 --- a/include/foonathan/memory/allocator_storage.hpp +++ b/include/foonathan/memory/allocator_storage.hpp @@ -126,7 +126,7 @@ namespace foonathan FOONATHAN_REQUIRES( (!std::is_base_of::type>::value))> allocator_storage(Alloc&& alloc, - FOONATHAN_SFINAE(new storage_policy(detail::forward(alloc)))) + FOONATHAN_SFINAE(new storage_policy(std::declval()))) : storage_policy(detail::forward(alloc)) { } @@ -137,7 +137,7 @@ namespace foonathan /// otherwise this constructor does not participate in overload resolution. template allocator_storage(const allocator_storage& other, - FOONATHAN_SFINAE(new storage_policy(other.get_allocator()))) + FOONATHAN_SFINAE(new storage_policy(std::declval&>().get_allocator()))) : storage_policy(other.get_allocator()) { } diff --git a/include/foonathan/memory/std_allocator.hpp b/include/foonathan/memory/std_allocator.hpp index 55a5ca6..8af7554 100644 --- a/include/foonathan/memory/std_allocator.hpp +++ b/include/foonathan/memory/std_allocator.hpp @@ -134,7 +134,7 @@ namespace foonathan // MSVC seems to ignore access rights in decltype SFINAE below // use this to prevent this constructor being chosen instead of move/copy for types inheriting from it FOONATHAN_REQUIRES((!std::is_base_of::value))> - std_allocator(RawAlloc& alloc, FOONATHAN_SFINAE(alloc_reference(alloc))) noexcept + std_allocator(RawAlloc& alloc, FOONATHAN_SFINAE(alloc_reference(std::declval()))) noexcept : alloc_reference(alloc) { } @@ -149,7 +149,7 @@ namespace foonathan // MSVC seems to ignore access rights in decltype SFINAE below // use this to prevent this constructor being chosen instead of move/copy for types inheriting from it FOONATHAN_REQUIRES((!std::is_base_of::value))> - std_allocator(const RawAlloc& alloc, FOONATHAN_SFINAE(alloc_reference(alloc))) noexcept + std_allocator(const RawAlloc& alloc, FOONATHAN_SFINAE(alloc_reference(std::declval()))) noexcept : alloc_reference(alloc) { } From 62a41ddcf919d7066436a2e86cd3567337458e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Fri, 2 Dec 2022 15:38:58 +0100 Subject: [PATCH 07/19] Increase cmake_minimum_required to 3.14 (#147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno Signed-off-by: Ricardo González Moreno --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be43a14..7bdbf72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # root CMakeLists.txt, specifies option and interface library -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.14) project(FOONATHAN_MEMORY) set(FOONATHAN_MEMORY_VERSION_MAJOR 0 CACHE STRING "major version of memory" FORCE) From d30bea940f0b89f7369745c2d6a148d041baba75 Mon Sep 17 00:00:00 2001 From: oberrich <6305520+oberrich@users.noreply.github.com> Date: Sun, 25 Dec 2022 19:37:14 +0100 Subject: [PATCH 08/19] Fix typo in documentation of `array_pool` (#149) --- include/foonathan/memory/memory_pool_type.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/foonathan/memory/memory_pool_type.hpp b/include/foonathan/memory/memory_pool_type.hpp index 1f1e435..ad5c143 100644 --- a/include/foonathan/memory/memory_pool_type.hpp +++ b/include/foonathan/memory/memory_pool_type.hpp @@ -28,7 +28,7 @@ namespace foonathan }; /// Tag type defining a memory pool optimized for arrays. - /// It keeps the nodes oredered inside the free list and searches the list for an appropriate memory block. + /// It keeps the nodes ordered inside the free list and searches the list for an appropriate memory block. /// Array allocations are still pretty slow, if the array gets big enough it can get slower than \c new. /// Node allocations are still fast, unless there is deallocation in random order. /// \note Use this tag type only if you really need to have a memory pool! From 024e7b4a281f83004e55f022d667ec1172259b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 11:56:33 +0100 Subject: [PATCH 09/19] Remove sponsorship notice --- .github/FUNDING.yml | 3 --- README.md | 5 ----- 2 files changed, 8 deletions(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 47c85de..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -patreon: foonathan -custom: ['https://jonathanmueller.dev/support-me/'] - diff --git a/README.md b/README.md index b2dcab5..ea44f14 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,6 @@ The C++ STL allocator model has various flaws. For example, they are fixed to a certain type, because they are almost necessarily required to be templates. So you can't easily share a single allocator for multiple types. In addition, you can only get a copy from the containers and not the original allocator object. At least with C++11 they are allowed to be stateful and so can be made object not instance based. But still, the model has many flaws. Over the course of the years many solutions have been proposed, for example [EASTL]. This library is another. But instead of trying to change the STL, it works with the current implementation. -> |[![](https://www.jonathanmueller.dev/embarcadero-logo.png)](https://www.embarcadero.com/de/products/cbuilder/starter) | Sponsored by [Embarcadero C++Builder](https://www.embarcadero.com/de/products/cbuilder/starter). | -> |-------------------------------------|----------------| -> -> If you like this project, consider [supporting me](https://jonathanmueller.dev/support-me/). - ## Features New allocator concepts: From 2502c9797fd0a281546f6dcea41f52db1896c832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:02:12 +0100 Subject: [PATCH 10/19] Update copyright notice --- CMakeLists.txt | 5 +- LICENSE | 2 +- cmake/configuration.cmake | 5 +- example/CMakeLists.txt | 5 +- example/allocator_storage.cpp | 5 +- example/joint_allocation.cpp | 5 +- example/taking_allocators.cpp | 11 ++- example/tracking.cpp | 5 +- example/using_allocators.cpp | 5 +- .../foonathan/memory/aligned_allocator.hpp | 7 +- .../foonathan/memory/allocator_storage.hpp | 35 ++++---- include/foonathan/memory/allocator_traits.hpp | 30 +++---- include/foonathan/memory/config.hpp | 5 +- include/foonathan/memory/container.hpp | 5 +- include/foonathan/memory/debugging.hpp | 5 +- .../foonathan/memory/default_allocator.hpp | 5 +- include/foonathan/memory/deleter.hpp | 5 +- include/foonathan/memory/detail/align.hpp | 5 +- include/foonathan/memory/detail/assert.hpp | 5 +- .../memory/detail/container_node_sizes.hpp | 5 +- .../foonathan/memory/detail/debug_helpers.hpp | 5 +- .../foonathan/memory/detail/ebo_storage.hpp | 5 +- include/foonathan/memory/detail/free_list.hpp | 5 +- .../memory/detail/free_list_array.hpp | 5 +- include/foonathan/memory/detail/ilog2.hpp | 5 +- .../memory/detail/lowlevel_allocator.hpp | 5 +- .../foonathan/memory/detail/memory_stack.hpp | 5 +- .../memory/detail/small_free_list.hpp | 5 +- include/foonathan/memory/detail/utility.hpp | 5 +- include/foonathan/memory/error.hpp | 5 +- .../foonathan/memory/fallback_allocator.hpp | 5 +- include/foonathan/memory/heap_allocator.hpp | 5 +- .../foonathan/memory/iteration_allocator.hpp | 9 +- include/foonathan/memory/joint_allocator.hpp | 11 ++- include/foonathan/memory/malloc_allocator.hpp | 5 +- include/foonathan/memory/memory_arena.hpp | 7 +- include/foonathan/memory/memory_pool.hpp | 9 +- .../memory/memory_pool_collection.hpp | 11 ++- include/foonathan/memory/memory_pool_type.hpp | 5 +- .../memory/memory_resource_adapter.hpp | 5 +- include/foonathan/memory/memory_stack.hpp | 8 +- include/foonathan/memory/namespace_alias.hpp | 5 +- include/foonathan/memory/new_allocator.hpp | 5 +- include/foonathan/memory/segregator.hpp | 5 +- include/foonathan/memory/smart_ptr.hpp | 5 +- include/foonathan/memory/static_allocator.hpp | 5 +- include/foonathan/memory/std_allocator.hpp | 11 +-- .../foonathan/memory/temporary_allocator.hpp | 9 +- include/foonathan/memory/threading.hpp | 5 +- include/foonathan/memory/tracking.hpp | 5 +- include/foonathan/memory/virtual_memory.hpp | 5 +- src/CMakeLists.txt | 5 +- src/config.hpp.in | 5 +- src/debugging.cpp | 5 +- src/detail/align.cpp | 5 +- src/detail/assert.cpp | 5 +- src/detail/debug_helpers.cpp | 5 +- src/detail/free_list.cpp | 5 +- src/detail/free_list_array.cpp | 5 +- src/detail/free_list_utils.hpp | 5 +- src/detail/small_free_list.cpp | 5 +- src/error.cpp | 5 +- src/heap_allocator.cpp | 5 +- src/iteration_allocator.cpp | 5 +- src/malloc_allocator.cpp | 5 +- src/memory_arena.cpp | 5 +- src/memory_pool.cpp | 5 +- src/memory_pool_collection.cpp | 5 +- src/memory_stack.cpp | 5 +- src/new_allocator.cpp | 5 +- src/static_allocator.cpp | 11 ++- src/temporary_allocator.cpp | 5 +- src/virtual_memory.cpp | 5 +- test/CMakeLists.txt | 5 +- test/aligned_allocator.cpp | 5 +- test/allocator_traits.cpp | 5 +- test/benchmark.hpp | 87 +++++++++++-------- test/default_allocator.cpp | 5 +- test/detail/align.cpp | 5 +- test/detail/debug_helpers.cpp | 5 +- test/detail/free_list.cpp | 5 +- test/detail/free_list_array.cpp | 5 +- test/detail/ilog2.cpp | 5 +- test/detail/memory_stack.cpp | 5 +- test/fallback_allocator.cpp | 5 +- test/iteration_allocator.cpp | 5 +- test/joint_allocator.cpp | 5 +- test/memory_arena.cpp | 5 +- test/memory_pool.cpp | 5 +- test/memory_pool_collection.cpp | 5 +- test/memory_resource_adapter.cpp | 5 +- test/memory_stack.cpp | 5 +- test/profiling.cpp | 20 ++--- test/segregator.cpp | 5 +- test/smart_ptr.cpp | 5 +- test/test.cpp | 5 +- test/test_allocator.hpp | 5 +- tool/CMakeLists.txt | 5 +- tool/node_size_debugger.cpp | 5 +- tool/node_size_debugger.hpp | 5 +- tool/test_types.hpp | 5 +- 101 files changed, 309 insertions(+), 394 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bdbf72..e72b6ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ -# Copyright (C) 2015-2021 Müller -# 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 # root CMakeLists.txt, specifies option and interface library diff --git a/LICENSE b/LICENSE index b6fa6fb..94407cb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2015-2020 Jonathan Müller +Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake index 116dafb..59f1d67 100644 --- a/cmake/configuration.cmake +++ b/cmake/configuration.cmake @@ -1,6 +1,5 @@ -# Copyright (C) 2015-2016 Jonathan Müller -# 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 # defines configuration options # note: only include it in memory's top-level CMakeLists.txt, after compatibility.cmake diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index ce3ba3d..e1442b3 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,6 +1,5 @@ -# Copyright (C) 2015-2021 Müller -# 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 # builds examples diff --git a/example/allocator_storage.cpp b/example/allocator_storage.cpp index 25d35f1..fafde52 100644 --- a/example/allocator_storage.cpp +++ b/example/allocator_storage.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 // this example shows how to store allocators by reference and type-erased // see https://memory.foonathan.net/md_doc_adapters_storage.html for further details diff --git a/example/joint_allocation.cpp b/example/joint_allocation.cpp index 5a1a7f6..b78f7bb 100644 --- a/example/joint_allocation.cpp +++ b/example/joint_allocation.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 // this examples shows how to use the joint memory facilities // they allow sharing the same memory for the dynamic allocation of an object diff --git a/example/taking_allocators.cpp b/example/taking_allocators.cpp index 92407ce..542d5ce 100644 --- a/example/taking_allocators.cpp +++ b/example/taking_allocators.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 // this example provides two implementation of a deep_copy_ptr that performs a copy when copying the pointer // the first version takes an Allocator the second a RawAllocator @@ -65,7 +64,7 @@ namespace using_std_allocator destroy(); Allocator::operator=(std::move(alloc)); - ptr_ = ptr; + ptr_ = ptr; } else { @@ -83,8 +82,8 @@ namespace using_std_allocator && static_cast(*this) != other) { allocator_type::operator=(std::move(other)); - ptr_ = other.ptr_; - other.ptr_ = nullptr; + ptr_ = other.ptr_; + other.ptr_ = nullptr; } else if (static_cast(*this) == other) { diff --git a/example/tracking.cpp b/example/tracking.cpp index 9c86cb1..c8e7814 100644 --- a/example/tracking.cpp +++ b/example/tracking.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 // this example shows how to track allocations // see https://memory.foonathan.net/md_doc_adapters_storage.html for further details diff --git a/example/using_allocators.cpp b/example/using_allocators.cpp index 51c1e33..5ac5760 100644 --- a/example/using_allocators.cpp +++ b/example/using_allocators.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 // this examples shows the basic usage of RawAllocator classes with containers and smart pointers // see https://memory.foonathan.net/md_doc_external_usage.html for more details diff --git a/include/foonathan/memory/aligned_allocator.hpp b/include/foonathan/memory/aligned_allocator.hpp index 3efcc67..fe724aa 100644 --- a/include/foonathan/memory/aligned_allocator.hpp +++ b/include/foonathan/memory/aligned_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED @@ -52,7 +51,7 @@ namespace foonathan 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; } /// @} diff --git a/include/foonathan/memory/allocator_storage.hpp b/include/foonathan/memory/allocator_storage.hpp index 4df7bd1..57f128a 100644 --- a/include/foonathan/memory/allocator_storage.hpp +++ b/include/foonathan/memory/allocator_storage.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED #define FOONATHAN_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED @@ -136,8 +135,10 @@ namespace foonathan /// \requires The expression new storage_policy(other.get_allocator()) must be well-formed, /// otherwise this constructor does not participate in overload resolution. template - allocator_storage(const allocator_storage& other, - FOONATHAN_SFINAE(new storage_policy(std::declval&>().get_allocator()))) + allocator_storage( + const allocator_storage& other, + FOONATHAN_SFINAE(new storage_policy( + std::declval&>().get_allocator()))) : storage_policy(other.get_allocator()) { } @@ -165,7 +166,7 @@ namespace foonathan /// @{ /// \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; /// @} @@ -296,9 +297,9 @@ namespace foonathan return detail::lock_allocator(get_allocator(), static_cast(*this)); } - auto lock() const noexcept -> FOONATHAN_IMPL_DEFINED(decltype( - detail::lock_allocator(std::declval().get_allocator(), - std::declval()))) + auto lock() const noexcept -> FOONATHAN_IMPL_DEFINED(decltype(detail::lock_allocator( + std::declval().get_allocator(), + std::declval()))) { return detail::lock_allocator(get_allocator(), static_cast(*this)); } @@ -552,9 +553,9 @@ namespace foonathan { using storage = detail::reference_storage_impl< typename allocator_traits::allocator_type, - decltype( - detail::reference_type(typename allocator_traits::is_stateful{}, - is_shared_allocator{}))>; + decltype(detail::reference_type(typename allocator_traits< + RawAllocator>::is_stateful{}, + is_shared_allocator{}))>; public: using allocator_type = typename allocator_traits::allocator_type; @@ -580,7 +581,7 @@ namespace foonathan /// @{ /// \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; /// @} @@ -795,9 +796,9 @@ namespace foonathan : public base_allocator, private detail::reference_storage_impl< typename allocator_traits::allocator_type, - decltype( - detail::reference_type(typename allocator_traits::is_stateful{}, - is_shared_allocator{}))> + decltype(detail::reference_type(typename allocator_traits< + RawAllocator>::is_stateful{}, + is_shared_allocator{}))> { using traits = allocator_traits; using composable = is_composable_allocator; @@ -805,7 +806,7 @@ namespace foonathan typename allocator_traits::allocator_type, decltype(detail::reference_type(typename allocator_traits< RawAllocator>::is_stateful{}, - is_shared_allocator{}))>; + is_shared_allocator{}))>; public: // non stateful diff --git a/include/foonathan/memory/allocator_traits.hpp b/include/foonathan/memory/allocator_traits.hpp index 791cfcb..78f5ccf 100644 --- a/include/foonathan/memory/allocator_traits.hpp +++ b/include/foonathan/memory/allocator_traits.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_ALLOCATOR_TRAITS_HPP_INCLUDED #define FOONATHAN_MEMORY_ALLOCATOR_TRAITS_HPP_INCLUDED @@ -375,12 +374,12 @@ namespace foonathan template struct has_invalid_alloc_function - : std::is_same::allocator_type&>(), - 0, 0)), - traits_detail::error> + : std::is_same< + decltype(traits_detail::allocate_node(traits_detail::full_concept{}, + std::declval::allocator_type&>(), + 0, 0)), + traits_detail::error> { }; @@ -564,13 +563,12 @@ namespace foonathan template struct has_invalid_try_dealloc_function - : std::is_same< - decltype( - traits_detail::try_deallocate_node(traits_detail::full_concept{}, - std::declval::allocator_type&>(), - nullptr, 0, 0)), - traits_detail::error> + : std::is_same::allocator_type&>(), + nullptr, 0, 0)), + traits_detail::error> { }; diff --git a/include/foonathan/memory/config.hpp b/include/foonathan/memory/config.hpp index 62229b6..5156fac 100644 --- a/include/foonathan/memory/config.hpp +++ b/include/foonathan/memory/config.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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. diff --git a/include/foonathan/memory/container.hpp b/include/foonathan/memory/container.hpp index 1b142c2..bf22e6f 100644 --- a/include/foonathan/memory/container.hpp +++ b/include/foonathan/memory/container.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_CONTAINER_HPP_INCLUDED #define FOONATHAN_MEMORY_CONTAINER_HPP_INCLUDED diff --git a/include/foonathan/memory/debugging.hpp b/include/foonathan/memory/debugging.hpp index d9edaf6..bb9af98 100644 --- a/include/foonathan/memory/debugging.hpp +++ b/include/foonathan/memory/debugging.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DEBUGGING_HPP_INCLUDED #define FOONATHAN_MEMORY_DEBUGGING_HPP_INCLUDED diff --git a/include/foonathan/memory/default_allocator.hpp b/include/foonathan/memory/default_allocator.hpp index 82c35c5..29a2139 100644 --- a/include/foonathan/memory/default_allocator.hpp +++ b/include/foonathan/memory/default_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DEFAULT_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_DEFAULT_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/deleter.hpp b/include/foonathan/memory/deleter.hpp index 140b099..6c9cf5f 100644 --- a/include/foonathan/memory/deleter.hpp +++ b/include/foonathan/memory/deleter.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DELETER_HPP_INCLUDED #define FOONATHAN_MEMORY_DELETER_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/align.hpp b/include/foonathan/memory/detail/align.hpp index 04dbb47..a9c0fd5 100644 --- a/include/foonathan/memory/detail/align.hpp +++ b/include/foonathan/memory/detail/align.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_ALIGN_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_ALIGN_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/assert.hpp b/include/foonathan/memory/detail/assert.hpp index 74dacfd..dddbfbe 100644 --- a/include/foonathan/memory/detail/assert.hpp +++ b/include/foonathan/memory/detail/assert.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_ASSERT_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_ASSERT_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/container_node_sizes.hpp b/include/foonathan/memory/detail/container_node_sizes.hpp index ec27b09..f2eef03 100644 --- a/include/foonathan/memory/detail/container_node_sizes.hpp +++ b/include/foonathan/memory/detail/container_node_sizes.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/debug_helpers.hpp b/include/foonathan/memory/detail/debug_helpers.hpp index 6249b48..3bdadb3 100644 --- a/include/foonathan/memory/detail/debug_helpers.hpp +++ b/include/foonathan/memory/detail/debug_helpers.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DEBUG_HELPERS_HPP_INCLUDED #define FOONATHAN_MEMORY_DEBUG_HELPERS_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/ebo_storage.hpp b/include/foonathan/memory/detail/ebo_storage.hpp index 90e3bce..35ccf1e 100644 --- a/include/foonathan/memory/detail/ebo_storage.hpp +++ b/include/foonathan/memory/detail/ebo_storage.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_EBO_STORAGE_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_EBO_STORAGE_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/free_list.hpp b/include/foonathan/memory/detail/free_list.hpp index f33ad62..cd646e1 100644 --- a/include/foonathan/memory/detail/free_list.hpp +++ b/include/foonathan/memory/detail/free_list.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAILL_FREE_LIST_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAILL_FREE_LIST_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/free_list_array.hpp b/include/foonathan/memory/detail/free_list_array.hpp index 25fd52d..c18b46b 100644 --- a/include/foonathan/memory/detail/free_list_array.hpp +++ b/include/foonathan/memory/detail/free_list_array.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP #define FOONATHAN_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP diff --git a/include/foonathan/memory/detail/ilog2.hpp b/include/foonathan/memory/detail/ilog2.hpp index 624027a..0d98e46 100644 --- a/include/foonathan/memory/detail/ilog2.hpp +++ b/include/foonathan/memory/detail/ilog2.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_ILOG2_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_ILOG2_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/lowlevel_allocator.hpp b/include/foonathan/memory/detail/lowlevel_allocator.hpp index 986cedc..5836219 100644 --- a/include/foonathan/memory/detail/lowlevel_allocator.hpp +++ b/include/foonathan/memory/detail/lowlevel_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_LOWLEVEL_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_LOWLEVEL_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/memory_stack.hpp b/include/foonathan/memory/detail/memory_stack.hpp index 98d62e2..7fbe447 100644 --- a/include/foonathan/memory/detail/memory_stack.hpp +++ b/include/foonathan/memory/detail/memory_stack.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/small_free_list.hpp b/include/foonathan/memory/detail/small_free_list.hpp index d61b0b7..60bde31 100644 --- a/include/foonathan/memory/detail/small_free_list.hpp +++ b/include/foonathan/memory/detail/small_free_list.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_SMALL_FREE_LIST_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_SMALL_FREE_LIST_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/utility.hpp b/include/foonathan/memory/detail/utility.hpp index afd403c..f76dd3c 100644 --- a/include/foonathan/memory/detail/utility.hpp +++ b/include/foonathan/memory/detail/utility.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_DETAIL_UTILITY_HPP #define FOONATHAN_MEMORY_DETAIL_UTILITY_HPP diff --git a/include/foonathan/memory/error.hpp b/include/foonathan/memory/error.hpp index bdcd981..d3152dc 100644 --- a/include/foonathan/memory/error.hpp +++ b/include/foonathan/memory/error.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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. diff --git a/include/foonathan/memory/fallback_allocator.hpp b/include/foonathan/memory/fallback_allocator.hpp index 1871dd1..7ae86ea 100644 --- a/include/foonathan/memory/fallback_allocator.hpp +++ b/include/foonathan/memory/fallback_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_FALLBACK_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_FALLBACK_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/heap_allocator.hpp b/include/foonathan/memory/heap_allocator.hpp index 98ee457..87532c4 100644 --- a/include/foonathan/memory/heap_allocator.hpp +++ b/include/foonathan/memory/heap_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_HEAP_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_HEAP_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/iteration_allocator.hpp b/include/foonathan/memory/iteration_allocator.hpp index e51d3ed..37cb4cc 100644 --- a/include/foonathan/memory/iteration_allocator.hpp +++ b/include/foonathan/memory/iteration_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_ITERATION_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_ITERATION_ALLOCATOR_HPP_INCLUDED @@ -77,8 +76,8 @@ namespace foonathan iteration_allocator& operator=(iteration_allocator&& other) noexcept { allocator_type::operator=(detail::move(other)); - block_ = other.block_; - cur_ = other.cur_; + block_ = other.block_; + cur_ = other.cur_; for (auto i = 0u; i != N; ++i) stacks_[i] = detail::move(other.stacks_[i]); diff --git a/include/foonathan/memory/joint_allocator.hpp b/include/foonathan/memory/joint_allocator.hpp index 9028278..377bc81 100644 --- a/include/foonathan/memory/joint_allocator.hpp +++ b/include/foonathan/memory/joint_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_JOINT_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_JOINT_ALLOCATOR_HPP_INCLUDED @@ -515,7 +514,7 @@ namespace foonathan { } - joint_allocator(const joint_allocator& other) noexcept = default; + joint_allocator(const joint_allocator& other) noexcept = default; joint_allocator& operator=(const joint_allocator& other) noexcept = default; /// \effects Allocates a node with given properties. @@ -709,7 +708,7 @@ namespace foonathan } joint_array& operator=(const joint_array&) = delete; - joint_array& operator=(joint_array&&) = delete; + joint_array& operator=(joint_array&&) = delete; //=== accessors ===// /// @{ @@ -810,7 +809,7 @@ namespace foonathan stack_->unwind(objects_); } - builder(builder&&) = delete; + builder(builder&&) = delete; builder& operator=(builder&&) = delete; template diff --git a/include/foonathan/memory/malloc_allocator.hpp b/include/foonathan/memory/malloc_allocator.hpp index 01c4945..ef8a1b0 100644 --- a/include/foonathan/memory/malloc_allocator.hpp +++ b/include/foonathan/memory/malloc_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_MALLOC_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_MALLOC_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/memory_arena.hpp b/include/foonathan/memory/memory_arena.hpp index d246bdc..4c277d8 100644 --- a/include/foonathan/memory/memory_arena.hpp +++ b/include/foonathan/memory/memory_arena.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_MEMORY_ARENA_HPP_INCLUDED #define FOONATHAN_MEMORY_MEMORY_ARENA_HPP_INCLUDED @@ -548,7 +547,7 @@ namespace foonathan if (block_size_) { auto mem = traits::allocate_array(get_allocator(), block_size_, 1, - detail::max_alignment); + detail::max_alignment); memory_block block(mem, block_size_); block_size_ = 0u; return block; diff --git a/include/foonathan/memory/memory_pool.hpp b/include/foonathan/memory/memory_pool.hpp index bc2c559..d764365 100644 --- a/include/foonathan/memory/memory_pool.hpp +++ b/include/foonathan/memory/memory_pool.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_MEMORY_POOL_HPP_INCLUDED #define FOONATHAN_MEMORY_MEMORY_POOL_HPP_INCLUDED @@ -103,8 +102,8 @@ namespace foonathan memory_pool& operator=(memory_pool&& other) noexcept { leak_checker::operator=(detail::move(other)); - arena_ = detail::move(other.arena_); - free_list_ = detail::move(other.free_list_); + arena_ = detail::move(other.arena_); + free_list_ = detail::move(other.free_list_); return *this; } /// @} diff --git a/include/foonathan/memory/memory_pool_collection.hpp b/include/foonathan/memory/memory_pool_collection.hpp index 2e14999..401d2d5 100644 --- a/include/foonathan/memory/memory_pool_collection.hpp +++ b/include/foonathan/memory/memory_pool_collection.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_MEMORY_POOL_COLLECTION_HPP_INCLUDED #define FOONATHAN_MEMORY_MEMORY_POOL_COLLECTION_HPP_INCLUDED @@ -107,9 +106,9 @@ namespace foonathan memory_pool_collection& operator=(memory_pool_collection&& other) noexcept { leak_checker::operator=(detail::move(other)); - arena_ = detail::move(other.arena_); - stack_ = detail::move(other.stack_); - pools_ = detail::move(other.pools_); + arena_ = detail::move(other.arena_); + stack_ = detail::move(other.stack_); + pools_ = detail::move(other.pools_); return *this; } /// @} diff --git a/include/foonathan/memory/memory_pool_type.hpp b/include/foonathan/memory/memory_pool_type.hpp index ad5c143..714edea 100644 --- a/include/foonathan/memory/memory_pool_type.hpp +++ b/include/foonathan/memory/memory_pool_type.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_MEMORY_POOL_TYPE_HPP_INCLUDED #define FOONATHAN_MEMORY_MEMORY_POOL_TYPE_HPP_INCLUDED diff --git a/include/foonathan/memory/memory_resource_adapter.hpp b/include/foonathan/memory/memory_resource_adapter.hpp index 0268fd7..7ff48f1 100644 --- a/include/foonathan/memory/memory_resource_adapter.hpp +++ b/include/foonathan/memory/memory_resource_adapter.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_MEMORY_RESOURCE_ADAPTER_HPP_INCLUDED #define FOONATHAN_MEMORY_MEMORY_RESOURCE_ADAPTER_HPP_INCLUDED diff --git a/include/foonathan/memory/memory_stack.hpp b/include/foonathan/memory/memory_stack.hpp index 9e86a79..b3dcd0f 100644 --- a/include/foonathan/memory/memory_stack.hpp +++ b/include/foonathan/memory/memory_stack.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_MEMORY_STACK_HPP_INCLUDED #define FOONATHAN_MEMORY_MEMORY_STACK_HPP_INCLUDED @@ -203,7 +202,8 @@ namespace foonathan arena_.deallocate_block(); detail::debug_check_pointer( - [&] { + [&] + { auto cur = arena_.current_block(); return m.end == static_cast(cur.memory) + cur.size; }, diff --git a/include/foonathan/memory/namespace_alias.hpp b/include/foonathan/memory/namespace_alias.hpp index cdb4648..a3e0354 100644 --- a/include/foonathan/memory/namespace_alias.hpp +++ b/include/foonathan/memory/namespace_alias.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_NAMESPACE_ALIAS_HPP_INCLUDED #define FOONATHAN_MEMORY_NAMESPACE_ALIAS_HPP_INCLUDED diff --git a/include/foonathan/memory/new_allocator.hpp b/include/foonathan/memory/new_allocator.hpp index ef67192..61fb5db 100644 --- a/include/foonathan/memory/new_allocator.hpp +++ b/include/foonathan/memory/new_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_NEW_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_NEW_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/segregator.hpp b/include/foonathan/memory/segregator.hpp index 8875582..80e066b 100644 --- a/include/foonathan/memory/segregator.hpp +++ b/include/foonathan/memory/segregator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_SEGREGATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_SEGREGATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/smart_ptr.hpp b/include/foonathan/memory/smart_ptr.hpp index e64b261..d5fad10 100644 --- a/include/foonathan/memory/smart_ptr.hpp +++ b/include/foonathan/memory/smart_ptr.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_SMART_PTR_HPP_INCLUDED #define FOONATHAN_MEMORY_SMART_PTR_HPP_INCLUDED diff --git a/include/foonathan/memory/static_allocator.hpp b/include/foonathan/memory/static_allocator.hpp index ca736a8..17552b4 100644 --- a/include/foonathan/memory/static_allocator.hpp +++ b/include/foonathan/memory/static_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_STATIC_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_STATIC_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/std_allocator.hpp b/include/foonathan/memory/std_allocator.hpp index 8af7554..e865915 100644 --- a/include/foonathan/memory/std_allocator.hpp +++ b/include/foonathan/memory/std_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_STD_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_STD_ALLOCATOR_HPP_INCLUDED @@ -134,7 +133,8 @@ namespace foonathan // MSVC seems to ignore access rights in decltype SFINAE below // use this to prevent this constructor being chosen instead of move/copy for types inheriting from it FOONATHAN_REQUIRES((!std::is_base_of::value))> - std_allocator(RawAlloc& alloc, FOONATHAN_SFINAE(alloc_reference(std::declval()))) noexcept + std_allocator(RawAlloc& alloc, + FOONATHAN_SFINAE(alloc_reference(std::declval()))) noexcept : alloc_reference(alloc) { } @@ -149,7 +149,8 @@ namespace foonathan // MSVC seems to ignore access rights in decltype SFINAE below // use this to prevent this constructor being chosen instead of move/copy for types inheriting from it FOONATHAN_REQUIRES((!std::is_base_of::value))> - std_allocator(const RawAlloc& alloc, FOONATHAN_SFINAE(alloc_reference(std::declval()))) noexcept + std_allocator(const RawAlloc& alloc, FOONATHAN_SFINAE(alloc_reference( + std::declval()))) noexcept : alloc_reference(alloc) { } diff --git a/include/foonathan/memory/temporary_allocator.hpp b/include/foonathan/memory/temporary_allocator.hpp index 4c8740b..3b6269d 100644 --- a/include/foonathan/memory/temporary_allocator.hpp +++ b/include/foonathan/memory/temporary_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_TEMPORARY_ALLOCATOR_HPP_INCLUDED #define FOONATHAN_MEMORY_TEMPORARY_ALLOCATOR_HPP_INCLUDED @@ -195,7 +194,7 @@ namespace foonathan /// \effects Destroys the per-thread stack if it isn't already destroyed. ~temporary_stack_initializer() noexcept; - temporary_stack_initializer(temporary_stack_initializer&&) = delete; + temporary_stack_initializer(temporary_stack_initializer&&) = delete; temporary_stack_initializer& operator=(temporary_stack_initializer&&) = delete; }; @@ -229,7 +228,7 @@ namespace foonathan ~temporary_allocator() noexcept; - temporary_allocator(temporary_allocator&&) = delete; + temporary_allocator(temporary_allocator&&) = delete; temporary_allocator& operator=(temporary_allocator&&) = delete; /// \effects Allocates memory from the internal \ref memory_stack by forwarding to it. diff --git a/include/foonathan/memory/threading.hpp b/include/foonathan/memory/threading.hpp index bb1730d..4cf507c 100644 --- a/include/foonathan/memory/threading.hpp +++ b/include/foonathan/memory/threading.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_THREADING_HPP_INCLUDED #define FOONATHAN_MEMORY_THREADING_HPP_INCLUDED diff --git a/include/foonathan/memory/tracking.hpp b/include/foonathan/memory/tracking.hpp index b5ab261..57fb0d1 100644 --- a/include/foonathan/memory/tracking.hpp +++ b/include/foonathan/memory/tracking.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_TRACKING_HPP_INCLUDED #define FOONATHAN_MEMORY_TRACKING_HPP_INCLUDED diff --git a/include/foonathan/memory/virtual_memory.hpp b/include/foonathan/memory/virtual_memory.hpp index e0db0fe..68705e9 100644 --- a/include/foonathan/memory/virtual_memory.hpp +++ b/include/foonathan/memory/virtual_memory.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_VIRTUAL_MEMORY_HPP_INCLUDED #define FOONATHAN_MEMORY_VIRTUAL_MEMORY_HPP_INCLUDED diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c09cc10..7b26572 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,5 @@ -# Copyright (C) 2015-2021 Müller -# 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 # builds actual library diff --git a/src/config.hpp.in b/src/config.hpp.in index af65f09..b541a57 100644 --- a/src/config.hpp.in +++ b/src/config.hpp.in @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2020 Jonathan Müller -// 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 FOONATHAN_MEMORY_IMPL_IN_CONFIG_HPP #error "do not include this file directly, use config.hpp" diff --git a/src/debugging.cpp b/src/debugging.cpp index e44109a..d7caa56 100644 --- a/src/debugging.cpp +++ b/src/debugging.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "debugging.hpp" diff --git a/src/detail/align.cpp b/src/detail/align.cpp index 8c34d87..79258ef 100644 --- a/src/detail/align.cpp +++ b/src/detail/align.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/align.hpp" diff --git a/src/detail/assert.cpp b/src/detail/assert.cpp index 6fff3fe..91ddd2e 100644 --- a/src/detail/assert.cpp +++ b/src/detail/assert.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/assert.hpp" diff --git a/src/detail/debug_helpers.cpp b/src/detail/debug_helpers.cpp index 47ce6ab..65b998a 100644 --- a/src/detail/debug_helpers.cpp +++ b/src/detail/debug_helpers.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/debug_helpers.hpp" diff --git a/src/detail/free_list.cpp b/src/detail/free_list.cpp index 935bfb5..ebf494c 100644 --- a/src/detail/free_list.cpp +++ b/src/detail/free_list.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/free_list.hpp" diff --git a/src/detail/free_list_array.cpp b/src/detail/free_list_array.cpp index 48d347b..907f795 100644 --- a/src/detail/free_list_array.cpp +++ b/src/detail/free_list_array.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/free_list_array.hpp" diff --git a/src/detail/free_list_utils.hpp b/src/detail/free_list_utils.hpp index a9ca851..bffee4d 100644 --- a/src/detail/free_list_utils.hpp +++ b/src/detail/free_list_utils.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_SRC_DETAIL_FREE_LIST_UTILS_HPP_INCLUDED #define FOONATHAN_MEMORY_SRC_DETAIL_FREE_LIST_UTILS_HPP_INCLUDED diff --git a/src/detail/small_free_list.cpp b/src/detail/small_free_list.cpp index b20dedf..1967b74 100644 --- a/src/detail/small_free_list.cpp +++ b/src/detail/small_free_list.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/small_free_list.hpp" diff --git a/src/error.cpp b/src/error.cpp index dfd8add..53adece 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "error.hpp" diff --git a/src/heap_allocator.cpp b/src/heap_allocator.cpp index cd77d9a..81c91d4 100644 --- a/src/heap_allocator.cpp +++ b/src/heap_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "heap_allocator.hpp" diff --git a/src/iteration_allocator.cpp b/src/iteration_allocator.cpp index 597c302..06194e8 100644 --- a/src/iteration_allocator.cpp +++ b/src/iteration_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "iteration_allocator.hpp" diff --git a/src/malloc_allocator.cpp b/src/malloc_allocator.cpp index a64311d..8e70c03 100644 --- a/src/malloc_allocator.cpp +++ b/src/malloc_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "config.hpp" #if FOONATHAN_HOSTED_IMPLEMENTATION diff --git a/src/memory_arena.cpp b/src/memory_arena.cpp index 1d5e260..e2c17d5 100644 --- a/src/memory_arena.cpp +++ b/src/memory_arena.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_arena.hpp" diff --git a/src/memory_pool.cpp b/src/memory_pool.cpp index 6154980..0159f5d 100644 --- a/src/memory_pool.cpp +++ b/src/memory_pool.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_pool.hpp" diff --git a/src/memory_pool_collection.cpp b/src/memory_pool_collection.cpp index 28e6fae..bd04746 100644 --- a/src/memory_pool_collection.cpp +++ b/src/memory_pool_collection.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_pool_collection.hpp" diff --git a/src/memory_stack.cpp b/src/memory_stack.cpp index 211da5e..36a6c73 100644 --- a/src/memory_stack.cpp +++ b/src/memory_stack.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_stack.hpp" diff --git a/src/new_allocator.cpp b/src/new_allocator.cpp index b755a86..80dcc3f 100644 --- a/src/new_allocator.cpp +++ b/src/new_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "new_allocator.hpp" diff --git a/src/static_allocator.cpp b/src/static_allocator.cpp index 98ec1ec..b309d29 100644 --- a/src/static_allocator.cpp +++ b/src/static_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "static_allocator.hpp" @@ -38,9 +37,9 @@ memory_block static_block_allocator::allocate_block() void static_block_allocator::deallocate_block(memory_block block) noexcept { - detail:: - debug_check_pointer([&] { return static_cast(block.memory) + block.size == cur_; }, - info(), block.memory); + detail::debug_check_pointer([&] + { return static_cast(block.memory) + block.size == cur_; }, + info(), block.memory); cur_ -= block_size_; } diff --git a/src/temporary_allocator.cpp b/src/temporary_allocator.cpp index a29fab6..2101c5f 100644 --- a/src/temporary_allocator.cpp +++ b/src/temporary_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "temporary_allocator.hpp" diff --git a/src/virtual_memory.cpp b/src/virtual_memory.cpp index 5e42d28..7cc7a6d 100644 --- a/src/virtual_memory.cpp +++ b/src/virtual_memory.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "virtual_memory.hpp" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 22f6056..37359ea 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,5 @@ -# Copyright (C) 2015-2021 Müller -# 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 # builds test diff --git a/test/aligned_allocator.cpp b/test/aligned_allocator.cpp index 350a11b..125ae70 100644 --- a/test/aligned_allocator.cpp +++ b/test/aligned_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "aligned_allocator.hpp" diff --git a/test/allocator_traits.cpp b/test/allocator_traits.cpp index b225724..1b66b1b 100644 --- a/test/allocator_traits.cpp +++ b/test/allocator_traits.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "allocator_traits.hpp" diff --git a/test/benchmark.hpp b/test/benchmark.hpp index 90763e1..1346329 100644 --- a/test/benchmark.hpp +++ b/test/benchmark.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_TEST_BENCHMARK_HPP_INCLUDED #define FOONATHAN_MEMORY_TEST_BENCHMARK_HPP_INCLUDED @@ -51,27 +50,32 @@ struct single std::size_t operator()(RawAllocator& alloc, std::size_t size) { using namespace foonathan::memory; - return measure([&]() { - for (std::size_t i = 0u; i != count; ++i) + return measure( + [&]() { - volatile auto ptr = allocator_traits::allocate_node(alloc, size, 1); - allocator_traits::deallocate_node(alloc, ptr, size, 1); - } - }); + for (std::size_t i = 0u; i != count; ++i) + { + volatile auto ptr = + allocator_traits::allocate_node(alloc, size, 1); + allocator_traits::deallocate_node(alloc, ptr, size, 1); + } + }); } template std::size_t operator()(RawAllocator& alloc, std::size_t array_size, std::size_t node_size) { - return measure([&]() { - for (std::size_t i = 0u; i != count; ++i) + return measure( + [&]() { - auto ptr = - allocator_traits::allocate_array(alloc, array_size, node_size, 1); - allocator_traits::deallocate_array(alloc, ptr, array_size, node_size, - 1); - } - }); + for (std::size_t i = 0u; i != count; ++i) + { + auto ptr = allocator_traits::allocate_array(alloc, array_size, + node_size, 1); + allocator_traits::deallocate_array(alloc, ptr, array_size, + node_size, 1); + } + }); } static const char* name() @@ -97,15 +101,20 @@ struct basic_bulk std::vector ptrs; ptrs.reserve(count); - auto alloc_t = measure([&]() { - for (std::size_t i = 0u; i != count; ++i) - ptrs.push_back(allocator_traits::allocate_node(alloc, node_size, 1)); - }); + auto alloc_t = measure( + [&]() + { + for (std::size_t i = 0u; i != count; ++i) + ptrs.push_back( + allocator_traits::allocate_node(alloc, node_size, 1)); + }); func(ptrs); - auto dealloc_t = measure([&]() { - for (auto ptr : ptrs) - allocator_traits::deallocate_node(alloc, ptr, node_size, 1); - }); + auto dealloc_t = measure( + [&]() + { + for (auto ptr : ptrs) + allocator_traits::deallocate_node(alloc, ptr, node_size, 1); + }); return alloc_t + dealloc_t; } @@ -117,17 +126,21 @@ struct basic_bulk std::vector ptrs; ptrs.reserve(count); - auto alloc_t = measure([&]() { - for (std::size_t i = 0u; i != count; ++i) - ptrs.push_back(allocator_traits::allocate_array(alloc, array_size, - node_size, 1)); - }); + auto alloc_t = measure( + [&]() + { + for (std::size_t i = 0u; i != count; ++i) + ptrs.push_back(allocator_traits::allocate_array(alloc, array_size, + node_size, 1)); + }); func(ptrs); - auto dealloc_t = measure([&]() { - for (auto ptr : ptrs) - allocator_traits::deallocate_array(alloc, ptr, array_size, node_size, - 1); - }); + auto dealloc_t = measure( + [&]() + { + for (auto ptr : ptrs) + allocator_traits::deallocate_array(alloc, ptr, array_size, + node_size, 1); + }); return alloc_t + dealloc_t; } }; @@ -158,8 +171,8 @@ struct bulk_reversed : basic_bulk struct butterfly : basic_bulk { butterfly(std::size_t c) - : basic_bulk([](std::vector& - ptrs) { std::shuffle(ptrs.begin(), ptrs.end(), std::mt19937{}); }, + : basic_bulk([](std::vector& ptrs) + { std::shuffle(ptrs.begin(), ptrs.end(), std::mt19937{}); }, c) { } diff --git a/test/default_allocator.cpp b/test/default_allocator.cpp index 10f3959..bdf7d53 100644 --- a/test/default_allocator.cpp +++ b/test/default_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 // tests all possible default allocator classes diff --git a/test/detail/align.cpp b/test/detail/align.cpp index 7bb2e8e..9ad7c84 100644 --- a/test/detail/align.cpp +++ b/test/detail/align.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/align.hpp" diff --git a/test/detail/debug_helpers.cpp b/test/detail/debug_helpers.cpp index 48ce6ef..847f5c3 100644 --- a/test/detail/debug_helpers.cpp +++ b/test/detail/debug_helpers.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/debug_helpers.hpp" diff --git a/test/detail/free_list.cpp b/test/detail/free_list.cpp index a1beb94..f7f7e41 100644 --- a/test/detail/free_list.cpp +++ b/test/detail/free_list.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/free_list.hpp" #include "detail/small_free_list.hpp" diff --git a/test/detail/free_list_array.cpp b/test/detail/free_list_array.cpp index ef35205..0e14f20 100644 --- a/test/detail/free_list_array.cpp +++ b/test/detail/free_list_array.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/free_list_array.hpp" diff --git a/test/detail/ilog2.cpp b/test/detail/ilog2.cpp index 816ad8c..584f644 100644 --- a/test/detail/ilog2.cpp +++ b/test/detail/ilog2.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/ilog2.hpp" diff --git a/test/detail/memory_stack.cpp b/test/detail/memory_stack.cpp index fdf6e8f..da1ffc7 100644 --- a/test/detail/memory_stack.cpp +++ b/test/detail/memory_stack.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "detail/memory_stack.hpp" diff --git a/test/fallback_allocator.cpp b/test/fallback_allocator.cpp index aeaff5b..d3278a5 100644 --- a/test/fallback_allocator.cpp +++ b/test/fallback_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "fallback_allocator.hpp" diff --git a/test/iteration_allocator.cpp b/test/iteration_allocator.cpp index 93ce93f..f5a80d8 100644 --- a/test/iteration_allocator.cpp +++ b/test/iteration_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "iteration_allocator.hpp" diff --git a/test/joint_allocator.cpp b/test/joint_allocator.cpp index 3b588be..5c3f4a2 100644 --- a/test/joint_allocator.cpp +++ b/test/joint_allocator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "joint_allocator.hpp" diff --git a/test/memory_arena.cpp b/test/memory_arena.cpp index 203f3f5..01ee931 100644 --- a/test/memory_arena.cpp +++ b/test/memory_arena.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_arena.hpp" diff --git a/test/memory_pool.cpp b/test/memory_pool.cpp index 2abf36c..f043c75 100644 --- a/test/memory_pool.cpp +++ b/test/memory_pool.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_pool.hpp" diff --git a/test/memory_pool_collection.cpp b/test/memory_pool_collection.cpp index b3a06b5..73bc81c 100644 --- a/test/memory_pool_collection.cpp +++ b/test/memory_pool_collection.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_pool_collection.hpp" diff --git a/test/memory_resource_adapter.cpp b/test/memory_resource_adapter.cpp index 1e5d110..4f01f8b 100644 --- a/test/memory_resource_adapter.cpp +++ b/test/memory_resource_adapter.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_resource_adapter.hpp" diff --git a/test/memory_stack.cpp b/test/memory_stack.cpp index c2d614b..e519ab5 100644 --- a/test/memory_stack.cpp +++ b/test/memory_stack.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "memory_stack.hpp" diff --git a/test/profiling.cpp b/test/profiling.cpp index 03463ea..b50db5b 100644 --- a/test/profiling.cpp +++ b/test/profiling.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 // Profiling code to check performance of allocators. @@ -40,15 +39,12 @@ void benchmark_node(std::initializer_list counts, auto heap_alloc = [&] { return heap_allocator{}; }; auto new_alloc = [&] { return new_allocator{}; }; - auto small_alloc = [&] { - return memory_pool(size, count * size + 1024); - }; - auto node_alloc = [&] { - return memory_pool(size, count * std::max(size, sizeof(char*)) + 1024); - }; - auto array_alloc = [&] { - return memory_pool(size, count * std::max(size, sizeof(char*)) + 1024); - }; + auto small_alloc = [&] + { return memory_pool(size, count * size + 1024); }; + auto node_alloc = [&] + { return memory_pool(size, count * std::max(size, sizeof(char*)) + 1024); }; + auto array_alloc = [&] + { return memory_pool(size, count * std::max(size, sizeof(char*)) + 1024); }; auto stack_alloc = [&] { return memory_stack<>(count * size); }; diff --git a/test/segregator.cpp b/test/segregator.cpp index 29e467d..70b3434 100644 --- a/test/segregator.cpp +++ b/test/segregator.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "segregator.hpp" diff --git a/test/smart_ptr.cpp b/test/smart_ptr.cpp index 69ce909..ba98c88 100644 --- a/test/smart_ptr.cpp +++ b/test/smart_ptr.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include "smart_ptr.hpp" diff --git a/test/test.cpp b/test/test.cpp index 852c722..4319e6f 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include diff --git a/test/test_allocator.hpp b/test/test_allocator.hpp index 491e663..df17666 100644 --- a/test/test_allocator.hpp +++ b/test/test_allocator.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_TEST_TEST_ALLOCATOR_HPP #define FOONATHAN_MEMORY_TEST_TEST_ALLOCATOR_HPP diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index df51586..a7a650e 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -1,6 +1,5 @@ -# Copyright (C) 2015-2021 Müller -# 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 # builds tools diff --git a/tool/node_size_debugger.cpp b/tool/node_size_debugger.cpp index d9b4f97..917fb3f 100644 --- a/tool/node_size_debugger.cpp +++ b/tool/node_size_debugger.cpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 #include #include diff --git a/tool/node_size_debugger.hpp b/tool/node_size_debugger.hpp index a1ecc8b..a9db2ce 100644 --- a/tool/node_size_debugger.hpp +++ b/tool/node_size_debugger.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_TOOL_NODE_SIZE_DEBUGGER_HPP #define FOONATHAN_MEMORY_TOOL_NODE_SIZE_DEBUGGER_HPP diff --git a/tool/test_types.hpp b/tool/test_types.hpp index 2bfb3f6..c2c50c7 100644 --- a/tool/test_types.hpp +++ b/tool/test_types.hpp @@ -1,6 +1,5 @@ -// Copyright (C) 2015-2021 Müller -// 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 FOONATHAN_MEMORY_TOOL_TEST_TYPES_HPP_INCLUDED #define FOONATHAN_MEMORY_TOOL_TEST_TYPES_HPP_INCLUDED From db83455453c20d696bf47f89a77244edcb9251e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:04:42 +0100 Subject: [PATCH 11/19] Update documentation for node size traits Fixes #150. --- include/foonathan/memory/container.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/foonathan/memory/container.hpp b/include/foonathan/memory/container.hpp index bf22e6f..5c77ddb 100644 --- a/include/foonathan/memory/container.hpp +++ b/include/foonathan/memory/container.hpp @@ -275,8 +275,9 @@ namespace foonathan /// @{ /// 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 struct forward_list_node_size : std::integral_constant { @@ -313,25 +314,30 @@ namespace foonathan { }; - /// \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`. template struct map_node_size : std::integral_constant { }; - /// \copydoc forward_list_node_size + /// \copydoc map_node_size template struct multimap_node_size : std::integral_constant { }; - /// \copydoc forward_list_node_size + /// \copydoc map_node_size template struct unordered_map_node_size : std::integral_constant { }; - /// \copydoc forward_list_node_size + /// \copydoc map_node_size template struct unordered_multimap_node_size : std::integral_constant From 6eaa58e423cd667b3a543d57cc10c649615bb709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:15:21 +0100 Subject: [PATCH 12/19] Fix `memory_block_stack::owns()` Fixes #151. --- src/memory_arena.cpp | 2 +- test/memory_arena.cpp | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/memory_arena.cpp b/src/memory_arena.cpp index e2c17d5..44edd1a 100644 --- a/src/memory_arena.cpp +++ b/src/memory_arena.cpp @@ -41,7 +41,7 @@ bool memory_block_stack::owns(const void* ptr) const noexcept auto address = static_cast(ptr); for (auto cur = head_; cur; cur = cur->prev) { - auto mem = static_cast(static_cast(cur)); + auto mem = static_cast(static_cast(cur)) + implementation_offset(); if (address >= mem && address < mem + cur->usable_size) return true; } diff --git a/test/memory_arena.cpp b/test/memory_arena.cpp index 01ee931..a054963 100644 --- a/test/memory_arena.cpp +++ b/test/memory_arena.cpp @@ -21,9 +21,13 @@ TEST_CASE("detail::memory_block_stack") REQUIRE(!stack.empty()); auto top = stack.top(); - REQUIRE(top.memory >= static_cast(&memory)); - REQUIRE(top.size <= 1024); + REQUIRE(top.memory + == reinterpret_cast(&memory) + memory_block_stack::implementation_offset()); + REQUIRE(top.size == 1024 - memory_block_stack::implementation_offset()); REQUIRE(is_aligned(top.memory, max_alignment)); + REQUIRE(!stack.owns(&memory)); + REQUIRE(stack.owns(top.memory)); + REQUIRE(stack.owns(static_cast(top.memory) + top.size - 1)); SUBCASE("pop") { @@ -50,6 +54,19 @@ TEST_CASE("detail::memory_block_stack") stack.push({&b, 1024}); stack.push({&c, 1024}); + REQUIRE(!stack.owns(&a)); + REQUIRE(stack.owns(reinterpret_cast(&a) + memory_block_stack::implementation_offset())); + REQUIRE(stack.owns(reinterpret_cast(&a) + 1024 + - memory_block_stack::implementation_offset() - 1)); + REQUIRE(!stack.owns(&b)); + REQUIRE(stack.owns(reinterpret_cast(&b) + memory_block_stack::implementation_offset())); + REQUIRE(stack.owns(reinterpret_cast(&b) + 1024 + - memory_block_stack::implementation_offset() - 1)); + REQUIRE(!stack.owns(&c)); + REQUIRE(stack.owns(reinterpret_cast(&c) + memory_block_stack::implementation_offset())); + REQUIRE(stack.owns(reinterpret_cast(&c) + 1024 + - memory_block_stack::implementation_offset() - 1)); + SUBCASE("multiple pop") { auto block = stack.pop(); From 9d3bda191af5d765febc393cbc163e9f8aea131f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:25:38 +0100 Subject: [PATCH 13/19] Throw an exception if `max_node_size` is too big for `block_size` of `memory_pool_collection` Fixes #145. --- include/foonathan/memory/memory_pool_collection.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/foonathan/memory/memory_pool_collection.hpp b/include/foonathan/memory/memory_pool_collection.hpp index 401d2d5..e6952e9 100644 --- a/include/foonathan/memory/memory_pool_collection.hpp +++ b/include/foonathan/memory/memory_pool_collection.hpp @@ -75,8 +75,7 @@ namespace foonathan /// the size of the initial memory block and other constructor arguments for the \concept{concept_blockallocator,BlockAllocator}. /// The \c BucketDistribution controls how many free lists are created, /// but unlike in \ref memory_pool all free lists are initially empty and the first memory block queued. - /// \requires \c max_node_size must be a valid \concept{concept_node,node} size - /// and \c block_size must be non-zero. + /// \requires \c block_size must be non-zero and \c max_node_size must be a valid \concept{concept_node,node} size and smaller than \c block_size divided by the number of pools. template memory_pool_collection(std::size_t max_node_size, std::size_t block_size, Args&&... args) @@ -84,6 +83,7 @@ namespace foonathan stack_(allocate_block()), pools_(stack_, block_end(), max_node_size) { + detail::check_allocation_size(max_node_size, def_capacity(), info()); } /// \effects Destroys the \ref memory_pool_collection by returning all memory blocks, From 385ff2261aabcc46259689ad19510d8fbd31e461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:31:47 +0100 Subject: [PATCH 14/19] Exclude build folder in doxygen --- doc/Doxyfile | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Doxyfile b/doc/Doxyfile index 0724181..181ffd8 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -930,6 +930,7 @@ EXCLUDE = src/ \ test/ \ example/ \ cmake/ \ + build/ \ README.md # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or From ac198bd27212b6cd8a81d333157916bdc3d5eda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:32:27 +0100 Subject: [PATCH 15/19] Update doxygen configuration file --- doc/Doxyfile | 260 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 179 insertions(+), 81 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 181ffd8..ac5a896 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.9.2 +# Doxyfile 1.9.6 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -12,6 +12,16 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options @@ -60,16 +70,28 @@ PROJECT_LOGO = OUTPUT_DIRECTORY = doc/ -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes -# performance problems for the file system. +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode @@ -81,14 +103,14 @@ ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English @@ -460,7 +482,7 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 2 -# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use # during processing. When set to 0 doxygen will based this on the number of # cores available in the system. You can set it explicitly to a value larger # than 0 to get more control over the balance between CPU load and processing @@ -554,7 +576,8 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = YES @@ -585,14 +608,15 @@ INTERNAL_DOCS = NO # filesystem is case sensitive (i.e. it supports files in the same directory # whose names only differ in casing), the option must be set to YES to properly # deal with such files in case they appear in the input. For filesystems that -# are not case sensitive the option should be be set to NO to properly deal with +# are not case sensitive the option should be set to NO to properly deal with # output files written for symbols that only differ in casing, such as for two # classes, one named CLASS and the other named Class, and to also support # references to files without having to specify the exact matching casing. On # Windows (including Cygwin) and MacOS, users should typically set this option # to NO, whereas on Linux or other Unix flavors it should typically be set to # YES. -# The default value is: system dependent. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. CASE_SENSE_NAMES = NO @@ -844,6 +868,14 @@ WARN_IF_INCOMPLETE_DOC = YES WARN_NO_PARAMDOC = NO +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS # then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but @@ -859,13 +891,27 @@ WARN_AS_ERROR = NO # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = @@ -886,10 +932,21 @@ INPUT = . # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: # https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. @@ -953,7 +1010,7 @@ EXCLUDE_PATTERNS = # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test +# ANamespace::AClass, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* @@ -1001,6 +1058,11 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. @@ -1042,6 +1104,15 @@ FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = doc/index.md +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- @@ -1139,10 +1210,11 @@ VERBATIM_HEADERS = NO ALPHABETICAL_INDEX = YES -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = @@ -1221,7 +1293,12 @@ HTML_STYLESHEET = # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = @@ -1236,6 +1313,19 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a color-wheel, see @@ -1330,6 +1420,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1534,7 +1631,7 @@ GENERATE_TREEVIEW = NO # area (value NO) or if it should extend to the full height of the window (value # YES). Setting this to YES gives a layout similar to # https://docs.readthedocs.io with more room for contents, but less room for the -# project logo, title, and description. If either GENERATOR_TREEVIEW or +# project logo, title, and description. If either GENERATE_TREEVIEW or # DISABLE_INDEX is set to NO, this option has no effect. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1565,6 +1662,13 @@ TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for @@ -1585,17 +1689,6 @@ HTML_FORMULA_FORMAT = png FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - # The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands # to create new LaTeX commands to be used in formulas as building blocks. See # the section "Including formulas" for details. @@ -2186,7 +2279,8 @@ SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the -# preprocessor. +# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of +# RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = @@ -2287,15 +2381,6 @@ EXTERNAL_PAGES = YES # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2328,35 +2413,50 @@ HAVE_DOT = NO DOT_NUM_THREADS = 0 -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. +# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of +# subgraphs. When you want a differently looking font in the dot files that +# doxygen generates you can specify fontname, fontcolor and fontsize attributes. +# For details please see Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" + +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = Helvetica +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTSIZE = 10 +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a +# graph for each documented class showing the direct and indirect inheritance +# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, +# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set +# to TEXT the direct and indirect inheritance relations will be shown as texts / +# links. +# Possible values are: NO, YES, TEXT and GRAPH. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES @@ -2370,7 +2470,8 @@ CLASS_GRAPH = YES COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. +# groups, showing the direct groups dependencies. See also the chapter Grouping +# in the manual. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2485,6 +2586,13 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: @@ -2538,10 +2646,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2579,18 +2687,6 @@ DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support @@ -2603,6 +2699,8 @@ DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. From 5e7530b3a2b12dfbd50e8b3edfb36e1536ecf0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:33:53 +0100 Subject: [PATCH 16/19] Remove duplicate declaration of `shared_ptr_node_size` --- include/foonathan/memory/smart_ptr.hpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/include/foonathan/memory/smart_ptr.hpp b/include/foonathan/memory/smart_ptr.hpp index d5fad10..9964495 100644 --- a/include/foonathan/memory/smart_ptr.hpp +++ b/include/foonathan/memory/smart_ptr.hpp @@ -191,18 +191,6 @@ namespace foonathan detail::forward(alloc)), detail::forward(args)...); } - -#if !defined(DOXYGEN) -#include "detail/container_node_sizes.hpp" -#else - /// Contains the node size needed for a `std::shared_ptr`. - /// These classes are auto-generated and only available if the tools are build and without cross-compiling. - /// \ingroup adapter - template - struct shared_ptr_node_size : std::integral_constant - { - }; -#endif } // namespace memory } // namespace foonathan From 3edafbad46a6089ccf72bb5cb07b42d0262ecb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:37:37 +0100 Subject: [PATCH 17/19] Fix broken documentation links --- doc/concepts.md | 3 ++- include/foonathan/memory/config.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/concepts.md b/doc/concepts.md index 629bf40..6546b1a 100644 --- a/doc/concepts.md +++ b/doc/concepts.md @@ -160,6 +160,7 @@ i.e. allocate memory through the traits and deallocate through the member functi It is completely allowed that those functions do completely different things. ### Composable RawAllocator + A RawAllocator can be *composable*. Access to the composable (de)allocation functions is only done through the [composable_allocator_traits]. @@ -363,7 +364,7 @@ Expression|Semantics *Note*: Those tracking functions are also called after a succesful composable (de)allocation function. -A *deep tracker* also tracks a [BlockAllocator](#concept_block_allocator) of another allocator +A *deep tracker* also tracks a [BlockAllocator](#concept_blockallocator) of another allocator and thus allows monitoring the often more expensive big allocations done by it. Such a `Tracker` must provide the following additional functions: diff --git a/include/foonathan/memory/config.hpp b/include/foonathan/memory/config.hpp index 5156fac..233caf6 100644 --- a/include/foonathan/memory/config.hpp +++ b/include/foonathan/memory/config.hpp @@ -139,7 +139,7 @@ /// Set to `1` to disable automatic lifetime managment of the per-thread stack, /// requires managing it through the \ref foonathan::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 foonathan::memory::get_temporary_stack() will abort the program upon call. /// \ingroup allocator #define FOONATHAN_MEMORY_TEMPORARY_STACK_MODE 2 #endif From f191eb0258175ff0ea0305a2f9e5d8e0a691d76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:38:13 +0100 Subject: [PATCH 18/19] Update publish-docs script --- doc/publish-docs.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/publish-docs.sh b/doc/publish-docs.sh index de1555f..b017951 100755 --- a/doc/publish-docs.sh +++ b/doc/publish-docs.sh @@ -2,9 +2,11 @@ # builds documentation and publishes it # run in root of repository, assumes `git worktree add doc/html gh-pages` +rm -r doc/html/* doxygen doc/Doxyfile +echo "memory.foonathan.net" > doc/html/CNAME cd doc/html git add --all -git commit -am"Update documentation" +git commit -am"Update documentation" --amend git push --force origin gh-pages From 0f0775770fd1c506fa9c5ad566bd6ba59659db66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Jan 2023 12:39:00 +0100 Subject: [PATCH 19/19] Release 0.7-3 --- CHANGELOG.md | 15 +++++++++++++++ CMakeLists.txt | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f340a08..aead972 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Upcoming Changes +# 0.7-3 + +CMake improvements: + +* Increase the CMake minimum required version to 3.14 to reflect reality. (#147) +* Fixes to container node size generation using CMake on MacOS. (#138) +* Don't regenerate container node sizes when they already exist. + +Bugfixes: + +* Workaround a compiler bug in MSVC. (#146) +* Fix broken multi-threading configuration. (#142) +* Check initial block size for `memory_pool_collection` properly. (#148) +* Fix bug in `memory_block_stack::owns()`. (#151) + # 0.7-2 Deprecate `virtual_memory_page_size`; use `get_virtual_memory_page_size()` instead. (#132) diff --git a/CMakeLists.txt b/CMakeLists.txt index e72b6ae..ddbc459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ project(FOONATHAN_MEMORY) set(FOONATHAN_MEMORY_VERSION_MAJOR 0 CACHE STRING "major version of memory" FORCE) set(FOONATHAN_MEMORY_VERSION_MINOR 7 CACHE STRING "minor version of memory" FORCE) -set(FOONATHAN_MEMORY_VERSION_PATCH 2 CACHE STRING "patch version of memory" FORCE) +set(FOONATHAN_MEMORY_VERSION_PATCH 3 CACHE STRING "patch version of memory" FORCE) set(FOONATHAN_MEMORY_VERSION "${FOONATHAN_MEMORY_VERSION_MAJOR}.${FOONATHAN_MEMORY_VERSION_MINOR}.${FOONATHAN_MEMORY_VERSION_PATCH}" CACHE STRING "version of memory" FORCE)