aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-05-17 15:14:39 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-05-17 20:51:04 +0100
commit5c2d703e6d6d47f41635ca4df06c555010462081 (patch)
treef48a78f7fff6b6350fb4fa804aa63578a9988c64 /libgo
parent5f1ce85135a92481307f2eb4ad805bc53f6137a3 (diff)
downloadgcc-5c2d703e6d6d47f41635ca4df06c555010462081.zip
gcc-5c2d703e6d6d47f41635ca4df06c555010462081.tar.gz
gcc-5c2d703e6d6d47f41635ca4df06c555010462081.tar.bz2
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.
Diffstat (limited to 'libgo')
0 files changed, 0 insertions, 0 deletions