mirror of git://gcc.gnu.org/git/gcc.git
[multiple changes]
2004-09-28 Paolo Carlini <pcarlini@suse.de> PR libstdc++/16612 * include/bits/basic_string.h (_M_dispose, _M_refcopy, basic_string()): When _GLIBCXX_FULLY_DYNAMIC_STRING is defined, don't deal with _S_empty_rep. * include/bits/basic_string.tcc (_S_construct, _M_destroy, _M_leak_hard, _M_mutate): Likewise. * acinclude.m4 (GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING): New. * acconfig.h: Add corresponding undef. * configure.ac: Use GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING. * docs/html/configopts.html: Document --enable-fully-dynamic-string. * configure: Regenerate. * config.h.in: Likewise. 2004-09-28 Benjamin Kosnik <bkoz@redhat.com> Paolo Carlini <pcarlini@suse.de> * testsuite/21_strings/basic_string/operations/char/1.cc: New. * testsuite/21_strings/basic_string/operations/wchar_t/1.cc: New. * testsuite/21_strings/basic_string/element_access/char/empty.cc: New. * testsuite/21_strings/basic_string/element_access/wchar_t/empty.cc: New. 2004-09-28 Paolo Carlini <pcarlini@suse.de> * README: Remove obsolete entry about include/c_shadow. From-SVN: r88225
This commit is contained in:
parent
a3a0fc7f89
commit
1165dc50e8
|
@ -1,3 +1,31 @@
|
||||||
|
2004-09-28 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
PR libstdc++/16612
|
||||||
|
* include/bits/basic_string.h (_M_dispose, _M_refcopy,
|
||||||
|
basic_string()): When _GLIBCXX_FULLY_DYNAMIC_STRING is defined,
|
||||||
|
don't deal with _S_empty_rep.
|
||||||
|
* include/bits/basic_string.tcc (_S_construct, _M_destroy,
|
||||||
|
_M_leak_hard, _M_mutate): Likewise.
|
||||||
|
* acinclude.m4 (GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING): New.
|
||||||
|
* acconfig.h: Add corresponding undef.
|
||||||
|
* configure.ac: Use GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING.
|
||||||
|
* docs/html/configopts.html: Document --enable-fully-dynamic-string.
|
||||||
|
* configure: Regenerate.
|
||||||
|
* config.h.in: Likewise.
|
||||||
|
|
||||||
|
2004-09-28 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* testsuite/21_strings/basic_string/operations/char/1.cc: New.
|
||||||
|
* testsuite/21_strings/basic_string/operations/wchar_t/1.cc: New.
|
||||||
|
* testsuite/21_strings/basic_string/element_access/char/empty.cc: New.
|
||||||
|
* testsuite/21_strings/basic_string/element_access/wchar_t/empty.cc:
|
||||||
|
New.
|
||||||
|
|
||||||
|
2004-09-28 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* README: Remove obsolete entry about include/c_shadow.
|
||||||
|
|
||||||
2004-09-24 H.J. Lu <hongjiu.lu@intel.com>
|
2004-09-24 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR libstdc++/17469
|
PR libstdc++/17469
|
||||||
|
|
|
@ -35,13 +35,6 @@ It has subdirectories:
|
||||||
names into the std:: namespace.
|
names into the std:: namespace.
|
||||||
[NB: this is the default, and is the same as --enable-cheaders=c_std]
|
[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
|
include/bits
|
||||||
Files included by standard headers and by other files in
|
Files included by standard headers and by other files in
|
||||||
the bits directory.
|
the bits directory.
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
// Define if LFS support is available.
|
// Define if LFS support is available.
|
||||||
#undef _GLIBCXX_USE_LFS
|
#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.
|
// Define if NLS translations are to be used.
|
||||||
#undef _GLIBCXX_USE_NLS
|
#undef _GLIBCXX_USE_NLS
|
||||||
|
|
||||||
|
|
|
@ -593,6 +593,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
|
||||||
dnl Does any necessary configuration of the testsuite directory. Generates
|
dnl Does any necessary configuration of the testsuite directory. Generates
|
||||||
dnl the testsuite_hooks.h header.
|
dnl the testsuite_hooks.h header.
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
// Define if LFS support is available.
|
// Define if LFS support is available.
|
||||||
#undef _GLIBCXX_USE_LFS
|
#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.
|
// Define if NLS translations are to be used.
|
||||||
#undef _GLIBCXX_USE_NLS
|
#undef _GLIBCXX_USE_NLS
|
||||||
|
|
||||||
|
|
|
@ -884,6 +884,9 @@ Optional Features:
|
||||||
--enable-cxx-flags=FLAGS
|
--enable-cxx-flags=FLAGS
|
||||||
pass compiler FLAGS when building library
|
pass compiler FLAGS when building library
|
||||||
[default=]
|
[default=]
|
||||||
|
--enable-fully-dynamic-string
|
||||||
|
do not put empty strings in per-process static
|
||||||
|
memory [default=no]
|
||||||
--enable-symvers=STYLE enables symbol versioning of the shared library
|
--enable-symvers=STYLE enables symbol versioning of the shared library
|
||||||
[default=yes]
|
[default=yes]
|
||||||
--enable-version-specific-runtime-libs
|
--enable-version-specific-runtime-libs
|
||||||
|
@ -4394,7 +4397,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
|
||||||
case $host in
|
case $host in
|
||||||
*-*-irix6*)
|
*-*-irix6*)
|
||||||
# Find out which ABI we are using.
|
# Find out which ABI we are using.
|
||||||
echo '#line 4397 "configure"' > conftest.$ac_ext
|
echo '#line 4400 "configure"' > conftest.$ac_ext
|
||||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
(eval $ac_compile) 2>&5
|
(eval $ac_compile) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
|
@ -5015,7 +5018,7 @@ fi;
|
||||||
#
|
#
|
||||||
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
|
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
|
||||||
cat > conftest.$ac_ext << EOF
|
cat > conftest.$ac_ext << EOF
|
||||||
#line 5018 "configure"
|
#line 5021 "configure"
|
||||||
struct S { ~S(); };
|
struct S { ~S(); };
|
||||||
void bar();
|
void bar();
|
||||||
void foo()
|
void foo()
|
||||||
|
@ -7841,6 +7844,29 @@ echo "${ECHO_T}$EXTRA_CXX_FLAGS" >&6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Check whether --enable-fully-dynamic-string or --disable-fully-dynamic-string was given.
|
||||||
|
if test "${enable_fully_dynamic_string+set}" = set; then
|
||||||
|
enableval="$enable_fully_dynamic_string"
|
||||||
|
|
||||||
|
case "$enableval" in
|
||||||
|
yes|no) ;;
|
||||||
|
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable fully-dynamic-string must be yes or no" >&5
|
||||||
|
echo "$as_me: error: Argument to enable/disable fully-dynamic-string must be yes or no" >&2;}
|
||||||
|
{ (exit 1); exit 1; }; } ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
else
|
||||||
|
enable_fully_dynamic_string=no
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if test $enable_fully_dynamic_string = yes; then
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define _GLIBCXX_FULLY_DYNAMIC_STRING 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# No surprises, no surprises...
|
# No surprises, no surprises...
|
||||||
if test $atomicity_dir = cpu/generic ; then
|
if test $atomicity_dir = cpu/generic ; then
|
||||||
{ echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5
|
{ echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5
|
||||||
|
|
|
@ -94,6 +94,7 @@ GLIBCXX_ENABLE_CONCEPT_CHECKS([no])
|
||||||
GLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0"])
|
GLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0"])
|
||||||
GLIBCXX_ENABLE_DEBUG([no])
|
GLIBCXX_ENABLE_DEBUG([no])
|
||||||
GLIBCXX_ENABLE_CXX_FLAGS
|
GLIBCXX_ENABLE_CXX_FLAGS
|
||||||
|
GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
|
||||||
|
|
||||||
# No surprises, no surprises...
|
# No surprises, no surprises...
|
||||||
if test $atomicity_dir = cpu/generic ; then
|
if test $atomicity_dir = cpu/generic ; then
|
||||||
|
|
|
@ -144,9 +144,8 @@ options</a></h1>
|
||||||
|
|
||||||
<dt><code>--enable-cheaders=OPTION </code></dt>
|
<dt><code>--enable-cheaders=OPTION </code></dt>
|
||||||
<dd><p>This allows the user to define what kind of C headers are
|
<dd><p>This allows the user to define what kind of C headers are
|
||||||
used. Options are: c, c_std, and c_shadow. These correspond
|
used. Options are c and c_std. These correspond to the source
|
||||||
to the source directory's include/c, include/c_std, and
|
directory's include/c and include/c_std. The default is c_std.
|
||||||
include/c_shadow directories. The default is c_std.
|
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
@ -261,6 +260,14 @@ options</a></h1>
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt><code>--enable-fully-dynamic-string </code></dt>
|
||||||
|
<dd><p>This option enables a special version of basic_string avoiding
|
||||||
|
the optimization that allocates empty objects in static memory.
|
||||||
|
Mostly useful together with shared memory allocators, see PR
|
||||||
|
libstdc++/16612 for details.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt><code>--enable-concept-checks </code></dt>
|
<dt><code>--enable-concept-checks </code></dt>
|
||||||
<dd><p>This turns on additional compile-time checks for instantiated
|
<dd><p>This turns on additional compile-time checks for instantiated
|
||||||
library templates, in the form of specialized templates,
|
library templates, in the form of specialized templates,
|
||||||
|
|
|
@ -211,7 +211,9 @@ namespace std
|
||||||
void
|
void
|
||||||
_M_dispose(const _Alloc& __a)
|
_M_dispose(const _Alloc& __a)
|
||||||
{
|
{
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (__builtin_expect(this != &_S_empty_rep(), false))
|
if (__builtin_expect(this != &_S_empty_rep(), false))
|
||||||
|
#endif
|
||||||
if (__gnu_cxx::__exchange_and_add(&this->_M_refcount, -1) <= 0)
|
if (__gnu_cxx::__exchange_and_add(&this->_M_refcount, -1) <= 0)
|
||||||
_M_destroy(__a);
|
_M_destroy(__a);
|
||||||
} // XXX MT
|
} // XXX MT
|
||||||
|
@ -222,7 +224,9 @@ namespace std
|
||||||
_CharT*
|
_CharT*
|
||||||
_M_refcopy() throw()
|
_M_refcopy() throw()
|
||||||
{
|
{
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (__builtin_expect(this != &_S_empty_rep(), false))
|
if (__builtin_expect(this != &_S_empty_rep(), false))
|
||||||
|
#endif
|
||||||
__gnu_cxx::__atomic_add(&this->_M_refcount, 1);
|
__gnu_cxx::__atomic_add(&this->_M_refcount, 1);
|
||||||
return _M_refdata();
|
return _M_refdata();
|
||||||
} // XXX MT
|
} // XXX MT
|
||||||
|
@ -1957,11 +1961,14 @@ namespace std
|
||||||
size_type __n2) const;
|
size_type __n2) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||||
inline basic_string<_CharT, _Traits, _Alloc>::
|
inline basic_string<_CharT, _Traits, _Alloc>::
|
||||||
basic_string()
|
basic_string()
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
: _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
|
: _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
|
||||||
|
#else
|
||||||
|
: _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()) { }
|
||||||
|
#endif
|
||||||
|
|
||||||
// operator+
|
// operator+
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,8 +88,10 @@ namespace std
|
||||||
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
|
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
|
||||||
input_iterator_tag)
|
input_iterator_tag)
|
||||||
{
|
{
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (__beg == __end && __a == _Alloc())
|
if (__beg == __end && __a == _Alloc())
|
||||||
return _S_empty_rep()._M_refdata();
|
return _S_empty_rep()._M_refdata();
|
||||||
|
#endif
|
||||||
// Avoid reallocation for common case.
|
// Avoid reallocation for common case.
|
||||||
_CharT __buf[128];
|
_CharT __buf[128];
|
||||||
size_type __len = 0;
|
size_type __len = 0;
|
||||||
|
@ -134,11 +136,12 @@ namespace std
|
||||||
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
|
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
|
||||||
forward_iterator_tag)
|
forward_iterator_tag)
|
||||||
{
|
{
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (__beg == __end && __a == _Alloc())
|
if (__beg == __end && __a == _Alloc())
|
||||||
return _S_empty_rep()._M_refdata();
|
return _S_empty_rep()._M_refdata();
|
||||||
|
#endif
|
||||||
// NB: Not required, but considered best practice.
|
// 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"));
|
__throw_logic_error(__N("basic_string::_S_construct NULL not valid"));
|
||||||
|
|
||||||
const size_type __dnew = static_cast<size_type>(std::distance(__beg,
|
const size_type __dnew = static_cast<size_type>(std::distance(__beg,
|
||||||
|
@ -162,9 +165,10 @@ namespace std
|
||||||
basic_string<_CharT, _Traits, _Alloc>::
|
basic_string<_CharT, _Traits, _Alloc>::
|
||||||
_S_construct(size_type __n, _CharT __c, const _Alloc& __a)
|
_S_construct(size_type __n, _CharT __c, const _Alloc& __a)
|
||||||
{
|
{
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (__n == 0 && __a == _Alloc())
|
if (__n == 0 && __a == _Alloc())
|
||||||
return _S_empty_rep()._M_refdata();
|
return _S_empty_rep()._M_refdata();
|
||||||
|
#endif
|
||||||
// Check for out_of_range and length_error exceptions.
|
// Check for out_of_range and length_error exceptions.
|
||||||
_Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
|
_Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
|
||||||
if (__n)
|
if (__n)
|
||||||
|
@ -358,8 +362,10 @@ namespace std
|
||||||
basic_string<_CharT, _Traits, _Alloc>::_Rep::
|
basic_string<_CharT, _Traits, _Alloc>::_Rep::
|
||||||
_M_destroy(const _Alloc& __a) throw ()
|
_M_destroy(const _Alloc& __a) throw ()
|
||||||
{
|
{
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (this == &_S_empty_rep())
|
if (this == &_S_empty_rep())
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
const size_type __size = sizeof(_Rep_base) +
|
const size_type __size = sizeof(_Rep_base) +
|
||||||
(this->_M_capacity + 1) * sizeof(_CharT);
|
(this->_M_capacity + 1) * sizeof(_CharT);
|
||||||
_Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);
|
_Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);
|
||||||
|
@ -369,8 +375,10 @@ namespace std
|
||||||
void
|
void
|
||||||
basic_string<_CharT, _Traits, _Alloc>::_M_leak_hard()
|
basic_string<_CharT, _Traits, _Alloc>::_M_leak_hard()
|
||||||
{
|
{
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (_M_rep() == &_S_empty_rep())
|
if (_M_rep() == &_S_empty_rep())
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
if (_M_rep()->_M_is_shared())
|
if (_M_rep()->_M_is_shared())
|
||||||
_M_mutate(0, 0, 0);
|
_M_mutate(0, 0, 0);
|
||||||
_M_rep()->_M_set_leaked();
|
_M_rep()->_M_set_leaked();
|
||||||
|
@ -385,8 +393,12 @@ namespace std
|
||||||
const size_type __new_size = __old_size + __len2 - __len1;
|
const size_type __new_size = __old_size + __len2 - __len1;
|
||||||
const size_type __how_much = __old_size - __pos - __len1;
|
const size_type __how_much = __old_size - __pos - __len1;
|
||||||
|
|
||||||
|
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
|
||||||
if (_M_rep() == &_S_empty_rep()
|
if (_M_rep() == &_S_empty_rep()
|
||||||
|| _M_rep()->_M_is_shared() || __new_size > capacity())
|
|| _M_rep()->_M_is_shared() || __new_size > capacity())
|
||||||
|
#else
|
||||||
|
if (_M_rep()->_M_is_shared() || __new_size > capacity())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// Must reallocate.
|
// Must reallocate.
|
||||||
const allocator_type __a = get_allocator();
|
const allocator_type __a = get_allocator();
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (C) 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
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 2, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
// USA.
|
||||||
|
//
|
||||||
|
// As a special exception, you may use this file as part of a free software
|
||||||
|
// library without restriction. Specifically, if other files instantiate
|
||||||
|
// templates or use macros or inline functions from this file, or you compile
|
||||||
|
// this file and link it with other files to produce an executable, this
|
||||||
|
// file does not by itself cause the resulting executable to be covered by
|
||||||
|
// the GNU General Public License. This exception does not however
|
||||||
|
// invalidate any other reasons why the executable file might be covered by
|
||||||
|
// the GNU General Public License.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
|
// as per 21.3.4
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
bool test __attribute__((unused)) = true;
|
||||||
|
|
||||||
|
{
|
||||||
|
std::string empty;
|
||||||
|
char c = empty[0];
|
||||||
|
VERIFY( c == char() );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const std::string empty;
|
||||||
|
char c = empty[0];
|
||||||
|
VERIFY( c == char() );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (C) 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
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 2, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
// USA.
|
||||||
|
//
|
||||||
|
// As a special exception, you may use this file as part of a free software
|
||||||
|
// library without restriction. Specifically, if other files instantiate
|
||||||
|
// templates or use macros or inline functions from this file, or you compile
|
||||||
|
// this file and link it with other files to produce an executable, this
|
||||||
|
// file does not by itself cause the resulting executable to be covered by
|
||||||
|
// the GNU General Public License. This exception does not however
|
||||||
|
// invalidate any other reasons why the executable file might be covered by
|
||||||
|
// the GNU General Public License.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
|
// as per 21.3.4
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
bool test __attribute__((unused)) = true;
|
||||||
|
|
||||||
|
{
|
||||||
|
std::wstring empty;
|
||||||
|
wchar_t c = empty[0];
|
||||||
|
VERIFY( c == wchar_t() );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const std::wstring empty;
|
||||||
|
wchar_t c = empty[0];
|
||||||
|
VERIFY( c == wchar_t() );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright (C) 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
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 2, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
// USA.
|
||||||
|
|
||||||
|
// 21.3.6 string operations
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
|
int test01(void)
|
||||||
|
{
|
||||||
|
bool test __attribute__((unused)) = true;
|
||||||
|
|
||||||
|
std::string empty;
|
||||||
|
|
||||||
|
// data() for size == 0 is non-NULL.
|
||||||
|
VERIFY( empty.size() == 0 );
|
||||||
|
const std::string::value_type* p = empty.data();
|
||||||
|
VERIFY( p != NULL );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
test01();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright (C) 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
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 2, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
// USA.
|
||||||
|
|
||||||
|
// 21.3.6 string operations
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
|
int test01(void)
|
||||||
|
{
|
||||||
|
bool test __attribute__((unused)) = true;
|
||||||
|
|
||||||
|
std::wstring empty;
|
||||||
|
|
||||||
|
// data() for size == 0 is non-NULL.
|
||||||
|
VERIFY( empty.size() == 0 );
|
||||||
|
const std::wstring::value_type* p = empty.data();
|
||||||
|
VERIFY( p != NULL );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
test01();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue