Skip to content

Commit

Permalink
remove concept alias and add doxygen definitions for foonathan memory
Browse files Browse the repository at this point in the history
\concept was added as a doxygen command in 1.9.2 and is meant to be applied to concepts. Inserting them into standard comment paragraphs causes doxygen to interpret the following text as a concept name and add it to the documentation, as well as remove the text from the paragraph.
In the upstream repo, this alias links to markdown documentation, so it's not usable for us anyways.

That, plus adding the doxygen definitions/aliases from upstream cleans up most of the errors/weird output from doxygen for foonathan memory
  • Loading branch information
rzblue committed Aug 22, 2024
1 parent 76fd363 commit 29249ac
Show file tree
Hide file tree
Showing 28 changed files with 1,651 additions and 180 deletions.
18 changes: 15 additions & 3 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,11 @@ TAB_SIZE = 4
# @} or use a double escape (\\{ and \\})

ALIASES = "effects=\par <i>Effects:</i>^^" \
"returns=\par <i>Returns:</i>^^" \
"notes=\par <i>Notes:</i>^^" \
"throws=\par <i>Throws:</i>^^" \
"requires=\par <i>Requires:</i>^^" \
"requiredbe=\par <i>Required Behavior:</i>^^" \
"concept{2}=<a href=\"md_doc_concepts.html#\1\">\2</a>" \
"defaultbe=\par <i>Default Behavior:</i>^^"

# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
Expand Down Expand Up @@ -2443,7 +2444,18 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED = __cplusplus "HAL_ENUM(name)=enum name : int32_t"
PREDEFINED = __cplusplus \
"HAL_ENUM(name)=enum name : int32_t" \
DOXYGEN \
WPI_NOEXCEPT:=noexcept \
WPI_SFINAE(x):= \
WPI_REQUIRES(x):= \
WPI_REQUIRES_RET(...):= \
WPI_ENABLE_IF(...):= \
WPI_CONSTEXPR:=constexpr \
WPI_CONSTEXPR_FNC:=constexpr \
WPI_IMPL_DEFINED(...):=implementation_defined \
WPI_EBO(...):=

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand All @@ -2452,7 +2464,7 @@ PREDEFINED = __cplusplus "HAL_ENUM(name)=enum name : int32_t"
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = WPI_ALIAS_TEMPLATE

# If the SKIP_FUNCTION_MACROS tag is set to YES then Doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ryan Blue <[email protected]>
Date: Wed, 21 Aug 2024 20:50:15 -0400
Subject: [PATCH] Group doxygen into memory module
Subject: [PATCH 1/2] Group doxygen into memory module

---
.../foonathan/memory/aligned_allocator.hpp | 2 +-
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace wpi
{
namespace memory
{
/// A \concept{concept_rawallocator,RawAllocator} adapter that ensures a minimum alignment.
/// A RawAllocator adapter that ensures a minimum alignment.
/// It adjusts the alignment value so that it is always larger than the minimum and forwards to the specified allocator.
/// \ingroup memory_adapter
template <class RawAllocator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ namespace wpi
}
} // namespace detail

/// A \concept{concept_rawallocator,RawAllocator} that stores another allocator.
/// The \concept{concept_storagepolicy,StoragePolicy} defines the allocator type being stored and how it is stored.
/// A RawAllocator that stores another allocator.
/// The StoragePolicy defines the allocator type being stored and how it is stored.
/// The \c Mutex controls synchronization of the access.
/// \ingroup memory_storage
template <class StoragePolicy, class Mutex>
Expand Down Expand Up @@ -322,7 +322,7 @@ namespace wpi
{
};

/// A \concept{concept_storagepolicy,StoragePolicy} that stores the allocator directly.
/// A StoragePolicy that stores the allocator directly.
/// It embeds the allocator inside it, i.e. moving the storage policy will move the allocator.
/// \ingroup memory_storage
template <class RawAllocator>
Expand Down Expand Up @@ -379,7 +379,7 @@ namespace wpi
};

/// An alias template for \ref allocator_storage using the \ref direct_storage policy without a mutex.
/// It has the effect of giving any \concept{concept_rawallocator,RawAllocator} the interface with all member functions,
/// It has the effect of giving any RawAllocator the interface with all member functions,
/// avoiding the need to wrap it inside the \ref allocator_traits.
/// \ingroup memory_storage
template <class RawAllocator>
Expand Down Expand Up @@ -521,7 +521,7 @@ namespace wpi
};
} // namespace detail

/// Specifies whether or not a \concept{concept_rawallocator,RawAllocator} has shared semantics.
/// Specifies whether or not a RawAllocator has shared semantics.
/// It is shared, if - like \ref allocator_reference - if multiple objects refer to the same internal allocator and if it can be copied.
/// This sharing is stateful, however, stateless allocators are not considered shared in the meaning of this traits. <br>
/// If a \c RawAllocator is shared, it will be directly embedded inside \ref reference_storage since it already provides \ref allocator_reference like semantics, so there is no need to add them manually,<br>
Expand All @@ -534,7 +534,7 @@ namespace wpi
{
};

/// A \concept{concept_storagepolicy,StoragePolicy} that stores a reference to an allocator.
/// A StoragePolicy that stores a reference to an allocator.
/// For stateful allocators it only stores a pointer to an allocator object and copying/moving only copies the pointer.
/// For stateless allocators it does not store anything, an allocator will be constructed as needed.
/// For allocators that are already shared (determined through \ref is_shared_allocator) it will store the allocator type directly.
Expand Down Expand Up @@ -711,7 +711,7 @@ namespace wpi
public:
using allocator_type = WPI_IMPL_DEFINED(base_allocator);

/// \effects Creates it from a reference to any stateful \concept{concept_rawallocator,RawAllocator}.
/// \effects Creates it from a reference to any stateful RawAllocator.
/// It will store a pointer to this allocator object.
/// \note The user has to take care that the lifetime of the reference does not exceed the allocator lifetime.
template <class RawAllocator>
Expand All @@ -723,7 +723,7 @@ namespace wpi
::new (static_cast<void*>(&storage_)) basic_allocator<RawAllocator>(alloc);
}

// \effects Creates it from any stateless \concept{concept_rawallocator,RawAllocator}.
// \effects Creates it from any stateless RawAllocator.
/// It will not store anything, only creates the allocator as needed.
/// \requires The \c RawAllocator is stateless.
template <class RawAllocator>
Expand Down Expand Up @@ -771,7 +771,7 @@ namespace wpi

/// \returns A reference to the allocator.
/// The actual type is implementation-defined since it is the base class used in the type-erasure,
/// but it provides the full \concept{concept_rawallocator,RawAllocator} member functions.
/// but it provides the full RawAllocator member functions.
/// \note There is no way to access any custom member functions of the allocator type.
allocator_type& get_allocator() const noexcept
{
Expand Down Expand Up @@ -913,7 +913,7 @@ namespace wpi
using any_reference_storage = reference_storage<any_allocator>;

/// An alias for \ref allocator_storage using the \ref any_reference_storage.
/// It will store a reference to any \concept{concept_rawallocator,RawAllocator}.
/// It will store a reference to any RawAllocator.
/// This is the same as passing the tag type \ref any_allocator to the alias \ref allocator_reference.
/// Wrap the allocator in a \ref thread_safe_allocator if you want thread safety.
/// \ingroup memory_storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace wpi
};
} // namespace detail

/// Traits class that checks whether or not a standard \c Allocator can be used as \concept{concept_rawallocator,RawAllocator}.
/// Traits class that checks whether or not a standard \c Allocator can be used as RawAllocator.
/// It checks the existence of a custom \c construct(), \c destroy() function, if provided,
/// it cannot be used since it would not be called.<br>
/// Specialize it for custom \c Allocator types to override this check.
Expand Down Expand Up @@ -283,7 +283,7 @@ namespace wpi
}
} // namespace traits_detail

/// The default specialization of the allocator_traits for a \concept{concept_rawallocator,RawAllocator}.
/// The default specialization of the allocator_traits for a RawAllocator.
/// See the last link for the requirements on types that do not specialize this class and the interface documentation.
/// Any specialization must provide the same interface.
/// \ingroup memory_core
Expand Down Expand Up @@ -408,7 +408,7 @@ namespace wpi
};
} // namespace detail

