Commit 03d5d0c3 by Ville Voutilainen Committed by Ville Voutilainen

re PR libstdc++/68276 (ios_base::_M_grow_words should use new (std::nothrow))

2015-12-18  Ville Voutilainen  <ville.voutilainen@gmail.com>

	PR libstdc++/68276

	* src/c++11/ios.cc (_M_grow_words): Use nothrow new.
	* testsuite/27_io/ios_base/storage/11584.cc: Adjust.

From-SVN: r231819
parent 15ab6f00
2015-12-18 Ville Voutilainen <ville.voutilainen@gmail.com>
PR libstdc++/68276
* src/c++11/ios.cc (_M_grow_words): Use nothrow new.
* testsuite/27_io/ios_base/storage/11584.cc: Adjust.
2015-12-18 Andris Pavenis <andris.pavenis@iki.fi> 2015-12-18 Andris Pavenis <andris.pavenis@iki.fi>
* config/os/djgpp/error_constants.h: update according to DJGPP errno * config/os/djgpp/error_constants.h: update according to DJGPP errno
......
...@@ -121,9 +121,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -121,9 +121,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ix < numeric_limits<int>::max()) if (__ix < numeric_limits<int>::max())
{ {
__newsize = __ix + 1; __newsize = __ix + 1;
__try __words = new (std::nothrow) _Words[__newsize];
{ __words = new _Words[__newsize]; } if (!__words)
__catch(const std::bad_alloc&)
{ {
_M_streambuf_state |= badbit; _M_streambuf_state |= badbit;
if (_M_streambuf_state & _M_exception) if (_M_streambuf_state & _M_exception)
......
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
int new_fails; int new_fails;
void* operator new(std::size_t n) throw (std::bad_alloc) void* operator new(std::size_t n, const std::nothrow_t&) throw()
{ {
if (new_fails) if (new_fails)
throw std::bad_alloc(); return 0;
return malloc(n); return malloc(n);
} }
void* operator new[] (std::size_t n) throw (std::bad_alloc) void* operator new[] (std::size_t n, const std::nothrow_t& ntt) throw()
{ return operator new(n); } { return operator new(n, ntt); }
void operator delete (void *p) throw() { free(p); } void operator delete (void *p) throw() { free(p); }
void operator delete[] (void *p) throw() { operator delete(p); } void operator delete[] (void *p) throw() { operator delete(p); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment