From: Benjamin Kosnik Date: Fri, 2 Aug 2002 16:04:16 +0000 (+0000) Subject: Revert PR libstdc++/6594 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=49bc23b7f971a6a8b24d9bfec359e837b069a8d7;p=gcc.git Revert PR libstdc++/6594 2002-08-02 Benjamin Kosnik Revert PR libstdc++/6594 * src/strstream.cc (strstreambuf): Revert. (strstreambuf::overflow): Same. (strstreambuf::~strstreambuf): Same. * testsuite/backward/strstream_members.cc (test02): Add. * docs/html/abi.txt: Update. Spell check. * testsuite/19_diagnostics/stdexceptions.cc (test04): Add bool test. * testsuite/Makefile.am (INCLUDES): Add LIBSUPCXX_INCLUDES. * testsuite/Makefile.in: Regenerate. * testsuite/testsuite_hooks.h: Use __throw_exception_again, include functexcept.h so that -fno-exceptions will build. From-SVN: r55988 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b331fff8500..1fd251d06e4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,20 @@ +2002-08-02 Benjamin Kosnik + + Revert PR libstdc++/6594 + * src/strstream.cc (strstreambuf): Revert. + (strstreambuf::overflow): Same. + (strstreambuf::~strstreambuf): Same. + * testsuite/backward/strstream_members.cc (test02): Add. + + * docs/html/abi.txt: Update. Spell check. + + * testsuite/19_diagnostics/stdexceptions.cc (test04): Add bool test. + + * testsuite/Makefile.am (INCLUDES): Add LIBSUPCXX_INCLUDES. + * testsuite/Makefile.in: Regenerate. + * testsuite/testsuite_hooks.h: Use __throw_exception_again, + include functexcept.h so that -fno-exceptions will build. + 2002-08-02 Gabriel Dos Reis * include/bits/valarray_meta.h (__unary_plus, __negate, diff --git a/libstdc++-v3/docs/html/abi.txt b/libstdc++-v3/docs/html/abi.txt index 70ec6605a75..216b1597121 100644 --- a/libstdc++-v3/docs/html/abi.txt +++ b/libstdc++-v3/docs/html/abi.txt @@ -30,8 +30,10 @@ I. What is an ABI? What's covered? What's not? switch between the gcc-3.0.x ABI, gcc-3.1.x ABI, and the gcc-3.2.x ABI during compilation. Other C++ compilers do allow this, and some g++ command line options may change the ABI (-fno-exceptions, see - the complete list), but there is no version switch. Sorry. The GNU - Project recommends that + the complete list), but there is no version switch. Sorry. + + To use a specific C++ABI, one must use the corresponding GNU C++ + toolchain. - How can this complexity be managed? What does C++ versioning mean? Because library and compiler changes often make binaries compiled @@ -41,27 +43,77 @@ I. What is an ABI? What's covered? What's not? easier. The following techniques are used: + - Release versioning on the libgcc_s.so binary. + It is versioned as follows: + gcc-3.0.0: libgcc_s.so.1 + gcc-3.0.1: libgcc_s.so.1 + gcc-3.0.2: libgcc_s.so.1 + gcc-3.0.3: libgcc_s.so.1 + gcc-3.0.4: libgcc_s.so.1 + gcc-3.1.0: libgcc_s.so.1 + gcc-3.1.1: libgcc_s.so.1 + gcc-3.2.0: libgcc_s.so.1 + + - Release versioning on the libstdc++.so binary. + It is versioned as follows: + gcc-3.0.0: libstdc++.so.3.0.0 + gcc-3.0.1: libstdc++.so.3.0.1 + gcc-3.0.2: libstdc++.so.3.0.2 + gcc-3.0.3: libstdc++.so.3.0.2 (Error, should be libstdc++.so.3.0.3) + gcc-3.0.4: libstdc++.so.3.0.4 + gcc-3.1.0: libstdc++.so.4.0.0 + gcc-3.1.1: libstdc++.so.4.0.1 + gcc-3.2.0: libstdc++.so.5.0.0 + + - Symbol versioning on the libgcc_s.so binary. + file: gcc/libgcc-std.ver + + It is versioned as follows: + gcc-3.0.0: GCC_3.0 + gcc-3.0.1: GCC_3.0 + gcc-3.0.2: GCC_3.0 + gcc-3.0.3: GCC_3.0 + gcc-3.0.4: GCC_3.0 + gcc-3.1.0: GCC_3.0 + gcc-3.1.1: GCC_3.0 + gcc-3.2.0: GCC_3.0 + + - Symbol versioning on the libstdc++.so binary. + + It is versioned as follows: + gcc-3.0.0: (Error, unversioned) + gcc-3.0.1: (Error, unversioned) + gcc-3.0.2: (Error, unversioned) + gcc-3.0.3: (Error, unversioned) + gcc-3.0.4: (Error, unversioned) + gcc-3.1.0: GLIBCPP_3.1, CXXABI_1 + gcc-3.1.1: GLIBCPP_3.1, CXXABI_1 + gcc-3.2.0: GLIBCPP_3.2, CXXABI_1.2 + + file: libstdc++-v3/config/linker-map.gnu + - Incremental bumping of a compiler pre-defined macro, - __GXX_ABI_VERSION. This macro will be automatically defined - whenever g++ is used (the curious can test this by invoking g++ - with the '-v' flag. + __GXX_ABI_VERSION. This macro is defined as the version of the + compiler v3 ABI, with g++ 3.0.x being version 100. This macro will + be automatically defined whenever g++ is used (the curious can + test this by invoking g++ with the '-v' flag.) This macro is defined in the file "lang-specs.h" in the gcc/cp directory. - + Later versions define it in "c-common.c" in the gcc directory. + It is versioned as follows: gcc-3.0.x: 100 - gcc-3.1.x: 100 - gcc-3.2.x: 101 + gcc-3.1.x: 100 (Error, should be 101) + gcc-3.2.x: 102 - Ask the compiler people why this makes sense, or what this macro means. - Incremental bumping of a library pre-defined macro, __GLIBCPP__. This macro is defined as the date the library was @@ -81,6 +133,7 @@ I. What is an ABI? What's covered? What's not? gcc-3.1.1: 20020725 gcc-3.2.0: (20020731) + - Incremental bumping of a library pre-defined macro, _GLIBCPP_VERSION. This macro is defined as the released version of the library, as a string literal. This is only implemented in @@ -93,20 +146,21 @@ I. What is an ABI? What's covered? What's not? It is versioned as follows: gcc-3.0.0: "3.0.0" - gcc-3.0.1: "3.0.0" - gcc-3.0.2: "3.0.0" - gcc-3.0.3: "3.0.0" - gcc-3.0.4: "3.0.0" + gcc-3.0.1: "3.0.0" (Error, should be "3.0.1") + gcc-3.0.2: "3.0.0" (Error, should be "3.0.2") + gcc-3.0.3: "3.0.0" (Error, should be "3.0.3") + gcc-3.0.4: "3.0.0" (Error, should be "3.0.4") gcc-3.1.0: "3.1.0" gcc-3.1.1: "3.1.1" gcc-3.2.0: ("3.2.0") + - Matching each specific C++ compiler release to a specific set of C++ include files. This is only implemented in gcc-3.1.1 releases and higher. All C++ includes are installed in include/c++, then nest in a - directory heirarchy corresponding to the C++ compiler's released + directory hierarchy corresponding to the C++ compiler's released version. This version corresponds to the variable "gcc_version" in "libstdc++-v3/acinclude.m4," and more details can be found in that file's macro GLIBCPP_CONFIGURE. @@ -155,7 +209,7 @@ I. What is an ABI? What's covered? What's not? When the GNU C++ library is being built with symbol versioning on, you should see the following at configure time for libstdc++-v3: -checking versioning on shared library symbols... gnu + checking versioning on shared library symbols... gnu If you don't see this line in the configure output, or if this line appears but the last word is 'no', then you are out of luck. @@ -192,7 +246,9 @@ increase, say from "libstdc++.so.3.0.4" to "libstdc++.so.4.0.0". - (anything) changing mangling on an exported symbol -- (anything) adding or deleting an exported symbol +- (anything) deleting an exported symbol + +Note: adding an exported symbol, if it's in a new linker map name, is ok. The following will cause the library revision version number to increase, say from "libstdc++.so.5.0.0" to "libstdc++.so.5.0.1". @@ -251,6 +307,11 @@ compute offsets for each structure and type in the standard library, saving to another datafile. Then, compute this for new binaries, and look for differences. +An example of a way to compute the list of names exported by the +shared libstdc++ binary is: + +nm --extern-only --portability libstdc++.so.5.0.0 | awk '{ print $1 $2}' + The thought is to choose one or both of these approaches, and to use a Makefile hook, perhaps 'make check-abi', to add this capability to the libstdc++ testsuite. @@ -270,12 +331,12 @@ V. Issues not directly addressed, and possible suggestions - directory-level versioning -- wrapping C++ API's n "C" to use the C ABI. +- wrapping C++ API's in "C" to use the C ABI. V. References -ABIcheck, a vauge idea of checking ABI compatibility +ABIcheck, a vague idea of checking ABI compatibility http://abicheck.sourceforge.net/ C++ ABI reference diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc index 7252afde323..0576472ddbe 100644 --- a/libstdc++-v3/src/strstream.cc +++ b/libstdc++-v3/src/strstream.cc @@ -60,12 +60,13 @@ namespace std : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true), _M_frozen(false), _M_constant(false) { - _M_buf_size = _M_buf_size_opt = max(initial_capacity, streamsize(16)); - _M_buf = _M_alloc(_M_buf_size); - if (_M_buf) + streamsize n = max(initial_capacity, streamsize(16)); + + char* buf = _M_alloc(n); + if (buf) { - setp(_M_buf, _M_buf + _M_buf_size); - setg(_M_buf, _M_buf, _M_buf); + setp(buf, buf + n); + setg(buf, buf, buf); } } @@ -73,12 +74,13 @@ namespace std : _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true), _M_frozen(false), _M_constant(false) { - _M_buf_size = _M_buf_size_opt = 16; - _M_buf = _M_alloc(_M_buf_size); - if (_M_buf) + streamsize n = 16; + + char* buf = _M_alloc(n); + if (buf) { - setp(_M_buf, _M_buf + _M_buf_size); - setg(_M_buf, _M_buf, _M_buf); + setp(buf, buf + n); + setg(buf, buf, buf); } } @@ -116,14 +118,7 @@ namespace std strstreambuf::~strstreambuf() { if (_M_dynamic && !_M_frozen) - { - char* p = this->eback(); - _M_free(p); - if (p == _M_buf) - _M_buf = 0; - } - if (_M_buf) - _M_free(_M_buf); + _M_free(eback()); } void @@ -169,8 +164,6 @@ namespace std old_get_offset = gptr() - eback(); } - _M_buf = buf; - _M_buf_size = _M_buf_size_opt = new_size; setp(buf, buf + new_size); pbump(old_size); diff --git a/libstdc++-v3/testsuite/19_diagnostics/stdexceptions.cc b/libstdc++-v3/testsuite/19_diagnostics/stdexceptions.cc index 1b11118da5d..267795acb75 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/stdexceptions.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/stdexceptions.cc @@ -58,7 +58,6 @@ public: void test03() { bool test = true; - try { throw fuzzy_logic(); } catch(const fuzzy_logic& obj) @@ -79,6 +78,7 @@ void allocate_on_stack(void) } void test04() { + bool test = true; const std::string s("CA ISO emergency once again:immediate power down"); const char* strlit1 = "wish I lived in Palo Alto"; const char* strlit2 = "...or Santa Barbara"; diff --git a/libstdc++-v3/testsuite/Makefile.am b/libstdc++-v3/testsuite/Makefile.am index 7733010d63a..c0e7be31b9e 100644 --- a/libstdc++-v3/testsuite/Makefile.am +++ b/libstdc++-v3/testsuite/Makefile.am @@ -36,9 +36,11 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \ AM_RUNTESTFLAGS = RUNTESTFLAGS = -CXX = @glibcpp_CXX@ @GLIBCPP_INCLUDES@ +CXX = @glibcpp_CXX@ # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES -INCLUDES = @TOPLEVEL_INCLUDES@ +INCLUDES = \ + -nostdinc++ \ + @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@ noinst_LIBRARIES = libv3test.a diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index 98ef1427369..939c0ee8074 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -148,9 +148,12 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \ AM_RUNTESTFLAGS = RUNTESTFLAGS = -CXX = @glibcpp_CXX@ @GLIBCPP_INCLUDES@ +CXX = @glibcpp_CXX@ # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES -INCLUDES = @TOPLEVEL_INCLUDES@ +INCLUDES = \ + -nostdinc++ \ + @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@ + noinst_LIBRARIES = libv3test.a diff --git a/libstdc++-v3/testsuite/backward/strstream_members.cc b/libstdc++-v3/testsuite/backward/strstream_members.cc index f8ae7d37fa7..107041041f7 100644 --- a/libstdc++-v3/testsuite/backward/strstream_members.cc +++ b/libstdc++-v3/testsuite/backward/strstream_members.cc @@ -29,12 +29,21 @@ int test01() for (unsigned i=0 ; i!= 1000 ; ++i) s << i << std::endl; s << std::ends; - return 0; } + +int test02() +{ + std::ostrstream buf; + buf << std::ends; + char *s = buf.str (); + delete [] s; +} + int main() { test01(); + test02(); return 0; } diff --git a/libstdc++-v3/testsuite/testsuite_hooks.h b/libstdc++-v3/testsuite/testsuite_hooks.h index 5725debe7e8..8cf50401c2d 100644 --- a/libstdc++-v3/testsuite/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/testsuite_hooks.h @@ -58,6 +58,7 @@ #define _GLIBCPP_TESTSUITE_HOOKS_H #include +#include #include #ifdef DEBUG_ASSERT @@ -113,7 +114,8 @@ class gnu_copy_tracker : itsId(rhs.id()), willThrow(rhs.willThrow) { ++itsCopyCount; - if (willThrow) throw "copy tracker exception"; + if (willThrow) + __throw_exception_again "copy tracker exception"; } gnu_copy_tracker& operator=(const gnu_copy_tracker& rhs)