Gcc 3.4.4 C++ support bits.

This commit is contained in:
Alexander Kabaev 2005-06-03 03:29:38 +00:00
parent d51085f37e
commit f260e61b15
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/gcc/dist/; revision=146897
68 changed files with 64530 additions and 30397 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -35,13 +35,6 @@ It has subdirectories:
names into the std:: namespace.
[NB: this is the default, and is the same as --enable-cheaders=c_std]
include/c_shadow
Headers intended to shadow standard C headers provided by an
underlying OS or C library, and other headers depended on directly
by C++ headers (e.g. unistd.h). These are meant to wrap the names
defined there into the _C_legacy namespace.
[NB: this can be enabled via --enable-cheaders=c_shadow]
include/bits
Files included by standard headers and by other files in
the bits directory.

View File

@ -48,6 +48,9 @@
// Define if LFS support is available.
#undef _GLIBCXX_USE_LFS
// Define if a fully dynamic basic_string is wanted.
#undef _GLIBCXX_FULLY_DYNAMIC_STRING
// Define if NLS translations are to be used.
#undef _GLIBCXX_USE_NLS

View File

@ -619,6 +619,25 @@ AC_DEFUN([GLIBCXX_CHECK_LFS], [
])
dnl
dnl Check for whether a fully dynamic basic_string implementation should
dnl be turned on, that does not put empty objects in per-process static
dnl memory (mostly useful together with shared memory allocators, see PR
dnl libstdc++/16612 for details).
dnl
dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING
dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined
dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'.
dnl
AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory])
if test $enable_fully_dynamic_string = yes; then
AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING)
fi
])
dnl
dnl Does any necessary configuration of the testsuite directory. Generates
dnl the testsuite_hooks.h header.

View File

@ -632,6 +632,25 @@ AC_DEFUN([GLIBCXX_CHECK_LFS], [
])
dnl
dnl Check for whether a fully dynamic basic_string implementation should
dnl be turned on, that does not put empty objects in per-process static
dnl memory (mostly useful together with shared memory allocators, see PR
dnl libstdc++/16612 for details).
dnl
dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING
dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined
dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'.
dnl
AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory])
if test $enable_fully_dynamic_string = yes; then
AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING)
fi
])
dnl
dnl Does any necessary configuration of the testsuite directory. Generates
dnl the testsuite_hooks.h header.
@ -1612,6 +1631,23 @@ if test $enable_symvers != no; then
CFLAGS=' -lgcc_s'
AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
CFLAGS="$ac_save_CFLAGS"
if test $glibcxx_shared_libgcc = no; then
cat > conftest.c <<EOF
int main (void) { return 0; }
EOF
changequote(,)dnl
glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
-shared -shared-libgcc -o conftest.so \
conftest.c -v 2>&1 >/dev/null \
| sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
changequote([,])dnl
rm -f conftest.c conftest.so
if test x${glibcxx_libgcc_s_suffix+set} = xset; then
CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix"
AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes)
CFLAGS="$ac_save_CFLAGS"
fi
fi
AC_MSG_RESULT($glibcxx_shared_libgcc)
fi

View File

@ -49,6 +49,9 @@
// Define if LFS support is available.
#undef _GLIBCXX_USE_LFS
// Define if a fully dynamic basic_string is wanted.
#undef _GLIBCXX_FULLY_DYNAMIC_STRING
// Define if NLS translations are to be used.
#undef _GLIBCXX_USE_NLS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -189,10 +189,17 @@ namespace std
__basic_file* __ret = NULL;
if (!this->is_open() && __file)
{
_M_cfile = __file;
_M_cfile_created = false;
this->sync();
__ret = this;
int __err;
errno = 0;
do
__err = this->sync();
while (__err && errno == EINTR);
if (!__err)
{
_M_cfile = __file;
_M_cfile_created = false;
__ret = this;
}
}
return __ret;
}
@ -252,12 +259,21 @@ namespace std
__basic_file* __ret = static_cast<__basic_file*>(NULL);
if (this->is_open())
{
int __err = 0;
if (_M_cfile_created)
fclose(_M_cfile);
else
this->sync();
{
// In general, no need to zero errno in advance if checking
// for error first. However, C89/C99 (at variance with IEEE
// 1003.1, f.i.) do not mandate that fclose must set errno
// upon error.
errno = 0;
do
__err = fclose(_M_cfile);
while (__err && errno == EINTR);
}
_M_cfile = 0;
__ret = this;
if (!__err)
__ret = this;
}
return __ret;
}

View File

@ -1,6 +1,6 @@
// underlying io library -*- C++ -*-
// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
// Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -43,6 +43,7 @@ namespace std
// for basic_file.h
typedef FILE __c_file;
// XXX GLIBCXX_ABI Deprecated
// for ios_base.h
struct __ios_flags
{

View File

@ -102,6 +102,10 @@ GLIBCXX_3.4 {
# operator delete[](void*, std::nothrow_t const&)
_ZdaPvRKSt9nothrow_t;
# std::basic_iostream constructors, destructors
_ZNSdC*;
_ZNSdD*;
# std::locale destructors
_ZNSt6localeD*;
@ -259,12 +263,36 @@ GLIBCXX_3.4.2 {
_ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4fileEv;
_ZN9__gnu_cxx11__pool_base9_M_refillE[jm];
_ZN9__gnu_cxx11__pool_base16_M_get_free_listE[jm];
_ZN9__gnu_cxx11__pool_base12_M_get_mutexEv;
_ZN9__gnu_cxx17__pool_alloc_base9_M_refillE[jm];
_ZN9__gnu_cxx17__pool_alloc_base16_M_get_free_listE[jm];
_ZN9__gnu_cxx17__pool_alloc_base12_M_get_mutexEv;
} GLIBCXX_3.4.1;
GLIBCXX_3.4.3 {
# stub functions from libmath
acosf;
acosl;
asinf;
asinl;
atanf;
atanl;
ceilf;
ceill;
floorf;
floorl;
fmodf;
fmodl;
frexpf;
frexpl;
ldexpf;
ldexpl;
modff;
modfl;
} GLIBCXX_3.4.2;
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {

View File

@ -57,7 +57,7 @@ namespace std
setlocale(LC_ALL, "C");
char* __sanity;
errno = 0;
#if defined(_GLIBCXX_USE_C99)
#if defined(_GLIBCXX_HAVE_STRTOF)
float __f = strtof(__s, &__sanity);
#else
double __d = strtod(__s, &__sanity);
@ -117,7 +117,7 @@ namespace std
// Assumes __s formatted for "C" locale.
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "C");
#if defined(_GLIBCXX_USE_C99)
#if defined(_GLIBCXX_HAVE_STRTOLD)
char* __sanity;
errno = 0;
long double __ld = strtold(__s, &__sanity);

View File

@ -57,27 +57,28 @@ namespace std
__convert_from_v(char* __out,
const int __size __attribute__((__unused__)),
const char* __fmt,
_Tv __v, const __c_locale&, int __prec = -1)
_Tv __v, const __c_locale&, int __prec)
{
char* __old = std::setlocale(LC_ALL, NULL);
char* __sav = new char[std::strlen(__old) + 1];
std::strcpy(__sav, __old);
std::setlocale(LC_ALL, "C");
char* __old = std::setlocale(LC_NUMERIC, NULL);
char* __sav = NULL;
if (std::strcmp(__old, "C"))
{
__sav = new char[std::strlen(__old) + 1];
std::strcpy(__sav, __old);
std::setlocale(LC_NUMERIC, "C");
}
int __ret;
#ifdef _GLIBCXX_USE_C99
if (__prec >= 0)
__ret = std::snprintf(__out, __size, __fmt, __prec, __v);
else
__ret = std::snprintf(__out, __size, __fmt, __v);
const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
#else
if (__prec >= 0)
__ret = std::sprintf(__out, __fmt, __prec, __v);
else
__ret = std::sprintf(__out, __fmt, __v);
const int __ret = std::sprintf(__out, __fmt, __prec, __v);
#endif
std::setlocale(LC_ALL, __sav);
delete [] __sav;
if (__sav)
{
std::setlocale(LC_NUMERIC, __sav);
delete [] __sav;
}
return __ret;
}
}

View File

@ -46,9 +46,12 @@ namespace std
{
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, _M_name_timepunct);
strftime(__s, __maxlen, __format, __tm);
const size_t __len = strftime(__s, __maxlen, __format, __tm);
setlocale(LC_ALL, __old);
free(__old);
// Make sure __s is null terminated.
if (__len == 0)
__s[0] = '\0';
}
template<>
@ -125,9 +128,12 @@ namespace std
{
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, _M_name_timepunct);
wcsftime(__s, __maxlen, __format, __tm);
const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
setlocale(LC_ALL, __old);
free(__old);
// Make sure __s is null terminated.
if (__len == 0)
__s[0] = L'\0';
}
template<>

View File

@ -68,11 +68,11 @@ namespace std
int
__convert_from_v(char* __out, const int __size, const char* __fmt,
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
_Tv __v, const __c_locale& __cloc, int __prec = -1)
_Tv __v, const __c_locale& __cloc, int __prec)
{
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
_Tv __v, const __c_locale&, int __prec = -1)
_Tv __v, const __c_locale&, int __prec)
{
char* __old = std::setlocale(LC_ALL, NULL);
char* __sav = new char[std::strlen(__old) + 1];
@ -80,17 +80,10 @@ namespace std
std::setlocale(LC_ALL, "C");
#endif
int __ret;
#ifdef _GLIBCXX_USE_C99
if (__prec >= 0)
__ret = std::snprintf(__out, __size, __fmt, __prec, __v);
else
__ret = std::snprintf(__out, __size, __fmt, __v);
const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
#else
if (__prec >= 0)
__ret = std::sprintf(__out, __fmt, __prec, __v);
else
__ret = std::sprintf(__out, __fmt, __v);
const int __ret = std::sprintf(__out, __fmt, __prec, __v);
#endif
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)

View File

@ -199,7 +199,7 @@ namespace std
}
break;
default:
;
__ret = pattern();
}
return __ret;
}

View File

@ -46,14 +46,18 @@ namespace std
const tm* __tm) const
{
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__strftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
_M_c_locale_timepunct);
#else
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, _M_name_timepunct);
strftime(__s, __maxlen, __format, __tm);
const size_t __len = strftime(__s, __maxlen, __format, __tm);
setlocale(LC_ALL, __old);
free(__old);
#endif
// Make sure __s is null terminated.
if (__len == 0)
__s[0] = '\0';
}
template<>
@ -194,14 +198,18 @@ namespace std
const tm* __tm) const
{
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
_M_c_locale_timepunct);
#else
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, _M_name_timepunct);
wcsftime(__s, __maxlen, __format, __tm);
const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
setlocale(LC_ALL, __old);
free(__old);
#endif
// Make sure __s is null terminated.
if (__len == 0)
__s[0] = L'\0';
}
template<>

View File

@ -281,7 +281,6 @@
result __ret = codecvt_base::error;
if (__state._M_good())
{
typedef state_type::__desc_type __desc_type;
const __desc_type* __desc = __state._M_get_out_descriptor();
const size_t __fmultiple = sizeof(intern_type);
size_t __fbytes = __fmultiple * (__from_end - __from);
@ -303,7 +302,8 @@
if (__int_bom)
{
size_t __size = __from_end - __from;
intern_type* __cfixed = static_cast<intern_type*>(__builtin_alloca(sizeof(intern_type) * (__size + 1)));
intern_type* __cfixed = static_cast<intern_type*>
(__builtin_alloca(sizeof(intern_type) * (__size + 1)));
__cfixed[0] = static_cast<intern_type>(__int_bom);
char_traits<intern_type>::copy(__cfixed + 1, __from, __size);
__cfrom = reinterpret_cast<char*>(__cfixed);
@ -348,7 +348,6 @@
result __ret = codecvt_base::error;
if (__state._M_good())
{
typedef state_type::__desc_type __desc_type;
const __desc_type* __desc = __state._M_get_in_descriptor();
const size_t __tmultiple = sizeof(intern_type);
size_t __tlen = __tmultiple * (__to_end - __to);
@ -386,7 +385,6 @@
result __ret = codecvt_base::error;
if (__state._M_good())
{
typedef state_type::__desc_type __desc_type;
const __desc_type* __desc = __state._M_get_in_descriptor();
const size_t __fmultiple = sizeof(extern_type);
size_t __flen = __fmultiple * (__from_end - __from);
@ -408,7 +406,8 @@
if (__ext_bom)
{
size_t __size = __from_end - __from;
extern_type* __cfixed = static_cast<extern_type*>(__builtin_alloca(sizeof(extern_type) * (__size + 1)));
extern_type* __cfixed = static_cast<extern_type*>
(__builtin_alloca(sizeof(extern_type) * (__size + 1)));
__cfixed[0] = static_cast<extern_type>(__ext_bom);
char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
__cfrom = reinterpret_cast<char*>(__cfixed);

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=6:2:0
libtool_VERSION=6:3:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.
@ -94,6 +94,7 @@ GLIBCXX_ENABLE_CONCEPT_CHECKS([no])
GLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0"])
GLIBCXX_ENABLE_DEBUG([no])
GLIBCXX_ENABLE_CXX_FLAGS
GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
# No surprises, no surprises...
if test $atomicity_dir = cpu/generic ; then
@ -193,7 +194,6 @@ else
# GLIBCXX_CHECK_STDLIB_SUPPORT
AC_DEFINE(HAVE_STRTOF)
AC_DEFINE(HAVE_STRTOLD)
# AC_FUNC_MMAP
AC_DEFINE(HAVE_MMAP)

View File

@ -221,22 +221,33 @@ esac
# Set any OS-dependent and CPU-dependent bits.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
case "${host}" in
mips*-*-linux*)
atomicity_dir="cpu/mips"
;;
x86_64-*-linux*)
abi_baseline_pair="x86_64-linux-gnu"
;;
alpha*-*-freebsd5*)
abi_baseline_pair="alpha-freebsd5"
;;
arm*-*-linux*)
abi_baseline_pair="arm-linux-gnu"
;;
i*86-*-freebsd4*)
abi_baseline_pair="i386-freebsd4"
;;
i*86-*-freebsd5*)
abi_baseline_pair="i386-freebsd5"
;;
mips*-*-linux*)
atomicity_dir="cpu/mips"
abi_baseline_pair="mips-linux-gnu"
cpu_include_dir="cpu/mips"
;;
s390-*-linux*)
abi_baseline_pair="s390-linux-gnu"
;;
s390x-*-linux*)
abi_baseline_pair="s390x-linux-gnu"
;;
sparc*-*-freebsd5*)
abi_baseline_pair="sparc-freebsd5"
;;
x86_64-*-linux*)
abi_baseline_pair="x86_64-linux-gnu"
;;
esac

View File

@ -392,8 +392,13 @@ case "${host}" in
AC_DEFINE(HAVE___BUILTIN_SINF)
;;
esac
AC_DEFINE(HAVE_STRTOF)
AC_DEFINE(HAVE_STRTOLD)
case "$target" in
*-*-solaris2.10)
# These two C99 functions are present only in Solaris >= 10
AC_DEFINE(HAVE_STRTOF)
AC_DEFINE(HAVE_STRTOLD)
;;
esac
AC_DEFINE(HAVE_MMAP)
AC_DEFINE(HAVE_COPYSIGN)
AC_DEFINE(HAVE_ISNAN)

View File

@ -204,7 +204,6 @@ ext_headers = \
${ext_srcdir}/algorithm \
${ext_srcdir}/bitmap_allocator.h \
${ext_srcdir}/debug_allocator.h \
${ext_srcdir}/demangle.h \
${ext_srcdir}/enc_filebuf.h \
${ext_srcdir}/stdio_filebuf.h \
${ext_srcdir}/stdio_sync_filebuf.h \

View File

@ -404,7 +404,6 @@ ext_headers = \
${ext_srcdir}/algorithm \
${ext_srcdir}/bitmap_allocator.h \
${ext_srcdir}/debug_allocator.h \
${ext_srcdir}/demangle.h \
${ext_srcdir}/enc_filebuf.h \
${ext_srcdir}/stdio_filebuf.h \
${ext_srcdir}/stdio_sync_filebuf.h \

View File

@ -211,7 +211,9 @@ namespace std
void
_M_dispose(const _Alloc& __a)
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (__builtin_expect(this != &_S_empty_rep(), false))
#endif
if (__gnu_cxx::__exchange_and_add(&this->_M_refcount, -1) <= 0)
_M_destroy(__a);
} // XXX MT
@ -222,7 +224,9 @@ namespace std
_CharT*
_M_refcopy() throw()
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (__builtin_expect(this != &_S_empty_rep(), false))
#endif
__gnu_cxx::__atomic_add(&this->_M_refcount, 1);
return _M_refdata();
} // XXX MT
@ -1846,9 +1850,11 @@ namespace std
*
* Returns an integer < 0 if this string is ordered before @a str, 0 if
* their values are equivalent, or > 0 if this string is ordered after
* @a str. If the lengths of @a str and this string are different, the
* shorter one is ordered first. If they are the same, returns the
* result of traits::compare(data(),str.data(),size());
* @a str. Determines the effective length rlen of the strings to
* compare as the smallest of size() and str.size(). The function
* then compares the two strings by calling traits::compare(data(),
* str.data(),rlen). If the result of the comparison is nonzero returns
* it, otherwise the shorter one is ordered first.
*/
int
compare(const basic_string& __str) const
@ -1873,10 +1879,12 @@ namespace std
* Form the substring of this string from the @a n characters starting
* at @a pos. Returns an integer < 0 if the substring is ordered
* before @a str, 0 if their values are equivalent, or > 0 if the
* substring is ordered after @a str. If the lengths @a of str and the
* substring are different, the shorter one is ordered first. If they
* are the same, returns the result of
* traits::compare(substring.data(),str.data(),size());
* substring is ordered after @a str. Determines the effective length
* rlen of the strings to compare as the smallest of the length of the
* substring and @a str.size(). The function then compares the two
* strings by calling traits::compare(substring.data(),str.data(),rlen).
* If the result of the comparison is nonzero returns it, otherwise the
* shorter one is ordered first.
*/
int
compare(size_type __pos, size_type __n, const basic_string& __str) const;
@ -1895,10 +1903,12 @@ namespace std
* starting at @a pos2. Returns an integer < 0 if this substring is
* ordered before the substring of @a str, 0 if their values are
* equivalent, or > 0 if this substring is ordered after the substring
* of @a str. If the lengths of the substring of @a str and this
* substring are different, the shorter one is ordered first. If they
* are the same, returns the result of
* traits::compare(substring.data(),str.substr(pos2,n2).data(),size());
* of @a str. Determines the effective length rlen of the strings
* to compare as the smallest of the lengths of the substrings. The
* function then compares the two strings by calling
* traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen).
* If the result of the comparison is nonzero returns it, otherwise the
* shorter one is ordered first.
*/
int
compare(size_type __pos1, size_type __n1, const basic_string& __str,
@ -1911,9 +1921,12 @@ namespace std
*
* Returns an integer < 0 if this string is ordered before @a s, 0 if
* their values are equivalent, or > 0 if this string is ordered after
* @a s. If the lengths of @a s and this string are different, the
* shorter one is ordered first. If they are the same, returns the
* result of traits::compare(data(),s,size());
* @a s. Determines the effective length rlen of the strings to
* compare as the smallest of size() and the length of a string
* constructed from @a s. The function then compares the two strings
* by calling traits::compare(data(),s,rlen). If the result of the
* comparison is nonzero returns it, otherwise the shorter one is
* ordered first.
*/
int
compare(const _CharT* __s) const;
@ -1930,10 +1943,13 @@ namespace std
* Form the substring of this string from the @a n1 characters starting
* at @a pos. Returns an integer < 0 if the substring is ordered
* before @a s, 0 if their values are equivalent, or > 0 if the
* substring is ordered after @a s. If the lengths of @a s and the
* substring are different, the shorter one is ordered first. If they
* are the same, returns the result of
* traits::compare(substring.data(),s,size());
* substring is ordered after @a s. Determines the effective length
* rlen of the strings to compare as the smallest of the length of the
* substring and the length of a string constructed from @a s. The
* function then compares the two string by calling
* traits::compare(substring.data(),s,rlen). If the result of the
* comparison is nonzero returns it, otherwise the shorter one is
* ordered first.
*/
int
compare(size_type __pos, size_type __n1, const _CharT* __s) const;
@ -1950,10 +1966,12 @@ namespace std
* at @a pos1. Form a string from the first @a n2 characters of @a s.
* Returns an integer < 0 if this substring is ordered before the string
* from @a s, 0 if their values are equivalent, or > 0 if this substring
* is ordered after the string from @a s. If the lengths of this
* substring and @a n2 are different, the shorter one is ordered first.
* If they are the same, returns the result of
* traits::compare(substring.data(),s,size());
* is ordered after the string from @a s. Determines the effective
* length rlen of the strings to compare as the smallest of the length
* of the substring and @a n2. The function then compares the two
* strings by calling traits::compare(substring.data(),s,rlen). If the
* result of the comparison is nonzero returns it, otherwise the shorter
* one is ordered first.
*
* NB: s must have at least n2 characters, '\0' has no special
* meaning.
@ -1963,11 +1981,14 @@ namespace std
size_type __n2) const;
};
template<typename _CharT, typename _Traits, typename _Alloc>
inline basic_string<_CharT, _Traits, _Alloc>::
basic_string()
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
: _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
#else
: _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()) { }
#endif
// operator+
/**

View File

@ -88,8 +88,10 @@ namespace std
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
input_iterator_tag)
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (__beg == __end && __a == _Alloc())
return _S_empty_rep()._M_refdata();
#endif
// Avoid reallocation for common case.
_CharT __buf[128];
size_type __len = 0;
@ -134,11 +136,12 @@ namespace std
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
forward_iterator_tag)
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (__beg == __end && __a == _Alloc())
return _S_empty_rep()._M_refdata();
#endif
// NB: Not required, but considered best practice.
if (__builtin_expect(__is_null_pointer(__beg), 0))
if (__builtin_expect(__is_null_pointer(__beg) && __beg != __end, 0))
__throw_logic_error(__N("basic_string::_S_construct NULL not valid"));
const size_type __dnew = static_cast<size_type>(std::distance(__beg,
@ -162,9 +165,10 @@ namespace std
basic_string<_CharT, _Traits, _Alloc>::
_S_construct(size_type __n, _CharT __c, const _Alloc& __a)
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (__n == 0 && __a == _Alloc())
return _S_empty_rep()._M_refdata();
#endif
// Check for out_of_range and length_error exceptions.
_Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
if (__n)
@ -358,8 +362,10 @@ namespace std
basic_string<_CharT, _Traits, _Alloc>::_Rep::
_M_destroy(const _Alloc& __a) throw ()
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (this == &_S_empty_rep())
return;
return;
#endif
const size_type __size = sizeof(_Rep_base) +
(this->_M_capacity + 1) * sizeof(_CharT);
_Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);
@ -369,8 +375,10 @@ namespace std
void
basic_string<_CharT, _Traits, _Alloc>::_M_leak_hard()
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
if (_M_rep() == &_S_empty_rep())
return;
return;
#endif
if (_M_rep()->_M_is_shared())
_M_mutate(0, 0, 0);
_M_rep()->_M_set_leaked();
@ -385,8 +393,7 @@ namespace std
const size_type __new_size = __old_size + __len2 - __len1;
const size_type __how_much = __old_size - __pos - __len1;
if (_M_rep() == &_S_empty_rep()
|| _M_rep()->_M_is_shared() || __new_size > capacity())
if (__new_size > capacity() || _M_rep()->_M_is_shared())
{
// Must reallocate.
const allocator_type __a = get_allocator();

View File

@ -727,9 +727,8 @@ struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
__function_requires< _DefaultConstructibleConcept<_Sequence> >();
_Sequence
__c _IsUnused(__n),
__c2 _IsUnused(__n, __t),
__c3 _IsUnused(__first, __last);
__c _IsUnused(__n, __t),
__c2 _IsUnused(__first, __last);
__c.insert(__p, __t);
__c.insert(__p, __n, __t);

View File

@ -35,7 +35,7 @@
#include <bits/os_defines.h>
// The current version of the C++ library in compressed ISO date format.
#define __GLIBCXX__ 20040728
#define __GLIBCXX__ 20050519
// Allow use of "export template." This is currently not a feature
// that g++ supports.

View File

@ -396,8 +396,7 @@ namespace std
// Convert pending sequence to external representation,
// and output.
if (_M_convert_to_external(this->pbase(),
this->pptr() - this->pbase())
&& (!__testeof || !_M_file.sync()))
this->pptr() - this->pbase()))
{
_M_set_buffer(0);
__ret = traits_type::not_eof(__c);
@ -494,6 +493,74 @@ namespace std
return __elen == __plen;
}
template<typename _CharT, typename _Traits>
streamsize
basic_filebuf<_CharT, _Traits>::
xsgetn(_CharT* __s, streamsize __n)
{
// Clear out pback buffer before going on to the real deal...
streamsize __ret = 0;
if (this->_M_pback_init)
{
if (__n > 0 && this->gptr() == this->eback())
{
*__s++ = *this->gptr();
this->gbump(1);
__ret = 1;
--__n;
}
_M_destroy_pback();
}
// Optimization in the always_noconv() case, to be generalized in the
// future: when __n > __buflen we read directly instead of using the
// buffer repeatedly.
const bool __testin = this->_M_mode & ios_base::in;
const streamsize __buflen = this->_M_buf_size > 1 ? this->_M_buf_size - 1
: 1;
if (__n > __buflen && __check_facet(_M_codecvt).always_noconv()
&& __testin && !_M_writing)
{
// First, copy the chars already present in the buffer.
const streamsize __avail = this->egptr() - this->gptr();
if (__avail != 0)
{
if (__avail == 1)
*__s = *this->gptr();
else
traits_type::copy(__s, this->gptr(), __avail);
__s += __avail;
this->gbump(__avail);
__ret += __avail;
__n -= __avail;
}
const streamsize __len = _M_file.xsgetn(reinterpret_cast<char*>(__s),
__n);
if (__len == -1)
__throw_ios_failure(__N("basic_filebuf::xsgetn "
"error reading the file"));
__ret += __len;
if (__len == __n)
{
_M_set_buffer(0);
_M_reading = true;
}
else if (__len == 0)
{
// If end of file is reached, set 'uncommitted'
// mode, thus allowing an immediate write without
// an intervening seek.
_M_set_buffer(-1);
_M_reading = false;
}
}
else
__ret += __streambuf_type::xsgetn(__s, __n);
return __ret;
}
template<typename _CharT, typename _Traits>
streamsize
basic_filebuf<_CharT, _Traits>::
@ -504,8 +571,8 @@ namespace std
// using the buffer.
streamsize __ret = 0;
const bool __testout = this->_M_mode & ios_base::out;
if (__testout && !_M_reading
&& __check_facet(_M_codecvt).always_noconv())
if (__check_facet(_M_codecvt).always_noconv()
&& __testout && !_M_reading)
{
// Measurement would reveal the best choice.
const streamsize __chunk = 1ul << 10;
@ -724,7 +791,6 @@ namespace std
{
// Make sure that the internal buffer resyncs its idea of
// the file position with the external file.
// NB: _M_file.sync() will be called within.
int __ret = 0;
if (this->pbase() < this->pptr())
{

View File

@ -52,7 +52,28 @@ namespace std
// as permitted (but not required) in the standard, in order to provide
// better type safety in iostream calls. A side effect is that
// expressions involving them are no longer compile-time constants.
enum _Ios_Fmtflags { _S_ios_fmtflags_end = 1L << 16 };
enum _Ios_Fmtflags
{
_S_boolalpha = 1L << 0,
_S_dec = 1L << 1,
_S_fixed = 1L << 2,
_S_hex = 1L << 3,
_S_internal = 1L << 4,
_S_left = 1L << 5,
_S_oct = 1L << 6,
_S_right = 1L << 7,
_S_scientific = 1L << 8,
_S_showbase = 1L << 9,
_S_showpoint = 1L << 10,
_S_showpos = 1L << 11,
_S_skipws = 1L << 12,
_S_unitbuf = 1L << 13,
_S_uppercase = 1L << 14,
_S_adjustfield = _S_left | _S_right | _S_internal,
_S_basefield = _S_dec | _S_oct | _S_hex,
_S_floatfield = _S_scientific | _S_fixed,
_S_ios_fmtflags_end = 1L << 16
};
inline _Ios_Fmtflags
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
@ -66,15 +87,15 @@ namespace std
operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Fmtflags
inline _Ios_Fmtflags&
operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a | __b; }
inline _Ios_Fmtflags
inline _Ios_Fmtflags&
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a & __b; }
inline _Ios_Fmtflags
inline _Ios_Fmtflags&
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a ^ __b; }
@ -83,7 +104,16 @@ namespace std
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
enum _Ios_Openmode { _S_ios_openmode_end = 1L << 16 };
enum _Ios_Openmode
{
_S_app = 1L << 0,
_S_ate = 1L << 1,
_S_bin = 1L << 2,
_S_in = 1L << 3,
_S_out = 1L << 4,
_S_trunc = 1L << 5,
_S_ios_openmode_end = 1L << 16
};
inline _Ios_Openmode
operator&(_Ios_Openmode __a, _Ios_Openmode __b)
@ -97,15 +127,15 @@ namespace std
operator^(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Openmode
inline _Ios_Openmode&
operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a | __b; }
inline _Ios_Openmode
inline _Ios_Openmode&
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a & __b; }
inline _Ios_Openmode
inline _Ios_Openmode&
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a ^ __b; }
@ -114,7 +144,14 @@ namespace std
{ return _Ios_Openmode(~static_cast<int>(__a)); }
enum _Ios_Iostate { _S_ios_iostate_end = 1L << 16 };
enum _Ios_Iostate
{
_S_goodbit = 0,
_S_badbit = 1L << 0,
_S_eofbit = 1L << 1,
_S_failbit = 1L << 2,
_S_ios_iostate_end = 1L << 16
};
inline _Ios_Iostate
operator&(_Ios_Iostate __a, _Ios_Iostate __b)
@ -128,15 +165,15 @@ namespace std
operator^(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Iostate
inline _Ios_Iostate&
operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a | __b; }
inline _Ios_Iostate
inline _Ios_Iostate&
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a & __b; }
inline _Ios_Iostate
inline _Ios_Iostate&
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a ^ __b; }
@ -144,7 +181,13 @@ namespace std
operator~(_Ios_Iostate __a)
{ return _Ios_Iostate(~static_cast<int>(__a)); }
enum _Ios_Seekdir { _S_ios_seekdir_end = 1L << 16 };
enum _Ios_Seekdir
{
_S_beg = 0,
_S_cur = SEEK_CUR,
_S_end = SEEK_END,
_S_ios_seekdir_end = 1L << 16
};
// 27.4.2 Class ios_base
/**

View File

@ -1176,11 +1176,15 @@ namespace std
extern template istream& operator>>(istream&, unsigned char*);
extern template istream& operator>>(istream&, signed char*);
extern template class basic_iostream<char>;
#ifdef _GLIBCXX_USE_WCHAR_T
extern template class basic_istream<wchar_t>;
extern template wistream& ws(wistream&);
extern template wistream& operator>>(wistream&, wchar_t&);
extern template wistream& operator>>(wistream&, wchar_t*);
extern template class basic_iostream<wchar_t>;
#endif
#endif
} // namespace std

View File

@ -1,6 +1,6 @@
// Locale support -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -690,7 +690,7 @@ namespace std
mutable char _M_widen[1 + static_cast<unsigned char>(-1)];
mutable char _M_narrow[1 + static_cast<unsigned char>(-1)];
mutable char _M_narrow_ok; // 0 uninitialized, 1 init,
// 2 non-consecutive
// 2 memcpy can't be used
public:
/// The facet id for ctype<char>
@ -865,7 +865,8 @@ namespace std
char_type
widen(char __c) const
{
if (_M_widen_ok) return _M_widen[static_cast<unsigned char>(__c)];
if (_M_widen_ok)
return _M_widen[static_cast<unsigned char>(__c)];
this->_M_widen_init();
return this->do_widen(__c);
}
@ -896,7 +897,8 @@ namespace std
memcpy(__to, __lo, __hi - __lo);
return __hi;
}
if (!_M_widen_ok) _M_widen_init();
if (!_M_widen_ok)
_M_widen_init();
return this->do_widen(__lo, __hi, __to);
}
@ -924,7 +926,8 @@ namespace std
if (_M_narrow[static_cast<unsigned char>(__c)])
return _M_narrow[static_cast<unsigned char>(__c)];
const char __t = do_narrow(__c, __dfault);
if (__t != __dfault) _M_narrow[static_cast<unsigned char>(__c)] = __t;
if (__t != __dfault)
_M_narrow[static_cast<unsigned char>(__c)] = __t;
return __t;
}
@ -954,7 +957,7 @@ namespace std
narrow(const char_type* __lo, const char_type* __hi,
char __dfault, char *__to) const
{
if (__builtin_expect(_M_narrow_ok == 1,true))
if (__builtin_expect(_M_narrow_ok == 1, true))
{
memcpy(__to, __lo, __hi - __lo);
return __hi;
@ -1161,17 +1164,13 @@ namespace std
_M_widen_ok = 1;
// Set _M_widen_ok to 2 if memcpy can't be used.
for (size_t __j = 0; __j < sizeof(_M_widen); ++__j)
if (__tmp[__j] != _M_widen[__j])
{
_M_widen_ok = 2;
break;
}
if (memcmp(__tmp, _M_widen, sizeof(_M_widen)))
_M_widen_ok = 2;
}
// Fill in the narrowing cache and flag whether all values are
// valid or not. _M_narrow_ok is set to 1 if the whole table is
// narrowed, 2 if only some values could be narrowed.
// valid or not. _M_narrow_ok is set to 2 if memcpy can't
// be used.
void _M_narrow_init() const
{
char __tmp[sizeof(_M_narrow)];
@ -1179,21 +1178,18 @@ namespace std
__tmp[__i] = __i;
do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow);
// Check if any default values were created. Do this by
// renarrowing with a different default value and comparing.
bool __consecutive = true;
for (size_t __j = 0; __j < sizeof(_M_narrow); ++__j)
if (!_M_narrow[__j])
{
char __c;
do_narrow(__tmp + __j, __tmp + __j + 1, 1, &__c);
if (__c == 1)
{
__consecutive = false;
break;
}
}
_M_narrow_ok = __consecutive ? 1 : 2;
_M_narrow_ok = 1;
if (memcmp(__tmp, _M_narrow, sizeof(_M_narrow)))
_M_narrow_ok = 2;
else
{
// Deal with the special case of zero: renarrow with a
// different default and compare.
char __c;
do_narrow(__tmp, __tmp + 1, 1, &__c);
if (__c == 1)
_M_narrow_ok = 2;
}
}
};

View File

@ -1151,8 +1151,8 @@ namespace std
const ios_base::fmtflags __flags = __io.flags();
if ((__flags & ios_base::boolalpha) == 0)
{
unsigned long __uv = __v;
__s = _M_insert_int(__s, __io, __fill, __uv);
const long __l = __v;
__s = _M_insert_int(__s, __io, __fill, __l);
}
else
{
@ -1229,8 +1229,7 @@ namespace std
const void* __v) const
{
const ios_base::fmtflags __flags = __io.flags();
const ios_base::fmtflags __fmt = ~(ios_base::showpos
| ios_base::basefield
const ios_base::fmtflags __fmt = ~(ios_base::basefield
| ios_base::uppercase
| ios_base::internal);
__io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase));
@ -1674,22 +1673,22 @@ namespace std
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 328. Bad sprintf format modifier in money_put<>::do_put()
int __len = std::__convert_from_v(__cs, __cs_size, "%.0Lf", __units,
_S_get_c_locale());
int __len = std::__convert_from_v(__cs, __cs_size, "%.*Lf", __units,
_S_get_c_locale(), 0);
// If the buffer was not large enough, try again with the correct size.
if (__len >= __cs_size)
{
__cs_size = __len + 1;
__cs = static_cast<char*>(__builtin_alloca(__cs_size));
__len = std::__convert_from_v(__cs, __cs_size, "%.0Lf", __units,
_S_get_c_locale());
__len = std::__convert_from_v(__cs, __cs_size, "%.*Lf", __units,
_S_get_c_locale(), 0);
}
#else
// max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
int __len = std::__convert_from_v(__cs, 0, "%.0Lf", __units,
_S_get_c_locale());
int __len = std::__convert_from_v(__cs, 0, "%.*Lf", __units,
_S_get_c_locale(), 0);
#endif
_CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
* __cs_size));
@ -1837,8 +1836,13 @@ namespace std
__tm, __wcs);
break;
case 'S':
// Seconds.
__beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 59, 2,
// Seconds. [tm_sec]
// [00, 60] in C99 (one leap-second), [00, 61] in C89.
#ifdef _GLIBCXX_USE_C99
__beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2,
#else
__beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2,
#endif
__io, __err);
break;
case 't':
@ -1998,8 +2002,7 @@ namespace std
for (size_t __i2 = 1; __i2 < __nmatches; ++__i2)
__minlen = std::min(__minlen,
__traits_type::length(__names[__matches[__i2]]));
++__pos;
++__beg;
++__beg, ++__pos;
if (__pos < __minlen && __beg != __end)
for (size_t __i3 = 0; __i3 < __nmatches;)
{
@ -2016,8 +2019,7 @@ namespace std
if (__nmatches == 1)
{
// Make sure found name is completely extracted.
++__pos;
++__beg;
++__beg, ++__pos;
__name = __names[__matches[0]];
const size_t __len = __traits_type::length(__name);
while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
@ -2090,7 +2092,7 @@ namespace std
// __days array with the same index points to a day, and that
// day's abbreviated form.
// NB: Also assumes that an abbreviated name is a subset of the name.
if (!__err)
if (!__err && __beg != __end)
{
size_t __pos = __traits_type::length(__days[__tmpwday]);
__tp._M_days(__days);
@ -2105,9 +2107,10 @@ namespace std
if (__len != __pos)
__err |= ios_base::failbit;
}
if (!__err)
__tm->tm_wday = __tmpwday;
}
if (!__err)
__tm->tm_wday = __tmpwday;
if (__beg == __end)
__err |= ios_base::eofbit;
return __beg;
@ -2135,7 +2138,7 @@ namespace std
// __months array with the same index points to a month, and that
// month's abbreviated form.
// NB: Also assumes that an abbreviated name is a subset of the name.
if (!__err)
if (!__err && __beg != __end)
{
size_t __pos = __traits_type::length(__months[__tmpmon]);
__tp._M_months(__months);
@ -2150,9 +2153,9 @@ namespace std
if (__len != __pos)
__err |= ios_base::failbit;
}
if (!__err)
__tm->tm_mon = __tmpmon;
}
if (!__err)
__tm->tm_mon = __tmpmon;
if (__beg == __end)
__err |= ios_base::eofbit;
@ -2234,7 +2237,7 @@ namespace std
// NB: This size is arbitrary. Should this be a data member,
// initialized at construction?
const size_t __maxlen = 64;
const size_t __maxlen = 128;
char_type* __res =
static_cast<char_type*>(__builtin_alloca(sizeof(char_type) * __maxlen));

View File

@ -123,6 +123,7 @@ namespace std
{
// Update egptr() to match the actual string end.
_M_update_egptr();
if (this->gptr() < this->egptr())
__ret = traits_type::to_int_type(*this->gptr());
}
@ -141,10 +142,11 @@ namespace std
__testin &= !(__mode & ios_base::out);
__testout &= !(__mode & ios_base::in);
if (_M_string.capacity() && (__testin || __testout || __testboth))
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 453. basic_stringbuf::seekoff need not always fail for an empty stream.
const char_type* __beg = __testin ? this->eback() : this->pbase();
if ((__beg || !__off) && (__testin || __testout || __testboth))
{
char_type* __beg = __testin ? this->eback() : this->pbase();
_M_update_egptr();
off_type __newoffi = 0;
@ -181,15 +183,15 @@ namespace std
seekpos(pos_type __sp, ios_base::openmode __mode)
{
pos_type __ret = pos_type(off_type(-1));
if (_M_string.capacity())
{
off_type __pos (__sp);
const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
char_type* __beg = __testin ? this->eback() : this->pbase();
const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
const char_type* __beg = __testin ? this->eback() : this->pbase();
if (__beg)
{
_M_update_egptr();
off_type __pos(__sp);
const bool __testpos = 0 <= __pos
&& __pos <= this->egptr() - __beg;
if ((__testin || __testout) && __testpos)
@ -198,7 +200,7 @@ namespace std
this->gbump((__beg + __pos) - this->gptr());
if (__testout)
this->pbump((__beg + __pos) - this->pptr());
__ret = pos_type(off_type(__pos));
__ret = __sp;
}
}
return __ret;

View File

@ -1103,8 +1103,6 @@ namespace std
// concept requirements
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator>)
__glibcxx_function_requires(_ConvertibleConcept<_Tp,
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_function_requires(_EqualOpConcept<
typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
@ -4908,9 +4906,6 @@ namespace std
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_EqualOpConcept<
typename iterator_traits<_InputIterator>::value_type,
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
typename iterator_traits<_InputIterator>::value_type,
typename iterator_traits<_ForwardIterator>::value_type>)

View File

@ -1,6 +1,6 @@
// Bits and pieces used in algorithms -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -617,9 +617,8 @@ namespace std
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_EqualityComparableConcept<
typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_EqualityComparableConcept<
__glibcxx_function_requires(_EqualOpConcept<
typename iterator_traits<_InputIterator1>::value_type,
typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_requires_valid_range(__first1, __last1);
@ -747,10 +746,12 @@ namespace std
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_LessThanComparableConcept<
typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_LessThanComparableConcept<
__glibcxx_function_requires(_LessThanOpConcept<
typename iterator_traits<_InputIterator1>::value_type,
typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_LessThanOpConcept<
typename iterator_traits<_InputIterator2>::value_type,
typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);

View File

@ -1,6 +1,6 @@
// List implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -119,7 +119,8 @@ namespace _GLIBCXX_STD
typedef _Tp* pointer;
typedef _Tp& reference;
_List_iterator() { }
_List_iterator()
: _M_node() { }
_List_iterator(_List_node_base* __x)
: _M_node(__x) { }
@ -195,7 +196,8 @@ namespace _GLIBCXX_STD
typedef const _Tp* pointer;
typedef const _Tp& reference;
_List_const_iterator() { }
_List_const_iterator()
: _M_node() { }
_List_const_iterator(const _List_node_base* __x)
: _M_node(__x) { }

View File

@ -1,6 +1,6 @@
// RB tree implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -161,7 +161,8 @@ namespace std
typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
typedef _Rb_tree_node<_Tp>* _Link_type;
_Rb_tree_iterator() { }
_Rb_tree_iterator()
: _M_node() { }
_Rb_tree_iterator(_Link_type __x)
: _M_node(__x) { }
@ -231,7 +232,8 @@ namespace std
typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
typedef const _Rb_tree_node<_Tp>* _Link_type;
_Rb_tree_const_iterator() { }
_Rb_tree_const_iterator()
: _M_node() { }
_Rb_tree_const_iterator(_Link_type __x)
: _M_node(__x) { }
@ -702,7 +704,7 @@ namespace std
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
{
return __x.size() == __y.size()
&& equal(__x.begin(), __x.end(), __y.begin());
&& std::equal(__x.begin(), __x.end(), __y.begin());
}
template<typename _Key, typename _Val, typename _KeyOfValue,
@ -711,8 +713,8 @@ namespace std
operator<(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
{
return lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
return std::lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
}
template<typename _Key, typename _Val, typename _KeyOfValue,

View File

@ -1,6 +1,6 @@
// Vector implementation (out of line) -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -118,7 +118,7 @@ namespace _GLIBCXX_STD
vector<_Tp,_Alloc>::
erase(iterator __first, iterator __last)
{
iterator __i(copy(__last, end(), __first));
iterator __i(std::copy(__last, end(), __first));
std::_Destroy(__i, end());
this->_M_impl._M_finish = this->_M_impl._M_finish - (__last - __first);
return __first;
@ -143,7 +143,7 @@ namespace _GLIBCXX_STD
}
else if (size() >= __xlen)
{
iterator __i(copy(__x.begin(), __x.end(), begin()));
iterator __i(std::copy(__x.begin(), __x.end(), begin()));
std::_Destroy(__i, end());
}
else
@ -209,7 +209,7 @@ namespace _GLIBCXX_STD
}
else if (size() >= __len)
{
iterator __new_finish(copy(__first, __last, this->_M_impl._M_start));
iterator __new_finish(std::copy(__first, __last, this->_M_impl._M_start));
std::_Destroy(__new_finish, end());
this->_M_impl._M_finish = __new_finish.base();
}

View File

@ -163,7 +163,7 @@ namespace __gnu_debug_def
void
insert(_InputIterator __first, _InputIterator __last)
{
__glibcxx_valid_range(__first, __last);
__glibcxx_check_valid_range(__first, __last);
_Base::insert(__first, __last);
}

View File

@ -48,6 +48,7 @@
#define _POOL_ALLOCATOR_H 1
#include <bits/c++config.h>
#include <cstdlib>
#include <new>
#include <bits/functexcept.h>
#include <bits/atomicity.h>
@ -72,7 +73,7 @@ namespace __gnu_cxx
* @endif
* (See @link Allocators allocators info @endlink for more.)
*/
class __pool_base
class __pool_alloc_base
{
protected:
@ -116,7 +117,7 @@ namespace __gnu_cxx
template<typename _Tp>
class __pool_alloc : private __pool_base
class __pool_alloc : private __pool_alloc_base
{
private:
static _Atomic_word _S_force_new;

View File

@ -1,6 +1,6 @@
// SGI's rope class -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -152,7 +152,7 @@ class sequence_buffer : public iterator<std::output_iterator_tag,void,void,void,
sequence_buffer(const sequence_buffer& __x) {
_M_prefix = __x._M_prefix;
_M_buf_count = __x._M_buf_count;
copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
}
sequence_buffer(sequence_buffer& __x) {
__x.flush();
@ -169,7 +169,7 @@ class sequence_buffer : public iterator<std::output_iterator_tag,void,void,void,
sequence_buffer& operator= (const sequence_buffer& __x) {
_M_prefix = __x._M_prefix;
_M_buf_count = __x._M_buf_count;
copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
return *this;
}
void push_back(value_type __x)

View File

@ -1295,7 +1295,7 @@ rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left,
__right_len = __right->_M_size;
if (_Rope_constants::_S_leaf == __left->_M_tag) {
_RopeLeaf* __l = (_RopeLeaf*) __left;
if (_RopeRep::_S_leaf == __right->_M_tag) {
if (_Rope_constants::_S_leaf == __right->_M_tag) {
_RopeLeaf* __r = (_RopeLeaf*) __right;
return lexicographical_compare_3way(
__l->_M_data, __l->_M_data + __left_len,

View File

@ -1,6 +1,6 @@
// The template and inlines for the -*- C++ -*- complex number classes.
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -736,9 +736,7 @@ namespace std
typedef float value_type;
complex(float = 0.0f, float = 0.0f);
#ifdef _GLIBCXX_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) { }
#endif
explicit complex(const complex<double>&);
explicit complex(const complex<long double>&);
@ -892,10 +890,8 @@ namespace std
public:
typedef double value_type;
complex(double =0.0, double =0.0);
#ifdef _GLIBCXX_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) { }
#endif
complex(double = 0.0, double = 0.0);
complex(const complex<float>&);
explicit complex(const complex<long double>&);
@ -1049,9 +1045,7 @@ namespace std
typedef long double value_type;
complex(long double = 0.0L, long double = 0.0L);
#ifdef _GLIBCXX_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) { }
#endif
complex(const complex<float>&);
complex(const complex<double>&);

View File

@ -418,24 +418,7 @@ namespace std
// [documentation is inherited]
virtual streamsize
xsgetn(char_type* __s, streamsize __n)
{
// Clear out pback buffer before going on to the real deal...
streamsize __ret = 0;
if (this->_M_pback_init)
{
if (__n && this->gptr() == this->eback())
{
*__s++ = *this->gptr();
this->gbump(1);
__ret = 1;
}
_M_destroy_pback();
}
if (__ret < __n)
__ret += __streambuf_type::xsgetn(__s, __n - __ret);
return __ret;
}
xsgetn(char_type* __s, streamsize __n);
// [documentation is inherited]
virtual streamsize

View File

@ -58,6 +58,7 @@
#include <bits/stl_uninitialized.h>
#include <bits/stl_raw_storage_iter.h>
#include <debug/debug.h>
#include <limits>
namespace std
{
@ -73,8 +74,9 @@ namespace std
pair<_Tp*, ptrdiff_t>
__get_temporary_buffer(ptrdiff_t __len, _Tp*)
{
if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
__len = INT_MAX / sizeof(_Tp);
const ptrdiff_t __max = numeric_limits<ptrdiff_t>::max() / sizeof(_Tp);
if (__len > __max)
__len = __max;
while (__len > 0)
{
@ -105,7 +107,7 @@ namespace std
* Provides the nothrow exception guarantee.
*/
template<typename _Tp>
inline pair<_Tp*,ptrdiff_t>
inline pair<_Tp*, ptrdiff_t>
get_temporary_buffer(ptrdiff_t __len)
{ return std::__get_temporary_buffer(__len, static_cast<_Tp*>(0)); }

View File

@ -111,8 +111,8 @@ namespace std
*/
explicit
basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
: __streambuf_type(), _M_mode(), _M_string()
{ _M_stringbuf_init(__mode); }
: __streambuf_type(), _M_mode(__mode), _M_string()
{ }
/**
* @brief Starts with an existing string buffer.
@ -140,8 +140,7 @@ namespace std
__string_type
str() const
{
const bool __testout = this->_M_mode & ios_base::out;
if (__testout)
if (this->pptr())
{
// The current egptr() may not be the actual string end.
if (this->pptr() > this->egptr())
@ -169,7 +168,7 @@ namespace std
}
protected:
// Common initialization code for both ctors goes here.
// Common initialization code goes here.
/**
* @if maint
* @doctodo
@ -277,9 +276,8 @@ namespace std
_M_update_egptr()
{
const bool __testin = this->_M_mode & ios_base::in;
const bool __testout = this->_M_mode & ios_base::out;
if (__testout && this->pptr() > this->egptr())
if (this->pptr() && this->pptr() > this->egptr())
if (__testin)
this->setg(this->eback(), this->gptr(), this->pptr());
else

View File

@ -48,7 +48,17 @@ static void
get_globals_dtor (void *ptr)
{
if (ptr)
std::free (ptr);
{
__cxa_exception *exn, *next;
exn = ((__cxa_eh_globals *) ptr)->caughtExceptions;
while (exn)
{
next = exn->nextException;
_Unwind_DeleteException (&exn->unwindHeader);
exn = next;
}
std::free (ptr);
}
}
static void

View File

@ -202,7 +202,7 @@ dnl 2) has "C" linkage
dnl
dnl argument 1 is name of function to check
dnl
dnl ASSUMES argument is a math function with TWO parameters
dnl ASSUMES argument is a stdlib function with TWO parameters
dnl
dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2
AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2], [
@ -231,7 +231,7 @@ dnl 2) has "C" linkage
dnl
dnl argument 1 is name of function to check
dnl
dnl ASSUMES argument is a function with THREE parameters
dnl ASSUMES argument is a stdlib function with THREE parameters
dnl
dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3
AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3], [

View File

@ -44,22 +44,22 @@ namespace __gnu_internal
namespace __gnu_cxx
{
// Definitions for __pool_alloc_base.
__pool_base::_Obj* volatile*
__pool_base::_M_get_free_list(size_t __bytes)
__pool_alloc_base::_Obj* volatile*
__pool_alloc_base::_M_get_free_list(size_t __bytes)
{
size_t __i = ((__bytes + (size_t)_S_align - 1) / (size_t)_S_align - 1);
return _S_free_list + __i;
}
mutex_type&
__pool_base::_M_get_mutex()
__pool_alloc_base::_M_get_mutex()
{ return __gnu_internal::palloc_init_mutex; }
// Allocate memory in large chunks in order to avoid fragmenting the
// heap too much. Assume that __n is properly aligned. We hold the
// allocation lock.
char*
__pool_base::_M_allocate_chunk(size_t __n, int& __nobjs)
__pool_alloc_base::_M_allocate_chunk(size_t __n, int& __nobjs)
{
char* __result;
size_t __total_bytes = __n * __nobjs;
@ -91,8 +91,11 @@ namespace __gnu_cxx
size_t __bytes_to_get = (2 * __total_bytes
+ _M_round_up(_S_heap_size >> 4));
_S_start_free = static_cast<char*>(::operator new(__bytes_to_get));
if (_S_start_free == 0)
try
{
_S_start_free = static_cast<char*>(::operator new(__bytes_to_get));
}
catch (...)
{
// Try to make do with what we have. That can't hurt. We
// do not try smaller requests, since that tends to result
@ -112,11 +115,9 @@ namespace __gnu_cxx
// right free list.
}
}
_S_end_free = 0; // In case of exception.
// This should either throw an exception or remedy the situation.
// Thus we assume it succeeded.
_S_start_free = static_cast<char*>(::operator new(__bytes_to_get));
// What we have wasn't enough. Rethrow.
_S_start_free = _S_end_free = 0; // We have no chunk.
__throw_exception_again;
}
_S_heap_size += __bytes_to_get;
_S_end_free = _S_start_free + __bytes_to_get;
@ -128,7 +129,7 @@ namespace __gnu_cxx
// __n"'s free list. We assume that __n is properly aligned. We
// hold the allocation lock.
void*
__pool_base::_M_refill(size_t __n)
__pool_alloc_base::_M_refill(size_t __n)
{
int __nobjs = 20;
char* __chunk = _M_allocate_chunk(__n, __nobjs);
@ -159,11 +160,11 @@ namespace __gnu_cxx
return __result;
}
__pool_base::_Obj* volatile __pool_base::_S_free_list[_S_free_list_size];
__pool_alloc_base::_Obj* volatile __pool_alloc_base::_S_free_list[_S_free_list_size];
char* __pool_base::_S_start_free = 0;
char* __pool_alloc_base::_S_start_free = 0;
char* __pool_base::_S_end_free = 0;
char* __pool_alloc_base::_S_end_free = 0;
size_t __pool_base::_S_heap_size = 0;
size_t __pool_alloc_base::_S_heap_size = 0;
} // namespace __gnu_cxx

View File

@ -37,9 +37,15 @@
#include <cstring>
#include <cstdio>
#include <cctype>
#include <bits/concurrence.h>
using namespace std;
namespace __gnu_internal
{
__glibcxx_mutex_define_initialized(iterator_base_mutex);
} // namespace __gnu_internal
namespace __gnu_debug
{
const char* _S_debug_messages[] =
@ -188,6 +194,7 @@ namespace __gnu_debug
// Attach to the new sequence (if there is one)
if (__seq)
{
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
_M_sequence = __seq;
_M_version = _M_sequence->_M_version;
_M_prior = 0;
@ -212,6 +219,7 @@ namespace __gnu_debug
_Safe_iterator_base::
_M_detach()
{
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
if (_M_sequence)
{
// Remove us from this sequence's list
@ -569,12 +577,17 @@ namespace __gnu_debug
{
// [__start, __end) denotes the next word
__end = __start;
while (isalnum(*__end)) ++__end;
if (__start == __end) ++__end;
if (isspace(*__end)) ++__end;
while (isalnum(*__end))
++__end;
if (__start == __end)
++__end;
if (isspace(*__end))
++__end;
assert(__end - __start + 1< __bufsize);
_M_format_word(__buf, __end - __start + 1, "%s", __start);
const ptrdiff_t __len = __end - __start;
assert(__len < __bufsize);
memcpy(__buf, __start, __len);
__buf[__len] = '\0';
_M_print_word(__buf);
__start = __end;

View File

@ -37,8 +37,9 @@
#include <bits/atomicity.h>
namespace std
{
// Definitions for static const data members of __ios_flags.
{
// XXX GLIBCXX_ABI Deprecated
// Definitions for static const data members of __ios_flags.
const __ios_flags::__int_type __ios_flags::_S_boolalpha;
const __ios_flags::__int_type __ios_flags::_S_dec;
const __ios_flags::__int_type __ios_flags::_S_fixed;

View File

@ -155,6 +155,9 @@ namespace std
// currently synchronized.
if (!__sync && __ret)
{
// Make sure the standard streams are constructed.
ios_base::Init __init;
ios_base::Init::_S_synced_with_stdio = __sync;
// Explicitly call dtors to free any memory that is

View File

@ -89,9 +89,8 @@ namespace __gnu_internal
extern std::__timepunct_cache<wchar_t> timepunct_cache_w;
#endif
// Mutex objects for locale initialization.
__glibcxx_mutex_define_initialized(locale_cons_mutex);
__glibcxx_mutex_define_initialized(locale_global_mutex);
// Mutex object for locale initialization.
__glibcxx_mutex_define_initialized(locale_mutex);
} // namespace __gnu_internal
namespace std
@ -101,23 +100,24 @@ namespace std
locale::locale() throw() : _M_impl(0)
{
_S_initialize();
__glibcxx_mutex_lock(__gnu_internal::locale_cons_mutex);
__gnu_cxx::lock sentry(__gnu_internal::locale_mutex);
_S_global->_M_add_reference();
_M_impl = _S_global;
__glibcxx_mutex_unlock(__gnu_internal::locale_cons_mutex);
}
locale
locale::global(const locale& __other)
{
_S_initialize();
__glibcxx_mutex_lock(__gnu_internal::locale_global_mutex);
_Impl* __old = _S_global;
__other._M_impl->_M_add_reference();
_S_global = __other._M_impl;
if (__other.name() != "*")
setlocale(LC_ALL, __other.name().c_str());
__glibcxx_mutex_unlock(__gnu_internal::locale_global_mutex);
_Impl* __old;
{
__gnu_cxx::lock sentry(__gnu_internal::locale_mutex);
__old = _S_global;
__other._M_impl->_M_add_reference();
_S_global = __other._M_impl;
if (__other.name() != "*")
setlocale(LC_ALL, __other.name().c_str());
}
// Reference count sanity check: one reference removed for the
// subsition of __other locale, one added by return-by-value. Net

View File

@ -212,11 +212,11 @@ namespace std
}
else
{
const char* __beg = __s;
const char* __end = __s;
for (size_t __i = 0; __i < _S_categories_size; ++__i)
{
__beg = std::strchr(__beg, '=') + 1;
const char* __end = std::strchr(__beg, ';');
const char* __beg = std::strchr(__end + 1, '=') + 1;
__end = std::strchr(__beg, ';');
if (!__end)
__end = __s + __len;
char* __new = new char[__end - __beg + 1];