aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-09-22 13:56:21 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-09-23 16:07:38 +0100
commitdd396a321be5099536af36e64454c1fcf9d67e12 (patch)
treec51599a9c7c74eb56cd05af63a2c40f9f066cf25 /gcc
parentce01e2e64c340dadb55a8a24c545a13e654804d4 (diff)
downloadgcc-dd396a321be5099536af36e64454c1fcf9d67e12.zip
gcc-dd396a321be5099536af36e64454c1fcf9d67e12.tar.gz
gcc-dd396a321be5099536af36e64454c1fcf9d67e12.tar.bz2
libstdc++: Improvements to standard error category objects
This ensures that the objects returned by std::generic_category() and std::system_category() are initialized before any code starts executing, and are not destroyed at the end of the program. This means it is always safe to access them, even during startup and termination. See LWG 2992 and P1195R0 for further discussion of this. Additionally, make the types of those objects final, which might potentially allow additional devirtualization opportunities. The types are not visible to users, so there is no way they can derive from them, so making them final has no semantic change. Finally, add overrides for equivalent(int, const error_condition&) to those types, to avoid the second virtual call that would be performed by the base class definition of the function. Because we know what default_error_condition(int) does for the derived type, we don't need to make a virtual call. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * src/c++11/system_error.cc (generic_error_category): Define class and virtual functions as 'final'. (generic_error_category::equivalent(int, const error_condition&)): Override. (system_error_category): Define class and virtual functions as 'final'. (system_error_category::equivalent(int, const error_condition&)): Override. (generic_category_instance, system_category_instance): Use constinit union to make the objects immortal.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions