[PATCH 04/10] libstdc++: Remove Doxygen @return on void functions

Tomasz Kaminski tkaminsk@redhat.com
Thu Apr 2 08:12:17 GMT 2026


On Thu, Apr 2, 2026 at 12:00 AM Jonathan Wakely <jwakely@redhat.com> wrote:

> With the latest version of Doxygen this gives a warning about using
> @return on a function that returns void. Stating it explicitly adds very
> little value, anybody can see from the signature that a function returns
> void.
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/move.h (swap): Remove @return from Doxygen
>         comment.
>         * include/bits/stl_algo.h (inplace_merge, shuffle)
>         (random_shuffle, partial_sort, nth_element, sort)
>         (stable_sort): Likewise.
>         * include/bits/stl_algobase.h (iter_swap, fill): Likewise.
>         * include/bits/stl_deque.h (_Deque_base::_M_initialize_map)
>         (deque::_M_range_initialize, deque::_M_fill_initialize):
>         Likewise.
>         * include/bits/stl_iterator_base_funcs.h (advance): Likewise.
>         * include/bits/stl_numeric.h (iota): Likewise.
>         * include/bits/stl_tempbuf.h (return_temporary_buffer):
>         Likewise.
>         * include/bits/stl_uninitialized.h (uninitialized_fill):
>         Likewise.
> ---
>
> Tested x86_64-linux, docs built with Doxygen 1.13.2 and 1.17.0 (from git)
>
LGTM.

>
>  libstdc++-v3/include/bits/move.h                    |  1 -
>  libstdc++-v3/include/bits/stl_algo.h                | 13 -------------
>  libstdc++-v3/include/bits/stl_algobase.h            |  2 --
>  libstdc++-v3/include/bits/stl_deque.h               |  3 ---
>  libstdc++-v3/include/bits/stl_iterator_base_funcs.h |  1 -
>  libstdc++-v3/include/bits/stl_numeric.h             |  1 -
>  libstdc++-v3/include/bits/stl_tempbuf.h             |  1 -
>  libstdc++-v3/include/bits/stl_uninitialized.h       |  1 -
>  8 files changed, 23 deletions(-)
>
> diff --git a/libstdc++-v3/include/bits/move.h
> b/libstdc++-v3/include/bits/move.h
> index 34962455129e..1a03db661123 100644
> --- a/libstdc++-v3/include/bits/move.h
> +++ b/libstdc++-v3/include/bits/move.h
> @@ -212,7 +212,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     *  @brief Swaps two values.
>     *  @param  __a  A thing of arbitrary type.
>     *  @param  __b  Another thing of arbitrary type.
> -   *  @return   Nothing.
>    */
>    template<typename _Tp>
>  #if __glibcxx_concepts // >= C++20
> diff --git a/libstdc++-v3/include/bits/stl_algo.h
> b/libstdc++-v3/include/bits/stl_algo.h
> index aa62bff8a469..adf9b9e0f280 100644
> --- a/libstdc++-v3/include/bits/stl_algo.h
> +++ b/libstdc++-v3/include/bits/stl_algo.h
> @@ -2531,7 +2531,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
>     *  @param  __first   An iterator.
>     *  @param  __middle  Another iterator.
>     *  @param  __last    Another iterator.
> -   *  @return  Nothing.
>     *
>     *  Merges two sorted and consecutive ranges, [__first,__middle) and
>     *  [__middle,__last), and puts the result in [__first,__last).  The
> @@ -2570,7 +2569,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
>     *  @param  __middle  Another iterator.
>     *  @param  __last    Another iterator.
>     *  @param  __comp    A functor to use for comparisons.
> -   *  @return  Nothing.
>     *
>     *  Merges two sorted and consecutive ranges, [__first,__middle) and
>     *  [middle,last), and puts the result in [__first,__last).  The output
> will
> @@ -3678,7 +3676,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
>     *  @param  __first   A forward iterator.
>     *  @param  __last    A forward iterator.
>     *  @param  __g       A UniformRandomNumberGenerator (26.5.1.3).
> -   *  @return  Nothing.
>     *
>     *  Reorders the elements in the range @p [__first,__last) using @p __g
> to
>     *  provide random numbers.
> @@ -4499,7 +4496,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @ingroup mutating_algorithms
>     *  @param  __first   A forward iterator.
>     *  @param  __last    A forward iterator.
> -   *  @return  Nothing.
>     *
>     *  Reorder the elements in the range `[__first, __last)` using a random
>     *  distribution, so that every possible ordering of the sequence is
> @@ -4565,7 +4561,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @param  __first   A forward iterator.
>     *  @param  __last    A forward iterator.
>     *  @param  __rand    The RNG functor or function.
> -   *  @return  Nothing.
>     *
>     *  Reorders the elements in the range `[__first, __last)` using
> `__rand`
>     *  to provide a random distribution. Calling `__rand(N)` for a positive
> @@ -4647,7 +4642,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @param  __first   An iterator.
>     *  @param  __middle  Another iterator.
>     *  @param  __last    Another iterator.
> -   *  @return  Nothing.
>     *
>     *  Sorts the smallest `(__middle - __first)` elements in the range
>     *  `[first, last)` and moves them to the range `[__first, __middle)`.
> The
> @@ -4686,7 +4680,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @param  __middle  Another iterator.
>     *  @param  __last    Another iterator.
>     *  @param  __comp    A comparison functor.
> -   *  @return  Nothing.
>     *
>     *  Sorts the smallest `(__middle - __first)` elements in the range
>     *  `[__first, __last)` and moves them to the range `[__first,
> __middle)`.
> @@ -4724,7 +4717,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @param  __first   An iterator.
>     *  @param  __nth     Another iterator.
>     *  @param  __last    Another iterator.
> -   *  @return  Nothing.
>     *
>     *  Rearranges the elements in the range `[__first, __last)` so that
> `*__nth`
>     *  is the same element that would have been in that position had the
> @@ -4764,7 +4756,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @param  __nth     Another iterator.
>     *  @param  __last    Another iterator.
>     *  @param  __comp    A comparison functor.
> -   *  @return  Nothing.
>     *
>     *  Rearranges the elements in the range `[__first, __last)` so that
> `*__nth`
>     *  is the same element that would have been in that position had the
> @@ -4802,7 +4793,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @ingroup sorting_algorithms
>     *  @param  __first   An iterator.
>     *  @param  __last    Another iterator.
> -   *  @return  Nothing.
>     *
>     *  Sorts the elements in the range `[__first, __last)` in ascending
> order,
>     *  such that for each iterator `i` in the range `[__first, __last -
> 1)`,
> @@ -4833,7 +4823,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @param  __first   An iterator.
>     *  @param  __last    Another iterator.
>     *  @param  __comp    A comparison functor.
> -   *  @return  Nothing.
>     *
>     *  Sorts the elements in the range `[__first, __last)` in ascending
> order,
>     *  such that `__comp(*(i+1), *i)` is false for every iterator `i` in
> the
> @@ -5028,7 +5017,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @ingroup sorting_algorithms
>     *  @param  __first   An iterator.
>     *  @param  __last    Another iterator.
> -   *  @return  Nothing.
>     *
>     *  Sorts the elements in the range @p [__first,__last) in ascending
> order,
>     *  such that for each iterator @p i in the range @p [__first,__last-1),
> @@ -5063,7 +5051,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
>     *  @param  __first   An iterator.
>     *  @param  __last    Another iterator.
>     *  @param  __comp    A comparison functor.
> -   *  @return  Nothing.
>     *
>     *  Sorts the elements in the range @p [__first,__last) in ascending
> order,
>     *  such that for each iterator @p i in the range @p [__first,__last-1),
> diff --git a/libstdc++-v3/include/bits/stl_algobase.h
> b/libstdc++-v3/include/bits/stl_algobase.h
> index 3fdbff973538..1350736a8d8e 100644
> --- a/libstdc++-v3/include/bits/stl_algobase.h
> +++ b/libstdc++-v3/include/bits/stl_algobase.h
> @@ -144,7 +144,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     *  @ingroup mutating_algorithms
>     *  @param  __a  An iterator.
>     *  @param  __b  Another iterator.
> -   *  @return   Nothing.
>     *
>     *  This function swaps the values pointed to by two iterators, not the
>     *  iterators themselves.
> @@ -990,7 +989,6 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
>     *  @param  __first  A forward iterator.
>     *  @param  __last   A forward iterator.
>     *  @param  __value  A reference-to-const of arbitrary type.
> -   *  @return   Nothing.
>     *
>     *  This function fills a range with copies of the same value.  For char
>     *  types filling contiguous areas of memory, this becomes an inline
> call
> diff --git a/libstdc++-v3/include/bits/stl_deque.h
> b/libstdc++-v3/include/bits/stl_deque.h
> index c08212861b6c..aebe865ffc1a 100644
> --- a/libstdc++-v3/include/bits/stl_deque.h
> +++ b/libstdc++-v3/include/bits/stl_deque.h
> @@ -632,7 +632,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>     *  @brief Layout storage.
>     *  @param  __num_elements  The count of T's for which to allocate space
>     *                          at first.
> -   *  @return   Nothing.
>     *
>     *  The initial underlying memory layout is a bit complicated...
>    */
> @@ -1985,7 +1984,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>         *  @brief Fills the deque with whatever is in [first,last).
>         *  @param  __first  An input iterator.
>         *  @param  __last  An input iterator.
> -       *  @return   Nothing.
>         *
>         *  If the iterators are actually forward iterators (or better),
> then the
>         *  memory layout can be done all at once.  Else we move forward
> using
> @@ -2006,7 +2004,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>        /**
>         *  @brief Fills the %deque with copies of value.
>         *  @param  __value  Initial value.
> -       *  @return   Nothing.
>         *  @pre _M_start and _M_finish have already been initialized,
>         *  but none of the %deque's elements have yet been constructed.
>         *
> diff --git a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
> b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
> index 515d6e6c04f8..d85b39365400 100644
> --- a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
> +++ b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
> @@ -248,7 +248,6 @@ namespace __detail
>     *  @brief A generalization of pointer arithmetic.
>     *  @param  __i  An input iterator.
>     *  @param  __n  The @a delta by which to change @p __i.
> -   *  @return  Nothing.
>     *
>     *  This increments @p i by @p n.  For bidirectional and random access
>     *  iterators, @p __n may be negative, in which case @p __i is
> decremented.
> diff --git a/libstdc++-v3/include/bits/stl_numeric.h
> b/libstdc++-v3/include/bits/stl_numeric.h
> index dad20c806b30..182769f0dc4f 100644
> --- a/libstdc++-v3/include/bits/stl_numeric.h
> +++ b/libstdc++-v3/include/bits/stl_numeric.h
> @@ -79,7 +79,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     *  @param  __first  Start of range.
>     *  @param  __last  End of range.
>     *  @param  __value  Starting value.
> -   *  @return  Nothing.
>     *  @ingroup numeric_ops
>     */
>    template<typename _ForwardIterator, typename _Tp>
> diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h
> b/libstdc++-v3/include/bits/stl_tempbuf.h
> index 1ae41991910c..a1d0a39f0b98 100644
> --- a/libstdc++-v3/include/bits/stl_tempbuf.h
> +++ b/libstdc++-v3/include/bits/stl_tempbuf.h
> @@ -159,7 +159,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    /**
>     *  @brief The companion to get_temporary_buffer().
>     *  @param  __p  A buffer previously allocated by get_temporary_buffer.
> -   *  @return   None.
>     *
>     *  Frees the memory pointed to by __p.
>     */
> diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h
> b/libstdc++-v3/include/bits/stl_uninitialized.h
> index ecc24023e98f..1c1fcfd62a4d 100644
> --- a/libstdc++-v3/include/bits/stl_uninitialized.h
> +++ b/libstdc++-v3/include/bits/stl_uninitialized.h
> @@ -403,7 +403,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     *  @param  __first  A forward iterator.
>     *  @param  __last   A forward iterator.
>     *  @param  __x      The source value.
> -   *  @return   Nothing.
>     *
>     *  Like std::fill, but does not require an initialized output range.
>    */
> --
> 2.53.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260402/ddab4763/attachment-0001.htm>


More information about the Libstdc++ mailing list