[committed 2/2] libstdc++: Add [[nodiscard]] to sequence containers

Jonathan Wakely jwakely@redhat.com
Wed Aug 4 12:00:14 GMT 2021

On 04/08/21 12:56 +0100, Jonathan Wakely wrote:
>... and container adaptors.
>This adds the [[nodiscard]] attribute to functions with no side-effects
>for the sequence containers and their iterators, and the debug versions
>of those containers, and the container adaptors,

I don't plan to add any more [[nodiscard]] attributes for now, but
these two commits should demonstrate how to do it for anybody who
wants to contribute similar patches.

I didn't add tests that verify we do actually warn on each of those
functions, because there are hundreds of them, and I know they're
working because I had to alter existing tests to not warn.

More information about the Gcc-patches mailing list