diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-04-26 15:23:57 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-04-27 11:28:39 +0100 |
commit | f9412cedd6c0e7417b30d9a80d3f45c8746223b4 (patch) | |
tree | 07675ffc3873c74bc79453927dd0f224829c7493 /gcc | |
parent | d8842271ebf9a81128df9ae80e1d3b688749eac8 (diff) | |
download | gcc-f9412cedd6c0e7417b30d9a80d3f45c8746223b4.zip gcc-f9412cedd6c0e7417b30d9a80d3f45c8746223b4.tar.gz gcc-f9412cedd6c0e7417b30d9a80d3f45c8746223b4.tar.bz2 |
libstdc++: Make std::random_device throw std::system_error [PR105081]
This changes std::random_device constructors to throw std::system_error
(with EINVAL as the error code) when the constructor argument is
invalid. We can also throw std::system_error when read(2) fails so that
the exception includes the additional information provided by errno.
As noted in the PR, this is consistent with libc++, and doesn't break
any existing code which catches std::runtime_error, because those
handlers will still catch std::system_error.
libstdc++-v3/ChangeLog:
PR libstdc++/105081
* src/c++11/random.cc (__throw_syserr): New function.
(random_device::_M_init, random_device::_M_init_pretr1): Use new
function for bad tokens.
(random_device::_M_getval): Use new function for read errors.
* testsuite/util/testsuite_random.h (random_device_available):
Change catch handler to use std::system_error.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions