From 0f8a1c150e46fc23d34a342a80bb52dda3571f94 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 10 May 2018 20:13:42 +0100 Subject: [PATCH] Document Dual ABI for std::ios_base::failure * doc/xml/faq.xml: Link to C++17 status. Add note to outdated answer. * doc/xml/manual/debug_mode.xml: Add array and forward_list to list of C++11 containers with Debug Mode support. * doc/xml/manual/using.xml: Document Dual ABI for ios_base::failure. * doc/html/*: Regenerate. From-SVN: r260129 --- libstdc++-v3/ChangeLog | 10 ++++++- libstdc++-v3/doc/html/faq.html | 13 ++++----- libstdc++-v3/doc/html/manual/debug_mode_using.html | 2 +- libstdc++-v3/doc/html/manual/using.html | 4 ++- libstdc++-v3/doc/html/manual/using_dual_abi.html | 29 ++++++++++++++++++-- libstdc++-v3/doc/xml/faq.xml | 14 ++++++---- libstdc++-v3/doc/xml/manual/debug_mode.xml | 14 +++++++++- libstdc++-v3/doc/xml/manual/using.xml | 31 ++++++++++++++++++++-- 8 files changed, 98 insertions(+), 19 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index df67836..1d6a3fa 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2018-05-10 Jonathan Wakely + + * doc/xml/faq.xml: Link to C++17 status. Add note to outdated answer. + * doc/xml/manual/debug_mode.xml: Add array and forward_list to list + of C++11 containers with Debug Mode support. + * doc/xml/manual/using.xml: Document Dual ABI for ios_base::failure. + * doc/html/*: Regenerate. + 2018-05-10 Jason Merrill * include/bits/regex_compiler.h (_S_cache_size): Change from @@ -41,7 +49,7 @@ (_Parameter::_Parameter(const _Safe_local_iterator<>&, const char*, _Is_iterator)): Likewise. (_Parameter::_S_reverse_state(_Iterator_state)): New. - (_Parameter(__gnu_cxx::__normal_iterator<> const&, const char*, + (_Parameter(__gnu_cxx::__normal_iterator<> const&, const char*, _Is_iterator)): New. (_Parameter(std::reverse_iterator<> const&, const char*, _Is_iterator)): New. diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html index eaabb7f..a020826 100644 --- a/libstdc++-v3/doc/html/faq.html +++ b/libstdc++-v3/doc/html/faq.html @@ -538,14 +538,15 @@ except for some corner cases. Support for localization in locale may be incomplete on some non-GNU platforms. Also dependent on the underlying platform is support - for wchar_t and long - long specializations, and details of thread support. + for wchar_t and long long specializations, + and details of thread support.

Long answer: See the implementation status pages for C++98, - TR1, and - C++11. - C++14. + TR1, + C++11, + C++14, and + C++17.

5.2.

Bugs in the ISO C++ language or library specification

@@ -642,7 +643,7 @@ without other drawbacks, send us a patch.

6.3.

Ambiguous overloads after including an old-style header -

+

Note

This answer is old and probably no longer be relevant.

Another problem is the rel_ops namespace and the template comparison operator functions contained therein. If they become visible in the same namespace as other comparison functions diff --git a/libstdc++-v3/doc/html/manual/debug_mode_using.html b/libstdc++-v3/doc/html/manual/debug_mode_using.html index 9914290..e4f7ea5 100644 --- a/libstdc++-v3/doc/html/manual/debug_mode_using.html +++ b/libstdc++-v3/doc/html/manual/debug_mode_using.html @@ -20,4 +20,4 @@ containers:

Table 17.1. Debugging Containers

ContainerHeaderDebug containerDebug header
std::bitsetbitset__gnu_debug::bitset<debug/bitset>
std::dequedeque__gnu_debug::deque<debug/deque>
std::listlist__gnu_debug::list<debug/list>
std::mapmap__gnu_debug::map<debug/map>
std::multimapmap__gnu_debug::multimap<debug/map>
std::multisetset__gnu_debug::multiset<debug/set>
std::setset__gnu_debug::set<debug/set>
std::stringstring__gnu_debug::string<debug/string>
std::wstringstring__gnu_debug::wstring<debug/string>
std::basic_stringstring__gnu_debug::basic_string<debug/string>
std::vectorvector__gnu_debug::vector<debug/vector>

In addition, when compiling in C++11 mode, these additional containers have additional debug capability. -

Table 17.2. Debugging Containers C++11

ContainerHeaderDebug containerDebug header
std::unordered_mapunordered_map__gnu_debug::unordered_map<debug/unordered_map>
std::unordered_multimapunordered_map__gnu_debug::unordered_multimap<debug/unordered_map>
std::unordered_setunordered_set__gnu_debug::unordered_set<debug/unordered_set>
std::unordered_multisetunordered_set__gnu_debug::unordered_multiset<debug/unordered_set>

\ No newline at end of file +

Table 17.2. Debugging Containers C++11

ContainerHeaderDebug containerDebug header
std::arrayarray__gnu_debug::array<debug/array>
std::forward_listforward_list__gnu_debug::forward_list<debug/forward_list>
std::unordered_mapunordered_map__gnu_debug::unordered_map<debug/unordered_map>
std::unordered_multimapunordered_map__gnu_debug::unordered_multimap<debug/unordered_map>
std::unordered_setunordered_set__gnu_debug::unordered_set<debug/unordered_set>
std::unordered_multisetunordered_set__gnu_debug::unordered_multiset<debug/unordered_set>

\ No newline at end of file diff --git a/libstdc++-v3/doc/html/manual/using.html b/libstdc++-v3/doc/html/manual/using.html index 332725b..7ccb4e9 100644 --- a/libstdc++-v3/doc/html/manual/using.html +++ b/libstdc++-v3/doc/html/manual/using.html @@ -25,5 +25,7 @@ <atomic>. -lstdc++fsLinking to libstdc++fs is required for use of the Filesystem library extensions in - <experimental/filesystem>. + <experimental/filesystem> + and the C++17 Filesystem library in + <filesystem>. -fopenmpFor parallel mode.
\ No newline at end of file diff --git a/libstdc++-v3/doc/html/manual/using_dual_abi.html b/libstdc++-v3/doc/html/manual/using_dual_abi.html index 4a62c02..916ac57 100644 --- a/libstdc++-v3/doc/html/manual/using_dual_abi.html +++ b/libstdc++-v3/doc/html/manual/using_dual_abi.html @@ -14,7 +14,7 @@ for the new implementations have different names the definitions for both versions can be present in the same library.

The _GLIBCXX_USE_CXX11_ABI macro (see -Macros) controls whether + Macros) controls whether the declarations in the library headers use the old or new ABI. So the decision of which ABI to use can be made separately for each source file being compiled. @@ -43,10 +43,35 @@ facet that derives from one or other version of time_get is installed in the locale).

Although the standard exception types defined in - <stdexcept> use strings, they + <stdexcept> use strings, most are not defined twice, so that a std::out_of_range exception thrown in one file can always be caught by a suitable handler in another file, even if the two files are compiled with different ABIs. +

One exception type does change when using the new ABI, namely + std::ios_base::failure. + This is necessary because the 2011 standard changed its base class from + std::exception to + std::system_error, which causes its layout to change. + Exceptions due to iostream errors are thrown by a function inside + libstdc++.so, so whether the thrown + exception uses the old std::ios_base::failure type + or the new one depends on the ABI that was active when + libstdc++.so was built, + not the ABI active in the user code that is using + iostreams. + This means that for a given build of GCC the type thrown is fixed. + In current releases the library throws a special type that can be caught + by handlers for either the old or new type, + but for GCC 7.1, 7.2 and 7.3 the library throws the new + std::ios_base::failure type, + and for GCC 5.x and 6.x the library throws the old type. + Catch handlers of type std::ios_base::failure + will only catch the exceptions if using a newer release, + or if the handler is compiled with the same ABI as the type thrown by + the library. + Handlers for std::exception will always catch + iostreams exceptions, because the old and new type both inherit from + std::exception.

Troubleshooting

If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml index b0b1f98..edc07f1 100644 --- a/libstdc++-v3/doc/xml/faq.xml +++ b/libstdc++-v3/doc/xml/faq.xml @@ -742,15 +742,16 @@ except for some corner cases. Support for localization in locale may be incomplete on some non-GNU platforms. Also dependent on the underlying platform is support - for wchar_t and long - long specializations, and details of thread support. + for wchar_t and long long specializations, + and details of thread support. Long answer: See the implementation status pages for C++98, - TR1, and - C++11. - C++14. + TR1, + C++11, + C++14, and + C++17. @@ -891,6 +892,9 @@ + + This answer is old and probably no longer be relevant. + Another problem is the rel_ops namespace and the template comparison operator functions contained therein. If they become diff --git a/libstdc++-v3/doc/xml/manual/debug_mode.xml b/libstdc++-v3/doc/xml/manual/debug_mode.xml index 5082bbf..570c17b 100644 --- a/libstdc++-v3/doc/xml/manual/debug_mode.xml +++ b/libstdc++-v3/doc/xml/manual/debug_mode.xml @@ -285,7 +285,19 @@ containers have additional debug capability. - + + std::array + array + __gnu_debug::array + <debug/array> + + + std::forward_list + forward_list + __gnu_debug::forward_list + <debug/forward_list> + + std::unordered_map unordered_map __gnu_debug::unordered_map diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml index 918703a..67f9cf5 100644 --- a/libstdc++-v3/doc/xml/manual/using.xml +++ b/libstdc++-v3/doc/xml/manual/using.xml @@ -1036,7 +1036,7 @@ g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe The _GLIBCXX_USE_CXX11_ABI macro (see -) controls whether + ) controls whether the declarations in the library headers use the old or new ABI. So the decision of which ABI to use can be made separately for each source file being compiled. @@ -1071,12 +1071,39 @@ g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe Although the standard exception types defined in - <stdexcept> use strings, they + <stdexcept> use strings, most are not defined twice, so that a std::out_of_range exception thrown in one file can always be caught by a suitable handler in another file, even if the two files are compiled with different ABIs. + One exception type does change when using the new ABI, namely + std::ios_base::failure. + This is necessary because the 2011 standard changed its base class from + std::exception to + std::system_error, which causes its layout to change. + Exceptions due to iostream errors are thrown by a function inside + libstdc++.so, so whether the thrown + exception uses the old std::ios_base::failure type + or the new one depends on the ABI that was active when + libstdc++.so was built, + not the ABI active in the user code that is using + iostreams. + This means that for a given build of GCC the type thrown is fixed. + In current releases the library throws a special type that can be caught + by handlers for either the old or new type, + but for GCC 7.1, 7.2 and 7.3 the library throws the new + std::ios_base::failure type, + and for GCC 5.x and 6.x the library throws the old type. + Catch handlers of type std::ios_base::failure + will only catch the exceptions if using a newer release, + or if the handler is compiled with the same ABI as the type thrown by + the library. + Handlers for std::exception will always catch + iostreams exceptions, because the old and new type both inherit from + std::exception. + +

Troubleshooting If you get linker errors about undefined references to symbols -- 2.7.4