libstdc++: Move [[nodiscard]] attributes again [PR101782]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 5 Aug 2021 15:46:00 +0000 (16:46 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 5 Aug 2021 18:01:51 +0000 (19:01 +0100)
commitc8b024fa4b76bfd914e96dd3cecfbb6ee8e91316
treeafb7a2985f449804455cbe65e9c7c848d63dc5d6
parent4739344d36e6d24764cbedde44a3fff6edc70f6c
libstdc++: Move [[nodiscard]] attributes again [PR101782]

Where I moved these nodiscard attributes to made them apply to the
function type, not to the function. This meant they no longer generated
the desired -Wunused-result warnings, and were ill-formed with Clang
(but only a pedwarn with GCC).

Clang also detected ill-formed attributes in <queue> which this fixes.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/101782
* include/bits/ranges_base.h (ranges::begin, ranges::end)
(ranges::rbegin, ranges::rend, ranges::size, ranges::ssize)
(ranges::empty, ranges::data): Move attribute after the
declarator-id instead of at the end of the declarator.
* include/bits/stl_iterator.h (__gnu_cxx::__normal_iterator):
Move attributes back to the start of the function declarator,
but move the requires-clause to the end.
(common_iterator): Move attribute after the declarator-id.
* include/bits/stl_queue.h (queue): Remove ill-formed attributes
from friend declaration that are not definitions.
* include/std/ranges (views::all, views::filter)
(views::transform, views::take, views::take_while,
views::drop) (views::drop_while, views::join,
views::lazy_split) (views::split, views::counted,
views::common, views::reverse) (views::elements): Move
attributes after the declarator-id.
libstdc++-v3/include/bits/ranges_base.h
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/bits/stl_queue.h
libstdc++-v3/include/std/ranges