Commit 49bc23b7 by Benjamin Kosnik Committed by Benjamin Kosnik

Revert PR libstdc++/6594


2002-08-02  Benjamin Kosnik  <bkoz@redhat.com>

	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
parent 771a2a66
2002-08-02 Benjamin Kosnik <bkoz@redhat.com>
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 <gdr@nerim.net> 2002-08-02 Gabriel Dos Reis <gdr@nerim.net>
* include/bits/valarray_meta.h (__unary_plus, __negate, * include/bits/valarray_meta.h (__unary_plus, __negate,
......
...@@ -30,8 +30,10 @@ I. What is an ABI? What's covered? What's not? ...@@ -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 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 ABI during compilation. Other C++ compilers do allow this, and some
g++ command line options may change the ABI (-fno-exceptions, see g++ command line options may change the ABI (-fno-exceptions, see
the complete list), but there is no version switch. Sorry. The GNU the complete list), but there is no version switch. Sorry.
Project recommends that
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? - How can this complexity be managed? What does C++ versioning mean?
Because library and compiler changes often make binaries compiled Because library and compiler changes often make binaries compiled
...@@ -41,27 +43,77 @@ I. What is an ABI? What's covered? What's not? ...@@ -41,27 +43,77 @@ I. What is an ABI? What's covered? What's not?
easier. easier.
The following techniques are used: The following techniques are used:
- Release versioning on the libgcc_s.so binary. - 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. - 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. - 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. - 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, - Incremental bumping of a compiler pre-defined macro,
__GXX_ABI_VERSION. This macro will be automatically defined __GXX_ABI_VERSION. This macro is defined as the version of the
whenever g++ is used (the curious can test this by invoking g++ compiler v3 ABI, with g++ 3.0.x being version 100. This macro will
with the '-v' flag. 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. 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: It is versioned as follows:
gcc-3.0.x: 100 gcc-3.0.x: 100
gcc-3.1.x: 100 gcc-3.1.x: 100 (Error, should be 101)
gcc-3.2.x: 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, - Incremental bumping of a library pre-defined macro,
__GLIBCPP__. This macro is defined as the date the library was __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? ...@@ -81,6 +133,7 @@ I. What is an ABI? What's covered? What's not?
gcc-3.1.1: 20020725 gcc-3.1.1: 20020725
gcc-3.2.0: (20020731) gcc-3.2.0: (20020731)
- Incremental bumping of a library pre-defined macro, - Incremental bumping of a library pre-defined macro,
_GLIBCPP_VERSION. This macro is defined as the released version of _GLIBCPP_VERSION. This macro is defined as the released version of
the library, as a string literal. This is only implemented in 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? ...@@ -93,20 +146,21 @@ I. What is an ABI? What's covered? What's not?
It is versioned as follows: It is versioned as follows:
gcc-3.0.0: "3.0.0" gcc-3.0.0: "3.0.0"
gcc-3.0.1: "3.0.0" gcc-3.0.1: "3.0.0" (Error, should be "3.0.1")
gcc-3.0.2: "3.0.0" gcc-3.0.2: "3.0.0" (Error, should be "3.0.2")
gcc-3.0.3: "3.0.0" gcc-3.0.3: "3.0.0" (Error, should be "3.0.3")
gcc-3.0.4: "3.0.0" gcc-3.0.4: "3.0.0" (Error, should be "3.0.4")
gcc-3.1.0: "3.1.0" gcc-3.1.0: "3.1.0"
gcc-3.1.1: "3.1.1" gcc-3.1.1: "3.1.1"
gcc-3.2.0: ("3.2.0") gcc-3.2.0: ("3.2.0")
- Matching each specific C++ compiler release to a specific set of - Matching each specific C++ compiler release to a specific set of
C++ include files. This is only implemented in gcc-3.1.1 releases C++ include files. This is only implemented in gcc-3.1.1 releases
and higher. and higher.
All C++ includes are installed in include/c++, then nest in a 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 version. This version corresponds to the variable "gcc_version" in
"libstdc++-v3/acinclude.m4," and more details can be found in that "libstdc++-v3/acinclude.m4," and more details can be found in that
file's macro GLIBCPP_CONFIGURE. file's macro GLIBCPP_CONFIGURE.
...@@ -155,7 +209,7 @@ I. What is an ABI? What's covered? What's not? ...@@ -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, When the GNU C++ library is being built with symbol versioning on,
you should see the following at configure time for libstdc++-v3: 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 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. 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". ...@@ -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) 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 The following will cause the library revision version number to
increase, say from "libstdc++.so.5.0.0" to "libstdc++.so.5.0.1". 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, ...@@ -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 saving to another datafile. Then, compute this for new binaries, and
look for differences. 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 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 Makefile hook, perhaps 'make check-abi', to add this capability to the
libstdc++ testsuite. libstdc++ testsuite.
...@@ -270,12 +331,12 @@ V. Issues not directly addressed, and possible suggestions ...@@ -270,12 +331,12 @@ V. Issues not directly addressed, and possible suggestions
- directory-level versioning - 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 V. References
ABIcheck, a vauge idea of checking ABI compatibility ABIcheck, a vague idea of checking ABI compatibility
http://abicheck.sourceforge.net/ http://abicheck.sourceforge.net/
C++ ABI reference C++ ABI reference
......
...@@ -60,12 +60,13 @@ namespace std ...@@ -60,12 +60,13 @@ namespace std
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true), : _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true),
_M_frozen(false), _M_constant(false) _M_frozen(false), _M_constant(false)
{ {
_M_buf_size = _M_buf_size_opt = max(initial_capacity, streamsize(16)); streamsize n = max(initial_capacity, streamsize(16));
_M_buf = _M_alloc(_M_buf_size);
if (_M_buf) char* buf = _M_alloc(n);
if (buf)
{ {
setp(_M_buf, _M_buf + _M_buf_size); setp(buf, buf + n);
setg(_M_buf, _M_buf, _M_buf); setg(buf, buf, buf);
} }
} }
...@@ -73,12 +74,13 @@ namespace std ...@@ -73,12 +74,13 @@ namespace std
: _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true), : _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true),
_M_frozen(false), _M_constant(false) _M_frozen(false), _M_constant(false)
{ {
_M_buf_size = _M_buf_size_opt = 16; streamsize n = 16;
_M_buf = _M_alloc(_M_buf_size);
if (_M_buf) char* buf = _M_alloc(n);
if (buf)
{ {
setp(_M_buf, _M_buf + _M_buf_size); setp(buf, buf + n);
setg(_M_buf, _M_buf, _M_buf); setg(buf, buf, buf);
} }
} }
...@@ -116,14 +118,7 @@ namespace std ...@@ -116,14 +118,7 @@ namespace std
strstreambuf::~strstreambuf() strstreambuf::~strstreambuf()
{ {
if (_M_dynamic && !_M_frozen) if (_M_dynamic && !_M_frozen)
{ _M_free(eback());
char* p = this->eback();
_M_free(p);
if (p == _M_buf)
_M_buf = 0;
}
if (_M_buf)
_M_free(_M_buf);
} }
void void
...@@ -169,8 +164,6 @@ namespace std ...@@ -169,8 +164,6 @@ namespace std
old_get_offset = gptr() - eback(); old_get_offset = gptr() - eback();
} }
_M_buf = buf;
_M_buf_size = _M_buf_size_opt = new_size;
setp(buf, buf + new_size); setp(buf, buf + new_size);
pbump(old_size); pbump(old_size);
......
...@@ -58,7 +58,6 @@ public: ...@@ -58,7 +58,6 @@ public:
void test03() void test03()
{ {
bool test = true; bool test = true;
try try
{ throw fuzzy_logic(); } { throw fuzzy_logic(); }
catch(const fuzzy_logic& obj) catch(const fuzzy_logic& obj)
...@@ -79,6 +78,7 @@ void allocate_on_stack(void) ...@@ -79,6 +78,7 @@ void allocate_on_stack(void)
} }
void test04() void test04()
{ {
bool test = true;
const std::string s("CA ISO emergency once again:immediate power down"); const std::string s("CA ISO emergency once again:immediate power down");
const char* strlit1 = "wish I lived in Palo Alto"; const char* strlit1 = "wish I lived in Palo Alto";
const char* strlit2 = "...or Santa Barbara"; const char* strlit2 = "...or Santa Barbara";
......
...@@ -36,9 +36,11 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \ ...@@ -36,9 +36,11 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \
AM_RUNTESTFLAGS = AM_RUNTESTFLAGS =
RUNTESTFLAGS = RUNTESTFLAGS =
CXX = @glibcpp_CXX@ @GLIBCPP_INCLUDES@ CXX = @glibcpp_CXX@
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
INCLUDES = @TOPLEVEL_INCLUDES@ INCLUDES = \
-nostdinc++ \
@GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@
noinst_LIBRARIES = libv3test.a noinst_LIBRARIES = libv3test.a
......
...@@ -148,9 +148,12 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \ ...@@ -148,9 +148,12 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \
AM_RUNTESTFLAGS = AM_RUNTESTFLAGS =
RUNTESTFLAGS = RUNTESTFLAGS =
CXX = @glibcpp_CXX@ @GLIBCPP_INCLUDES@ CXX = @glibcpp_CXX@
# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
INCLUDES = @TOPLEVEL_INCLUDES@ INCLUDES = \
-nostdinc++ \
@GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@
noinst_LIBRARIES = libv3test.a noinst_LIBRARIES = libv3test.a
......
...@@ -29,12 +29,21 @@ int test01() ...@@ -29,12 +29,21 @@ int test01()
for (unsigned i=0 ; i!= 1000 ; ++i) for (unsigned i=0 ; i!= 1000 ; ++i)
s << i << std::endl; s << i << std::endl;
s << std::ends; s << std::ends;
return 0; return 0;
} }
int test02()
{
std::ostrstream buf;
buf << std::ends;
char *s = buf.str ();
delete [] s;
}
int main() int main()
{ {
test01(); test01();
test02();
return 0; return 0;
} }
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#define _GLIBCPP_TESTSUITE_HOOKS_H #define _GLIBCPP_TESTSUITE_HOOKS_H
#include <bits/c++config.h> #include <bits/c++config.h>
#include <bits/functexcept.h>
#include <cstddef> #include <cstddef>
#ifdef DEBUG_ASSERT #ifdef DEBUG_ASSERT
...@@ -113,7 +114,8 @@ class gnu_copy_tracker ...@@ -113,7 +114,8 @@ class gnu_copy_tracker
: itsId(rhs.id()), willThrow(rhs.willThrow) : itsId(rhs.id()), willThrow(rhs.willThrow)
{ {
++itsCopyCount; ++itsCopyCount;
if (willThrow) throw "copy tracker exception"; if (willThrow)
__throw_exception_again "copy tracker exception";
} }
gnu_copy_tracker& operator=(const gnu_copy_tracker& rhs) gnu_copy_tracker& operator=(const gnu_copy_tracker& rhs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment