gcc/libstdc++-v3/include/std
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
..
algorithm
any
array
atomic
barrier
bit
bitset
charconv
chrono
codecvt
complex
concepts
condition_variable
coroutine
deque
execution
expected
filesystem
forward_list
fstream
functional
future
iomanip
ios
iosfwd
iostream
istream
iterator
latch
limits
list
locale
map
memory
memory_resource libstdc++: Add attributes to functions in <memory_resource> 2022-05-17 20:51:04 +01:00
mutex
numbers
numeric
optional
ostream
queue
random
ranges
ratio
regex
scoped_allocator
semaphore
set
shared_mutex
source_location
span
spanstream
sstream
stack
stacktrace
stdexcept
stop_token
streambuf
string
string_view
syncstream
system_error
thread
tuple
type_traits
typeindex
unordered_map
unordered_set
utility
valarray
variant
vector
version