diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-11-10 19:23:15 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-11-10 20:33:29 +0000 |
commit | 5dfbc52264fc64db22e75f385be9efae3d0eba46 (patch) | |
tree | 3aa5fecbf586d5d5e85e46c42fa46b1177f0e4b3 /gcc | |
parent | 8c0c83feb04d7486ccf9cbe86dcd5668f0a21ef9 (diff) | |
download | gcc-5dfbc52264fc64db22e75f385be9efae3d0eba46.zip gcc-5dfbc52264fc64db22e75f385be9efae3d0eba46.tar.gz gcc-5dfbc52264fc64db22e75f385be9efae3d0eba46.tar.bz2 |
libstdc++: Avoid bad_alloc exceptions when changing locales
For the --enable-clocale=generic configuration, the current code can
fail with a bad_alloc exception. This patch uses the nothrow version of
operator new and reports allocation failures by setting failbit in the
iostate variable.
* config/locale/generic/c_locale.cc (__set_C_locale()): New function
to set the "C" locale and return the name of the previous locale.
(__convert_to_v<float>, __convert_to_v<double>)
(__convert_to_v<long double>): Use __set_C_locale and set failbit on
error.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions