This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] doc updates, libstdc++/7445
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 31 Jul 2002 12:00:02 -0700
- Subject: [v3] doc updates, libstdc++/7445
More ABI documentation, some named locale doc tweaks, named locale
initialization speedup for MT apps.
tested x86/linux
gcc
quequed for gcc-3_2-branch
2002-07-31 Simon Whomsley <whomsley@avacadcam.com>
* docs/html/22_locale/howto.html: Fix.
2002-07-31 Alex Kompel <shurik@sequoiap.com>
PR libstdc++/7445
* src/locale.cc (locale::classic): Move locks inside !_S_classic
block.
2002-07-31 Benjamin Kosnik <bkoz@redhat.com>
* docs/html/abi.txt: Update.
Index: docs/html/abi.txt
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/abi.txt,v
retrieving revision 1.3
diff -c -p -r1.3 abi.txt
*** docs/html/abi.txt 24 Jul 2002 19:49:21 -0000 1.3
--- docs/html/abi.txt 31 Jul 2002 19:10:47 -0000
*************** document exists, why it's incomplete, an
*** 6,25 ****
===========================
! 2002-07-23 Benjamin Kosnik
Description of the libstdc++ ABI.
I. What is an ABI? What's covered? What's not?
- What's the deal with C++? Why can't different compiler's object
files link with each other? Bug? Feature?
- - scope of document, of use to system integrators.
-
- compilation includes and linked library binary must match up..
! - library ABI, compiler ABI different (but effects)
- GNU C++ does not have a compiler command line option to switch
between various different C++ ABIs. For instance, there is no way to
--- 6,29 ----
===========================
! 2002-07-30 Benjamin Kosnik
Description of the libstdc++ ABI.
I. What is an ABI? What's covered? What's not?
+ - scope of document, of use to system integrators.
+
- What's the deal with C++? Why can't different compiler's object
files link with each other? Bug? Feature?
- compilation includes and linked library binary must match up..
! - shared library only, static is immutable.
!
! - What's an ABI?
!
! - library ABI, compiler ABI different issues, (but related)
- GNU C++ does not have a compiler command line option to switch
between various different C++ ABIs. For instance, there is no way to
*************** I. What is an ABI? What's covered? What'
*** 29,35 ****
the complete list), but there is no version switch. Sorry. The GNU
Project recommends that
! - shared library only, static is immutable.
- Minimum environment that supports a versioned ABI: what's needed? A
supported dynamic linker, a GNU linker of sufficient vintage to
--- 33,131 ----
the complete list), but there is no version switch. Sorry. The GNU
Project recommends that
! - How can this complexity be managed? What does C++ versioning mean?
! Because library and compiler changes often make binaries compiled
! with one version of the GNU tools incompatible with binaries
! compiled with other (either newer or older) versions of the same GNU
! tools, specific techniques are used to make managing this complexity
! easier.
!
! The following techniques are used:
! - Release versioning on the libgcc_s.so binary.
!
! - Release versioning on the libstdc++.so binary.
!
! - Symbol versioning on the libgcc_s.so binary.
!
! - Symbol versioning on the libstdc++.so binary.
!
! - 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.
!
! This macro is defined in the file "lang-specs.h" in the gcc/cp directory.
!
! It is versioned as follows:
! gcc-3.0.x: 100
! gcc-3.1.x: 100
! gcc-3.2.x: 101
!
! 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
! released, in compressed ISO date format, as an unsigned long.
!
! This macro is defined in the file "c++config" in the
! "libstdc++-v3/include/bits" directory and is changed every night
! by an automated script.
!
! It is versioned as follows:
! gcc-3.0.0: 20010615
! gcc-3.0.1: 20010819
! gcc-3.0.2: 20011023
! gcc-3.0.3: 20011220
! gcc-3.0.4: 20020220
! gcc-3.1.0: 20020514
! 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
! gcc-3.1.0 releases and higher.
!
! This macro is defined in the file "c++config" in the
! "libstdc++-v3/include/bits" directory and is generated
! automatically by autoconf as part of the configure-time generation
! of config.h.
!
! 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.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
! 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.
!
! C++ includes are versioned as follows:
! gcc-3.0.0: include/g++-v3
! gcc-3.0.1: include/g++-v3
! gcc-3.0.2: include/g++-v3
! gcc-3.0.3: include/g++-v3
! gcc-3.0.4: include/g++-v3
! gcc-3.1.0: include/g++-v3
! gcc-3.1.1: include/c++/3.1.1
! gcc-3.2.0: include/c++/3.2
!
! Taken together, these techniques can accurately specify interface
! and implementation changes in the GNU C++ tools themselves. Used
! properly, they allow both the GNU C++ tools implementation, and
! programs using them, an evolving yet controlled development that
! maintains backward compatibility.
- Minimum environment that supports a versioned ABI: what's needed? A
supported dynamic linker, a GNU linker of sufficient vintage to
*************** of the name, then the executable is vers
*** 81,91 ****
U _ZNSt8ios_base4InitC1Ev@@GLIBCPP_3.1
!
!
! II. ABI changes
- (anything) changing size of an exported symbol
--- 177,188 ----
U _ZNSt8ios_base4InitC1Ev@@GLIBCPP_3.1
+ II. Library ABI changes
+ The following will cause the library major version number to
+ increase, say from "libstdc++.so.3.0.4" to "libstdc++.so.4.0.0".
! - any g++ compiler ABI changes
- (anything) changing size of an exported symbol
*************** II. ABI changes
*** 96,101 ****
--- 193,203 ----
- (anything) changing mangling on an exported symbol
- (anything) adding or deleting an exported symbol
+
+ The following will cause the library revision version number to
+ increase, say from "libstdc++.so.5.0.0" to "libstdc++.so.5.0.1".
+
+ - any release of the gcc toolchain.
III. Versioning
Index: docs/html/22_locale/howto.html
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/22_locale/howto.html,v
retrieving revision 1.11
diff -c -p -r1.11 howto.html
*** docs/html/22_locale/howto.html 11 Oct 2001 18:41:44 -0000 1.11
--- docs/html/22_locale/howto.html 31 Jul 2002 19:10:47 -0000
***************
*** 163,169 ****
struct Toupper
{
! Toupper (std::locale const& l) : loc(l) {;}
char operator() (char c) { return std::toupper(c,loc); }
private:
std::locale const& loc;
--- 163,169 ----
struct Toupper
{
! Toupper(std::locale const& l) : loc(l) {;}
char operator() (char c) { return std::toupper(c,loc); }
private:
std::locale const& loc;
***************
*** 171,177 ****
struct Tolower
{
! Tolower (std::locale const& l) : loc(l) {;}
char operator() (char c) { return std::tolower(c,loc); }
private:
std::locale const& loc;
--- 171,177 ----
struct Tolower
{
! Tolower(std::locale const& l) : loc(l) {;}
char operator() (char c) { return std::tolower(c,loc); }
private:
std::locale const& loc;
***************
*** 179,204 ****
int main ()
{
! std::string s ("Some Kind Of Initial Input Goes Here");
! Toupper up ( std::locale("C") );
! Tolower down ( std::locale("C") );
! // Change everything into upper case
! std::transform (s.begin(), s.end(), s.begin(),
! up
! );
! // Change everything into lower case
! std::transform (s.begin(), s.end(), s.begin(),
! down
! );
// Change everything back into upper case, but store the
! // result in a different string
std::string capital_s;
! std::transform (s.begin(), s.end(), std::back_inserter(capital_s),
! up
! );
}</pre>
</p>
<p>The final version of the code uses <code>bind2nd</code> to eliminate
--- 179,199 ----
int main ()
{
! std::string s("Some Kind Of Initial Input Goes Here");
! std::locale loc_c("C");
! Toupper up(loc_c);
! Tolower down(loc_c);
! // Change everything into upper case.
! std::transform(s.begin(), s.end(), s.begin(), up);
! // Change everything into lower case.
! std::transform(s.begin(), s.end(), s.begin(), down);
// Change everything back into upper case, but store the
! // result in a different string.
std::string capital_s;
! std::transform(s.begin(), s.end(), std::back_inserter(capital_s), up);
}</pre>
</p>
<p>The final version of the code uses <code>bind2nd</code> to eliminate
Index: src/locale.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/locale.cc,v
retrieving revision 1.61
diff -c -p -r1.61 locale.cc
*** src/locale.cc 25 Jul 2002 06:42:00 -0000 1.61
--- src/locale.cc 31 Jul 2002 19:10:47 -0000
*************** namespace std
*** 284,294 ****
const locale&
locale::classic()
{
- static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER;
- _STL_auto_lock __auto(__lock);
-
if (!_S_classic)
{
try
{
// 26 Standard facets, 2 references.
--- 284,294 ----
const locale&
locale::classic()
{
if (!_S_classic)
{
+ static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER;
+ _STL_auto_lock __auto(__lock);
+
try
{
// 26 Standard facets, 2 references.