[PING] Re: Add const char* constructors for exception classes in <stdexcept>

Oleg Endo oleg.endo@t-online.de
Sun Jan 26 14:15:00 GMT 2014


Ping.
The patch in question is here:
http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01688.html


On Thu, 2013-12-19 at 16:28 +0100, Oleg Endo wrote:
> On Thu, 2013-12-19 at 01:19 +0000, Jonathan Wakely wrote:
> > On 19 December 2013 00:10, Oleg Endo wrote:
> > > Hello,
> > >
> > > When writing code such as
> > > ...
> > >   throw std::logic_error ("cold coffee");
> > > ...
> > > currently the construction of std::string happens in the code that
> > > throws the exception, which results in code bloat.  Implementing the
> > > const char* constructors as defined by C++11 fixes the issue.
> > > I'm not sure whether the #if __cplusplus >= 201103L checks are required.
> > > C++98 code could also benefit from the overloads.
> > 
> > I think there was some good reason we haven't added these yet, but I
> > can't remember it.
> > 
> > > Tested with 'make all' and 'make install', writing a hello world and
> > > checking the asm output.
> > 
> > For all patches we need to know that the libstdc++ testsuite passes too.
> 
> Right, I should have done that in the first place.  The patch was
> broken.  Sorry for the noise.
> 
> Files in libstdc++-v3/src/c++98/ seem to be never compiled with C++11.
> Thus I can think of two options:
> 1) Add const char* ctors for C++98 and C++11.
> 2) Add #ifdef'ed declarations to libstdc++-v3/include/std/stdexcept and
> add a new file libstdc++-v3/src/c++11/stdexcept.cc with the
> implementations.
> 
> The attached patch does 1).
> 
> Tested with 'make all' and 'make check-target-libstdc++-v3' on
> i686-pc-linux-gnu, configured with:
> ../gcc-trunk2/configure --prefix=/<...> --enable-languages=c,c++
> 
> 		=== libstdc++ Summary ===
> 
> # of expected passes		5142
> # of unexpected failures	2
> # of expected failures		34
> # of unsupported tests		476
> 
> Cheers,
> Oleg
> 
> libstdc++-v3/ChangeLog:
>         * include/std/stdexcept (logic_error, domain_error, 
>         invalid_argument, length_error, out_of_range, runtime_error, 
>         range_error, overflow_error, underflow_error): Declare const 
>         char* constructors.
>         * src/c++98/stdexcept.cc (logic_error, domain_error, 
>         invalid_argument, length_error, out_of_range, runtime_error, 
>         range_error, overflow_error, underflow_error): Implement them.
> 	* config/abi/pre/gnu.ver ( _ZNSt11logic_errorC[12]EPKc, 
> 	_ZNSt12domain_errorC[12]EPKc, _ZNSt16invalid_argumentC[12]EPKc, 
> 	_ZNSt12length_errorC[12]EPKc, _ZNSt12out_of_rangeC[12]EPKc, 
> 	_ZNSt13runtime_errorC[12]EPKc, _ZNSt11range_errorC[12]EPKc, 
> 	_ZNSt14overflow_errorC[12]EPKc, _ZNSt15underflow_errorC[12]EPKc):
> 	Add new exports.
> 	* doc/xml/manual/status_cxx2011.xml: Update.




More information about the Gcc-patches mailing list