From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 939EA3856267; Thu, 27 Apr 2023 23:04:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 939EA3856267 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682636684; bh=U9b9Yt95heWyTLtrZVTbxF6Ymy4FrOxjXC5oCQGEnD4=; h=From:To:Subject:Date:From; b=Ddbt2DN2sZGNdNui8kaeUrCycwXvMDU5kca+8UdTyVFvmh1E4WpdCcpSzt2xd6IjA DCqlfCGLMBEPjH+5+6JhD1jedZEXVQ8lXNedaIgGC3WwqncBZh74gH6BiAegjWuw0b zAVIQEqhBwOaLbGdYS41tkOq7FMqR9qjp6cciQ4U= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-11323] libstdc++: Fix outdated docs about demangling exception messages X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 33623bbafe06c5e39fd343d51b0e7ee0b0df47b0 X-Git-Newrev: c73f20e67ee8d268bf0dfd6732c1bd3e79e098ca Message-Id: <20230427230444.939EA3856267@sourceware.org> Date: Thu, 27 Apr 2023 23:04:44 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c73f20e67ee8d268bf0dfd6732c1bd3e79e098ca commit r10-11323-gc73f20e67ee8d268bf0dfd6732c1bd3e79e098ca Author: Jonathan Wakely Date: Tue Apr 4 12:04:14 2023 +0100 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. (cherry picked from commit 688d126b69215db29774c249b052e52d765782b3) Diff: --- libstdc++-v3/doc/html/manual/ext_demangling.html | 13 ++----------- libstdc++-v3/doc/xml/manual/extensions.xml | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/libstdc++-v3/doc/html/manual/ext_demangling.html b/libstdc++-v3/doc/html/manual/ext_demangling.html index 879497f7d08..028ec71d8c8 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 86e92beffd3..196b55d8347 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.)