/// Traits that check whether a type models concept \concept{concept_rawallocator,RawAllocator}.<br>
/// Traits that check whether a type models concept RawAllocator.<br>
/// It must either provide the necessary functions for the default traits specialization or has specialized it.
/// \ingroup memory_core
template <typename T>
Expand Down Expand Up @@ -491,7 +491,7 @@ namespace wpi
}
} // namespace traits_detail

/// The default specialization of the composable_allocator_traits for a \concept{concept_composableallocator,ComposableAllocator}.
/// The default specialization of the composable_allocator_traits for a ComposableAllocator.
/// See the last link for the requirements on types that do not specialize this class and the interface documentation.
/// Any specialization must provide the same interface.
/// \ingroup memory_core
Expand Down Expand Up @@ -586,8 +586,8 @@ namespace wpi
};
} // namespace detail

/// Traits that check whether a type models concept \concept{concept_rawallocator,ComposableAllocator}.<br>
/// It must be a \concept{concept_rawallocator,RawAllocator} and either provide the necessary functions for the default traits specialization or has specialized it.
/// Traits that check whether a type models concept ComposableAllocator.<br>
/// It must be a RawAllocator and either provide the necessary functions for the default traits specialization or has specialized it.
/// \ingroup memory_core
template <typename T>
struct is_composable_allocator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define WPI_MEMORY_CONTAINER_HPP_INCLUDED

/// \file
/// Aliasas for STL containers using a certain \concept{concept_rawallocator,RawAllocator}.
/// Aliasas for STL containers using a certain RawAllocator.
/// \note Only available on a hosted implementation.

#include "config.hpp"
Expand Down Expand Up @@ -40,7 +40,7 @@ namespace wpi
/// @{

/// Alias template for an STL container that uses a certain
/// \concept{concept_rawallocator,RawAllocator}. It is just a shorthand for a passing in the \c
/// RawAllocator. It is just a shorthand for a passing in the \c
/// RawAllocator wrapped in a \ref wpi::memory::std_allocator.
template <typename T, class RawAllocator>
WPI_ALIAS_TEMPLATE(vector, std::vector<T, std_allocator<T, RawAllocator>>);
Expand Down Expand Up @@ -212,7 +212,7 @@ namespace wpi

