From: Jonathan Wakely Date: Tue, 4 Apr 2023 11:04:14 +0000 (+0100) Subject: libstdc++: Fix outdated docs about demangling exception messages X-Git-Tag: upstream/13.1.0~245 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=688d126b69215db29774c249b052e52d765782b3;p=platform%2Fupstream%2Fgcc.git libstdc++: Fix outdated docs about demangling exception messages The string returned by std::bad_exception::what() hasn't been a mangled name since PR libstdc++/14493 was fixed for GCC 4.2.0, so remove the docs showing how to demangle it. libstdc++-v3/ChangeLog: * doc/xml/manual/extensions.xml: Remove std::bad_exception from example program. * doc/html/manual/ext_demangling.html: Regenerate. --- diff --git a/libstdc++-v3/doc/html/manual/ext_demangling.html b/libstdc++-v3/doc/html/manual/ext_demangling.html index 879497f..028ec71 100644 --- a/libstdc++-v3/doc/html/manual/ext_demangling.html +++ b/libstdc++-v3/doc/html/manual/ext_demangling.html @@ -39,14 +39,6 @@ int main() int status; char *realname; - // exception classes not in <stdexcept>, thrown by the implementation - // instead of the user - std::bad_exception e; - realname = abi::__cxa_demangle(e.what(), 0, 0, &status); - std::cout << e.what() << "\t=> " << realname << "\t: " << status << '\n'; - free(realname); - - // typeid bar<empty,17> u; const std::type_info &ti = typeid(u); @@ -61,13 +53,12 @@ int main() This prints

    
-      St13bad_exception       => std::bad_exception   : 0
       3barI5emptyLi17EE       => bar<empty, 17>       : 0
    
    

The demangler interface is described in the source documentation linked to above. It is actually written in C, so you don't need to be writing C++ in order to demangle C++. (That also means we have to - use crummy memory management facilities, so don't forget to free() - the returned char array.) + use crummy memory management facilities, so don't forget to + free() the returned char array.)

\ No newline at end of file diff --git a/libstdc++-v3/doc/xml/manual/extensions.xml b/libstdc++-v3/doc/xml/manual/extensions.xml index 86e92be..196b55d 100644 --- a/libstdc++-v3/doc/xml/manual/extensions.xml +++ b/libstdc++-v3/doc/xml/manual/extensions.xml @@ -534,14 +534,6 @@ int main() int status; char *realname; - // exception classes not in <stdexcept>, thrown by the implementation - // instead of the user - std::bad_exception e; - realname = abi::__cxa_demangle(e.what(), 0, 0, &status); - std::cout << e.what() << "\t=> " << realname << "\t: " << status << '\n'; - free(realname); - - // typeid bar<empty,17> u; const std::type_info &ti = typeid(u); @@ -559,7 +551,6 @@ int main() - St13bad_exception => std::bad_exception : 0 3barI5emptyLi17EE => bar<empty, 17> : 0 @@ -568,8 +559,8 @@ int main() The demangler interface is described in the source documentation linked to above. It is actually written in C, so you don't need to be writing C++ in order to demangle C++. (That also means we have to - use crummy memory management facilities, so don't forget to free() - the returned char array.) + use crummy memory management facilities, so don't forget to + free() the returned char array.)