gcc/libstdc++-v3/include
Jonathan Wakely 5c2d703e6d libstdc++: Add attributes to functions in <memory_resource>
Add attributes to the accessors for the global memory resource objects,
to allow the compiler to eliminate redundant calls to them. For example,
multiple calls to std::pmr::new_delete_resource() will always return the
same object, and so the compiler can replace them with a single call.

Ideally we would like adjacent calls to std::pmr::get_default_resource()
to be combined into a single call by the CSE pass. The 'pure' attribute
would permit that. However, the standard requires that calls to
std::pmr::set_default_resource() synchronize with subsequent calls to
std::pmr::get_default_resource().  With 'pure' the DCE pass might
eliminate seemingly redundant calls to std::pmr::get_default_resource().
That might be unsafe, because the caller might be relying on the
associated synchronization. We could use a hypothetical attribute that
allows CSE but not DCE, but we don't have one. So it can't be 'pure'.

Also add [[nodiscard]] to equality operators.

libstdc++-v3/ChangeLog:

	* include/std/memory_resource (new_delete_resource): Add
	nodiscard, returns_nonnull and const attributes.
	(null_memory_resource): Likewise.
	(set_default_resource, get_default_resource): Add returns_nonnull
	attribute.
	(memory_resource::is_equal): Add nodiscard attribute.
	(operator==, operator!=): Likewise.
2022-05-17 20:51:04 +01:00
..
backward libstdc++: Improve doxygen docs for some of <memory> 2022-05-13 13:32:23 +01:00
bits libstdc++: Add attributes to <system_error> and related 2022-05-17 20:50:31 +01:00
c Update copyright years. 2022-01-03 10:42:10 +01:00
c_compatibility libstdc++: Fix missing and incorrect feature test macros [PR105269] 2022-04-14 11:02:37 +01:00
c_global libstdc++: Ensure all feature test macros have type long [PR87193] 2022-01-21 16:07:34 +00:00
c_std libstdc++: Declare std::c8rtomb and std::mbrtoc8 if provided by the C library 2022-01-18 16:31:02 +00:00
debug Update copyright years. 2022-01-03 10:42:10 +01:00
decimal Update copyright years. 2022-01-03 10:42:10 +01:00
experimental libstdc++: ppc: conditionalize vsx-only simd intrinsics 2022-05-06 15:43:42 -03:00
ext libstdc++: Improve doxygen docs for std::allocator 2022-05-13 13:32:22 +01:00
parallel Update copyright years. 2022-01-03 10:42:10 +01:00
precompiled libstdc++: Add new headers to <bits/stdc++.h> PCH 2022-04-14 11:02:43 +01:00
pstl libstdc++: Reduce header dependencies from PSTL headers [PR92546] 2022-03-18 10:16:36 +00:00
std libstdc++: Add attributes to functions in <memory_resource> 2022-05-17 20:51:04 +01:00
tr1 libstdc++: Add attribute to features deprecated in C++17 [PR91260] 2022-01-14 11:27:50 +00:00
tr2 Update copyright years. 2022-01-03 10:42:10 +01:00
Makefile.am libstdc++: Define std::expected for C++23 (P0323R12) 2022-03-27 18:50:31 +01:00
Makefile.in libstdc++: Define std::expected for C++23 (P0323R12) 2022-03-27 18:50:31 +01:00