/// @{
/// Convenience function to create a container adapter using a certain
/// \concept{concept_rawallocator,RawAllocator}. \returns An empty adapter with an
/// RawAllocator. \returns An empty adapter with an
/// implementation container using a reference to a given allocator. \ingroup memory_adapter
template <typename T, class RawAllocator, class Container = deque<T, RawAllocator>>
std::stack<T, Container> make_stack(RawAllocator& allocator)
Expand Down Expand Up @@ -355,7 +355,7 @@ namespace wpi
#if !defined(WPI_MEMORY_NO_NODE_SIZE)
/// The node size required by \ref allocate_shared.
/// \note This is similar to \ref shared_ptr_node_size but takes a
/// \concept{concept_rawallocator,RawAllocator} instead.
/// RawAllocator instead.
template <typename T, class RawAllocator>
struct allocate_shared_node_size : shared_ptr_node_size<T, std_allocator<T, RawAllocator>>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ namespace wpi
{
namespace memory
{
/// The default \concept{concept_rawallocator,RawAllocator} that will be used as \concept{concept_blockallocator,BlockAllocator} in memory arenas.
/// The default RawAllocator that will be used as BlockAllocator in memory arenas.
/// Arena allocators like \ref memory_stack or \ref memory_pool allocate memory by subdividing a huge block.
/// They get a \concept{concept_blockallocator,BlockAllocator} that will be used for their internal allocation,
/// They get a BlockAllocator that will be used for their internal allocation,
/// this type is the default value.
/// \requiredbe Its type can be changed via the CMake option \c WPI_MEMORY_DEFAULT_ALLCOATOR,
/// but it must be one of the following: \ref heap_allocator, \ref new_allocator, \ref malloc_allocator, \ref static_allocator, \ref virtual_memory_allocator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define WPI_MEMORY_DELETER_HPP_INCLUDED

/// \file
/// \c Deleter classes using a \concept{concept_rawallocator,RawAllocator}.
/// \c Deleter classes using a RawAllocator.

#include <type_traits>

Expand All @@ -17,7 +17,7 @@ namespace wpi
{
namespace memory
{
/// A deleter class that deallocates the memory through a specified \concept{concept_rawallocator,RawAllocator}.
/// A deleter class that deallocates the memory through a specified RawAllocator.
///
/// It deallocates memory for a specified type but does not call its destructors.
/// \ingroup memory_adapter
Expand Down Expand Up @@ -116,7 +116,7 @@ namespace wpi
std::size_t size_;
};

/// A deleter class that deallocates the memory of a derived type through a specified \concept{concept_rawallocator,RawAllocator}.
/// A deleter class that deallocates the memory of a derived type through a specified RawAllocator.
///
/// It can only be created from a \ref allocator_deallocator and thus must only be used for smart pointers initialized by derived-to-base conversion of the pointer.
/// \ingroup memory_adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ namespace wpi
{
namespace memory
{
/// A \concept{raw_allocator,RawAllocator} with a fallback.
/// A RawAllocator with a fallback.
/// Allocation first tries `Default`, if it fails,
/// it uses `Fallback`.
/// \requires `Default` must be a composable \concept{concept_rawallocator,RawAllocator},
/// `Fallback` must be a \concept{concept_rawallocator,RawAllocator}.
/// \requires `Default` must be a composable RawAllocator,
/// `Fallback` must be a RawAllocator.
/// \ingroup memory_adapter
template <class Default, class Fallback>
class fallback_allocator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace wpi
heap_alloator_leak_checker)
} // namespace detail

/// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory from the heap.
/// A stateless RawAllocator that allocates memory from the heap.
/// It uses the two functions \ref heap_alloc and \ref heap_dealloc for the allocation,
/// which default to \c std::malloc and \c std::free.
/// \ingroup memory_allocator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace wpi
make_block_allocator_t<BlockOrRawAllocator, fixed_block_allocator>;
} // namespace detail

/// A stateful \concept{concept_rawallocator,RawAllocator} that is designed for allocations in a loop.
/// A stateful RawAllocator that is designed for allocations in a loop.
/// It uses `N` stacks for the allocation, one of them is always active.
/// Allocation uses the currently active stack.
/// Calling \ref iteration_allocator::next_iteration() at the end of the loop,
Expand All @@ -40,7 +40,7 @@ namespace wpi
public:
using allocator_type = detail::iteration_block_allocator<BlockOrRawAllocator>;

/// \effects Creates it with a given initial block size and and other constructor arguments for the \concept{concept_blockallocator,BlockAllocator}.
/// \effects Creates it with a given initial block size and and other constructor arguments for the BlockAllocator.
/// It will allocate the first (and only) block and evenly divide it on all the stacks it uses.
template <typename... Args>
explicit iteration_allocator(std::size_t block_size, Args&&... args)
Expand Down Expand Up @@ -89,7 +89,7 @@ namespace wpi

/// \effects Allocates a memory block of given size and alignment.
/// It simply moves the top marker of the currently active stack.
/// \returns A \concept{concept_node,node} with given size and alignment.
/// \returns A node with given size and alignment.
/// \throws \ref out_of_fixed_memory if the current stack does not have any memory left.
/// \requires \c size and \c alignment must be valid.
void* allocate(std::size_t size, std::size_t alignment)
Expand All @@ -106,7 +106,7 @@ namespace wpi

/// \effects Allocates a memory block of given size and alignment
/// similar to \ref allocate().
/// \returns A \concept{concept_node,node} with given size and alignment
/// \returns A node with given size and alignment
/// or `nullptr` if the current stack does not have any memory left.
void* try_allocate(std::size_t size, std::size_t alignment) noexcept
{
Expand Down Expand Up @@ -139,7 +139,7 @@ namespace wpi
return cur_;
}

/// \returns A reference to the \concept{concept_blockallocator,BlockAllocator} used for managing the memory.
/// \returns A reference to the BlockAllocator used for managing the memory.
/// \requires It is undefined behavior to move this allocator out into another object.
allocator_type& get_allocator() noexcept
{
Expand Down
Loading

0 comments on commit 29249ac

Please sign in to comment.