2003-01-14 05:56:56 +01:00
|
|
|
// -*- C++ -*-
|
|
|
|
// Utility subroutines for the C++ library testsuite.
|
2001-08-07 05:38:33 +02:00
|
|
|
//
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
2005-01-06 08:08:48 +01:00
|
|
|
// Free Software Foundation, Inc.
|
2001-08-07 05:38:33 +02:00
|
|
|
//
|
|
|
|
// 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
|
2005-08-17 04:28:44 +02:00
|
|
|
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
2001-08-07 05:38:33 +02:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
// This file provides the following:
|
|
|
|
//
|
2003-07-28 19:12:16 +02:00
|
|
|
// 1) VERIFY(), via _GLIBCXX_ASSERT, from Brent Verner <brent@rcfile.org>.
|
2001-08-07 05:38:33 +02:00
|
|
|
// This file is included in the various testsuite programs to provide
|
|
|
|
// #define(able) assert() behavior for debugging/testing. It may be
|
|
|
|
// a suitable location for other furry woodland creatures as well.
|
|
|
|
//
|
2003-01-14 05:56:56 +01:00
|
|
|
// 2) set_memory_limits()
|
|
|
|
// set_memory_limits() uses setrlimit() to restrict dynamic memory
|
2001-08-07 05:38:33 +02:00
|
|
|
// allocation. We provide a default memory limit if none is passed by the
|
2003-01-14 05:56:56 +01:00
|
|
|
// calling application. The argument to set_memory_limits() is the
|
2004-04-01 11:16:36 +02:00
|
|
|
// limit in megabytes (a floating-point number). If _GLIBCXX_RES_LIMITS is
|
2002-01-18 00:37:43 +01:00
|
|
|
// not #defined before including this header, then no limiting is attempted.
|
2001-12-27 22:51:28 +01:00
|
|
|
//
|
2003-01-14 05:56:56 +01:00
|
|
|
// 3) counter
|
2001-12-27 22:51:28 +01:00
|
|
|
// This is a POD with a static data member, gnu_counting_struct::count,
|
|
|
|
// which starts at zero, increments on instance construction, and decrements
|
|
|
|
// on instance destruction. "assert_count(n)" can be called to VERIFY()
|
|
|
|
// that the count equals N.
|
2002-05-29 01:15:18 +02:00
|
|
|
//
|
2003-01-14 05:56:56 +01:00
|
|
|
// 4) copy_tracker, from Stephen M. Webb <stephen@bregmasoft.com>.
|
2002-05-29 01:15:18 +02:00
|
|
|
// A class with nontrivial ctor/dtor that provides the ability to track the
|
|
|
|
// number of copy ctors and dtors, and will throw on demand during copy.
|
2001-08-07 05:38:33 +02:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _GLIBCXX_TESTSUITE_HOOKS_H
|
|
|
|
#define _GLIBCXX_TESTSUITE_HOOKS_H
|
2001-08-07 05:38:33 +02:00
|
|
|
|
2002-07-31 04:47:36 +02:00
|
|
|
#include <bits/c++config.h>
|
2002-08-02 18:04:16 +02:00
|
|
|
#include <bits/functexcept.h>
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
#include <ctime>
|
|
|
|
|
2004-01-12 09:11:08 +01:00
|
|
|
#ifdef _GLIBCXX_HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
2003-10-21 00:11:40 +02:00
|
|
|
|
2003-07-28 19:12:16 +02:00
|
|
|
#ifdef _GLIBCXX_ASSERT
|
2001-08-07 05:38:33 +02:00
|
|
|
# include <cassert>
|
|
|
|
# define VERIFY(fn) assert(fn)
|
|
|
|
#else
|
|
|
|
# define VERIFY(fn) test &= (fn)
|
|
|
|
#endif
|
2003-10-21 00:11:40 +02:00
|
|
|
|
2003-07-06 06:30:10 +02:00
|
|
|
#ifdef _GLIBCXX_HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#else
|
|
|
|
# define unlink(x)
|
|
|
|
#endif
|
2001-08-07 05:38:33 +02:00
|
|
|
|
2003-07-24 23:08:03 +02:00
|
|
|
namespace __gnu_test
|
2003-01-14 05:56:56 +01:00
|
|
|
{
|
2003-07-05 06:05:45 +02:00
|
|
|
// All macros are defined in GLIBCXX_CONFIGURE_TESTSUITE and imported
|
2003-01-14 05:56:56 +01:00
|
|
|
// from c++config.h
|
2001-08-07 05:38:33 +02:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
// Set memory limits if possible, if not set to 0.
|
2004-04-01 11:16:36 +02:00
|
|
|
#ifndef _GLIBCXX_RES_LIMITS
|
2003-01-14 05:56:56 +01:00
|
|
|
# define MEMLIMIT_MB 0
|
2001-08-10 08:50:34 +02:00
|
|
|
#else
|
2003-01-14 05:56:56 +01:00
|
|
|
# ifndef MEMLIMIT_MB
|
|
|
|
# define MEMLIMIT_MB 16.0
|
|
|
|
# endif
|
2001-08-07 05:38:33 +02:00
|
|
|
#endif
|
2003-01-14 05:56:56 +01:00
|
|
|
extern void
|
|
|
|
set_memory_limits(float __size = MEMLIMIT_MB);
|
2001-08-07 05:38:33 +02:00
|
|
|
|
2004-04-01 11:16:36 +02:00
|
|
|
extern void
|
|
|
|
set_file_limit(unsigned long __size);
|
2003-02-27 17:57:26 +01:00
|
|
|
|
|
|
|
// Check mangled name demangles (using __cxa_demangle) as expected.
|
|
|
|
void
|
|
|
|
verify_demangle(const char* mangled, const char* wanted);
|
|
|
|
|
2004-11-02 20:00:19 +01:00
|
|
|
// 17.3.2.1.2 - Bitmask types [lib.bitmask.types]
|
|
|
|
// bitmask_operators
|
|
|
|
template<typename bitmask_type>
|
|
|
|
void
|
2005-12-28 10:57:57 +01:00
|
|
|
bitmask_operators(bitmask_type a = bitmask_type(),
|
|
|
|
bitmask_type b = bitmask_type())
|
2004-11-02 20:00:19 +01:00
|
|
|
{
|
|
|
|
a | b;
|
|
|
|
a & b;
|
|
|
|
a ^ b;
|
|
|
|
~b;
|
|
|
|
a |= b; // set
|
|
|
|
a &= ~b; // clear
|
|
|
|
a ^= b;
|
|
|
|
}
|
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
// Simple callback structure for variable numbers of tests (all with
|
|
|
|
// same signature). Assume all unit tests are of the signature
|
|
|
|
// void test01();
|
2003-07-28 19:12:16 +02:00
|
|
|
class func_callback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef void (*test_type) (void);
|
|
|
|
|
|
|
|
private:
|
|
|
|
int _M_size;
|
|
|
|
test_type _M_tests[15];
|
2004-05-22 23:51:07 +02:00
|
|
|
|
|
|
|
func_callback&
|
|
|
|
operator=(const func_callback&);
|
|
|
|
|
|
|
|
func_callback(const func_callback&);
|
|
|
|
|
2003-07-28 19:12:16 +02:00
|
|
|
public:
|
|
|
|
func_callback(): _M_size(0) { };
|
|
|
|
|
|
|
|
int
|
|
|
|
size() const { return _M_size; }
|
|
|
|
|
|
|
|
const test_type*
|
|
|
|
tests() const { return _M_tests; }
|
|
|
|
|
|
|
|
void
|
|
|
|
push_back(test_type test)
|
|
|
|
{
|
|
|
|
_M_tests[_M_size] = test;
|
|
|
|
++_M_size;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2001-08-07 05:38:33 +02:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
// Run select unit tests after setting global locale.
|
|
|
|
void
|
|
|
|
run_tests_wrapped_locale(const char*, const func_callback&);
|
2001-12-27 22:51:28 +01:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
// Run select unit tests after setting environment variables.
|
|
|
|
void
|
|
|
|
run_tests_wrapped_env(const char*, const char*, const func_callback&);
|
|
|
|
|
[multiple changes]
2005-06-06 Paolo Carlini <pcarlini@suse.de>
Port from libstdcxx_so_7-branch:
2004-09-24 Paolo Carlini <pcarlini@suse.de>
Jonathan Wakely <redi@gcc.gnu.org>
* include/bits/stl_list.h (list::list(size_type, value_type,
const allocator_type&): Implement according to the letter of the
standard, i.e., don't use two overloads, not equivalent in case
of non default constructible T.
(list::resize(size_type, const value_type&)): Fix the signature:
according to the standard the second argument is by value; also,
don't use two overloads.
* include/bits/list.tcc (list::resize(size_type, const value_type&)):
Adjust consistently the signature.
* include/bits/stl_deque.h (deque::deque(size_type, value_type,
const allocator_type&)): Likewise.
(deque::resize(size_type, const value_type&)): Likewise.
* include/bits/stl_vector.h (vector::vector(size_type, value_type,
const allocator_type&)): Likewise.
(vector::resize(size_type, const value_type&)): Likewise.
* testsuite/testsuite_hooks.h: Add NonDefaultConstructible test type.
* testsuite/23_containers/deque/explicit_instantiation/2.cc: New.
* testsuite/23_containers/list/explicit_instantiation/2.cc: New.
* testsuite/23_containers/map/explicit_instantiation/2.cc: New.
* testsuite/23_containers/multimap/explicit_instantiation/2.cc: New.
* testsuite/23_containers/multiset/explicit_instantiation/2.cc: New.
* testsuite/23_containers/set/explicit_instantiation/2.cc: New.
* testsuite/23_containers/vector/explicit_instantiation/2.cc: New.
* include/bits/deque.tcc: Minor formatting fix.
From-SVN: r100668
2005-06-06 18:59:55 +02:00
|
|
|
|
|
|
|
// For containers (23.1/3).
|
|
|
|
struct NonDefaultConstructible
|
|
|
|
{
|
|
|
|
NonDefaultConstructible(int) { }
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool
|
2005-12-28 10:57:57 +01:00
|
|
|
operator==(const NonDefaultConstructible&,
|
|
|
|
const NonDefaultConstructible&)
|
[multiple changes]
2005-06-06 Paolo Carlini <pcarlini@suse.de>
Port from libstdcxx_so_7-branch:
2004-09-24 Paolo Carlini <pcarlini@suse.de>
Jonathan Wakely <redi@gcc.gnu.org>
* include/bits/stl_list.h (list::list(size_type, value_type,
const allocator_type&): Implement according to the letter of the
standard, i.e., don't use two overloads, not equivalent in case
of non default constructible T.
(list::resize(size_type, const value_type&)): Fix the signature:
according to the standard the second argument is by value; also,
don't use two overloads.
* include/bits/list.tcc (list::resize(size_type, const value_type&)):
Adjust consistently the signature.
* include/bits/stl_deque.h (deque::deque(size_type, value_type,
const allocator_type&)): Likewise.
(deque::resize(size_type, const value_type&)): Likewise.
* include/bits/stl_vector.h (vector::vector(size_type, value_type,
const allocator_type&)): Likewise.
(vector::resize(size_type, const value_type&)): Likewise.
* testsuite/testsuite_hooks.h: Add NonDefaultConstructible test type.
* testsuite/23_containers/deque/explicit_instantiation/2.cc: New.
* testsuite/23_containers/list/explicit_instantiation/2.cc: New.
* testsuite/23_containers/map/explicit_instantiation/2.cc: New.
* testsuite/23_containers/multimap/explicit_instantiation/2.cc: New.
* testsuite/23_containers/multiset/explicit_instantiation/2.cc: New.
* testsuite/23_containers/set/explicit_instantiation/2.cc: New.
* testsuite/23_containers/vector/explicit_instantiation/2.cc: New.
* include/bits/deque.tcc: Minor formatting fix.
From-SVN: r100668
2005-06-06 18:59:55 +02:00
|
|
|
{ return false; }
|
|
|
|
|
|
|
|
inline bool
|
2005-12-28 10:57:57 +01:00
|
|
|
operator<(const NonDefaultConstructible&,
|
|
|
|
const NonDefaultConstructible&)
|
[multiple changes]
2005-06-06 Paolo Carlini <pcarlini@suse.de>
Port from libstdcxx_so_7-branch:
2004-09-24 Paolo Carlini <pcarlini@suse.de>
Jonathan Wakely <redi@gcc.gnu.org>
* include/bits/stl_list.h (list::list(size_type, value_type,
const allocator_type&): Implement according to the letter of the
standard, i.e., don't use two overloads, not equivalent in case
of non default constructible T.
(list::resize(size_type, const value_type&)): Fix the signature:
according to the standard the second argument is by value; also,
don't use two overloads.
* include/bits/list.tcc (list::resize(size_type, const value_type&)):
Adjust consistently the signature.
* include/bits/stl_deque.h (deque::deque(size_type, value_type,
const allocator_type&)): Likewise.
(deque::resize(size_type, const value_type&)): Likewise.
* include/bits/stl_vector.h (vector::vector(size_type, value_type,
const allocator_type&)): Likewise.
(vector::resize(size_type, const value_type&)): Likewise.
* testsuite/testsuite_hooks.h: Add NonDefaultConstructible test type.
* testsuite/23_containers/deque/explicit_instantiation/2.cc: New.
* testsuite/23_containers/list/explicit_instantiation/2.cc: New.
* testsuite/23_containers/map/explicit_instantiation/2.cc: New.
* testsuite/23_containers/multimap/explicit_instantiation/2.cc: New.
* testsuite/23_containers/multiset/explicit_instantiation/2.cc: New.
* testsuite/23_containers/set/explicit_instantiation/2.cc: New.
* testsuite/23_containers/vector/explicit_instantiation/2.cc: New.
* include/bits/deque.tcc: Minor formatting fix.
From-SVN: r100668
2005-06-06 18:59:55 +02:00
|
|
|
{ return false; }
|
|
|
|
|
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
// Counting.
|
|
|
|
struct counter
|
|
|
|
{
|
2001-12-27 22:51:28 +01:00
|
|
|
// Specifically and glaringly-obviously marked 'signed' so that when
|
2002-05-29 01:15:18 +02:00
|
|
|
// COUNT mistakenly goes negative, we can track the patterns of
|
|
|
|
// deletions more easily.
|
2001-12-27 22:51:28 +01:00
|
|
|
typedef signed int size_type;
|
|
|
|
static size_type count;
|
2003-01-14 05:56:56 +01:00
|
|
|
counter() { ++count; }
|
|
|
|
counter (const counter&) { ++count; }
|
|
|
|
~counter() { --count; }
|
|
|
|
};
|
|
|
|
|
2003-07-24 23:08:03 +02:00
|
|
|
#define assert_count(n) VERIFY(__gnu_test::counter::count == n)
|
2003-01-14 05:56:56 +01:00
|
|
|
|
|
|
|
// A (static) class for counting copy constructors and possibly throwing an
|
|
|
|
// exception on a desired count.
|
|
|
|
class copy_constructor
|
2002-11-26 01:53:12 +01:00
|
|
|
{
|
2003-01-14 05:56:56 +01:00
|
|
|
public:
|
|
|
|
static unsigned int
|
|
|
|
count() { return count_; }
|
|
|
|
|
|
|
|
static void
|
|
|
|
mark_call()
|
2002-11-26 01:53:12 +01:00
|
|
|
{
|
2003-01-14 05:56:56 +01:00
|
|
|
count_++;
|
|
|
|
if (count_ == throw_on_)
|
2005-01-06 08:08:48 +01:00
|
|
|
std::__throw_runtime_error("copy_constructor::mark_call");
|
2002-11-26 01:53:12 +01:00
|
|
|
}
|
2003-01-14 05:56:56 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
reset()
|
2002-11-26 01:53:12 +01:00
|
|
|
{
|
2003-01-14 05:56:56 +01:00
|
|
|
count_ = 0;
|
|
|
|
throw_on_ = 0;
|
2002-11-26 01:53:12 +01:00
|
|
|
}
|
2003-01-14 05:56:56 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
throw_on(unsigned int count) { throw_on_ = count; }
|
2002-11-26 01:53:12 +01:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
private:
|
|
|
|
static unsigned int count_;
|
|
|
|
static unsigned int throw_on_;
|
|
|
|
};
|
|
|
|
|
|
|
|
// A (static) class for counting assignment operator calls and
|
|
|
|
// possibly throwing an exception on a desired count.
|
|
|
|
class assignment_operator
|
2002-11-26 01:53:12 +01:00
|
|
|
{
|
2003-01-14 05:56:56 +01:00
|
|
|
public:
|
|
|
|
static unsigned int
|
|
|
|
count() { return count_; }
|
|
|
|
|
|
|
|
static void
|
|
|
|
mark_call()
|
|
|
|
{
|
|
|
|
count_++;
|
|
|
|
if (count_ == throw_on_)
|
2005-01-06 08:08:48 +01:00
|
|
|
std::__throw_runtime_error("assignment_operator::mark_call");
|
2003-01-14 05:56:56 +01:00
|
|
|
}
|
2002-11-26 01:53:12 +01:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
static void
|
|
|
|
reset()
|
|
|
|
{
|
|
|
|
count_ = 0;
|
|
|
|
throw_on_ = 0;
|
|
|
|
}
|
2002-11-26 01:53:12 +01:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
static void
|
|
|
|
throw_on(unsigned int count) { throw_on_ = count; }
|
2002-11-26 01:53:12 +01:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
private:
|
|
|
|
static unsigned int count_;
|
|
|
|
static unsigned int throw_on_;
|
|
|
|
};
|
|
|
|
|
|
|
|
// A (static) class for tracking calls to an object's destructor.
|
|
|
|
class destructor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static unsigned int
|
|
|
|
count() { return _M_count; }
|
|
|
|
|
|
|
|
static void
|
|
|
|
mark_call() { _M_count++; }
|
2002-11-26 01:53:12 +01:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
static void
|
|
|
|
reset() { _M_count = 0; }
|
2002-11-26 01:53:12 +01:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
private:
|
|
|
|
static unsigned int _M_count;
|
|
|
|
};
|
|
|
|
|
|
|
|
// An class of objects that can be used for validating various
|
|
|
|
// behaviours and guarantees of containers and algorithms defined in
|
|
|
|
// the standard library.
|
|
|
|
class copy_tracker
|
|
|
|
{
|
2002-05-29 01:15:18 +02:00
|
|
|
public:
|
2003-01-14 05:56:56 +01:00
|
|
|
// Creates a copy-tracking object with the given ID number. If
|
|
|
|
// "throw_on_copy" is set, an exception will be thrown if an
|
|
|
|
// attempt is made to copy this object.
|
|
|
|
copy_tracker(int id = next_id_--, bool throw_on_copy = false)
|
|
|
|
: id_(id) , throw_on_copy_(throw_on_copy) { }
|
2002-05-29 01:15:18 +02:00
|
|
|
|
2002-11-26 01:53:12 +01:00
|
|
|
// Copy-constructs the object, marking a call to the copy
|
|
|
|
// constructor and forcing an exception if indicated.
|
2003-01-14 05:56:56 +01:00
|
|
|
copy_tracker(const copy_tracker& rhs)
|
2002-11-26 01:53:12 +01:00
|
|
|
: id_(rhs.id()), throw_on_copy_(rhs.throw_on_copy_)
|
2002-05-29 01:15:18 +02:00
|
|
|
{
|
2002-11-26 01:53:12 +01:00
|
|
|
if (throw_on_copy_)
|
2003-01-14 05:56:56 +01:00
|
|
|
copy_constructor::throw_on(copy_constructor::count() + 1);
|
|
|
|
copy_constructor::mark_call();
|
2002-11-26 01:53:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Assigns the value of another object to this one, tracking the
|
|
|
|
// number of times this member function has been called and if the
|
|
|
|
// other object is supposed to throw an exception when it is
|
|
|
|
// copied, well, make it so.
|
2003-01-14 05:56:56 +01:00
|
|
|
copy_tracker&
|
|
|
|
operator=(const copy_tracker& rhs)
|
2002-11-26 01:53:12 +01:00
|
|
|
{
|
|
|
|
id_ = rhs.id();
|
|
|
|
if (rhs.throw_on_copy_)
|
2003-01-14 05:56:56 +01:00
|
|
|
assignment_operator::throw_on(assignment_operator::count() + 1);
|
|
|
|
assignment_operator::mark_call();
|
2003-03-21 21:32:45 +01:00
|
|
|
return *this;
|
2002-05-29 01:15:18 +02:00
|
|
|
}
|
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
~copy_tracker()
|
|
|
|
{ destructor::mark_call(); }
|
2002-05-29 01:15:18 +02:00
|
|
|
|
|
|
|
int
|
2003-01-14 05:56:56 +01:00
|
|
|
id() const { return id_; }
|
2002-05-29 01:15:18 +02:00
|
|
|
|
|
|
|
private:
|
2002-11-26 01:53:12 +01:00
|
|
|
int id_;
|
|
|
|
const bool throw_on_copy_;
|
2002-05-29 01:15:18 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
static void
|
|
|
|
reset()
|
2002-11-26 01:53:12 +01:00
|
|
|
{
|
2003-01-14 05:56:56 +01:00
|
|
|
copy_constructor::reset();
|
|
|
|
assignment_operator::reset();
|
|
|
|
destructor::reset();
|
2002-11-26 01:53:12 +01:00
|
|
|
}
|
2002-05-29 01:15:18 +02:00
|
|
|
|
2002-11-26 01:53:12 +01:00
|
|
|
// for backwards-compatibility
|
2002-05-29 01:15:18 +02:00
|
|
|
static int
|
|
|
|
copyCount()
|
2003-01-14 05:56:56 +01:00
|
|
|
{ return copy_constructor::count(); }
|
2002-05-29 01:15:18 +02:00
|
|
|
|
2002-11-26 01:53:12 +01:00
|
|
|
// for backwards-compatibility
|
2002-05-29 01:15:18 +02:00
|
|
|
static int
|
|
|
|
dtorCount()
|
2003-01-14 05:56:56 +01:00
|
|
|
{ return destructor::count(); }
|
2002-05-29 01:15:18 +02:00
|
|
|
|
|
|
|
private:
|
2002-11-26 01:53:12 +01:00
|
|
|
static int next_id_;
|
2003-01-14 05:56:56 +01:00
|
|
|
};
|
2002-07-31 04:47:36 +02:00
|
|
|
|
2003-01-14 05:56:56 +01:00
|
|
|
inline bool
|
|
|
|
operator==(const copy_tracker& lhs, const copy_tracker& rhs)
|
|
|
|
{ return lhs.id() == rhs.id(); }
|
2004-05-18 05:27:57 +02:00
|
|
|
|
|
|
|
// Class for checking required type conversions, implicit and
|
|
|
|
// explicit for given library data structures.
|
|
|
|
template<typename _Container>
|
|
|
|
struct conversion
|
|
|
|
{
|
|
|
|
typedef typename _Container::const_iterator const_iterator;
|
|
|
|
|
|
|
|
// Implicit conversion iterator to const_iterator.
|
|
|
|
static const_iterator
|
|
|
|
iterator_to_const_iterator()
|
|
|
|
{
|
|
|
|
_Container v;
|
|
|
|
const_iterator it = v.begin();
|
|
|
|
const_iterator end = v.end();
|
|
|
|
return it == end ? v.end() : it;
|
|
|
|
}
|
|
|
|
};
|
2005-01-03 22:31:39 +01:00
|
|
|
|
|
|
|
// A binary semaphore for use across multiple processes.
|
|
|
|
class semaphore
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Creates a binary semaphore. The semaphore is initially in the
|
|
|
|
// unsignaled state.
|
2005-01-04 01:17:16 +01:00
|
|
|
semaphore();
|
2005-01-03 22:31:39 +01:00
|
|
|
|
|
|
|
// Destroy the semaphore.
|
|
|
|
~semaphore();
|
|
|
|
|
|
|
|
// Signal the semaphore. If there are processes blocked in
|
|
|
|
// "wait", exactly one will be permitted to proceed.
|
2005-01-04 01:17:16 +01:00
|
|
|
void signal();
|
2005-01-03 22:31:39 +01:00
|
|
|
|
|
|
|
// Wait until the semaphore is signaled.
|
2005-01-04 01:17:16 +01:00
|
|
|
void wait();
|
2005-01-03 22:31:39 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
int sem_set_;
|
|
|
|
|
|
|
|
pid_t pid_;
|
|
|
|
};
|
2006-01-06 01:06:52 +01:00
|
|
|
|
|
|
|
// For use in 22_locale/time_get and time_put.
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
std::tm test_tm(int sec, int min, int hour, int mday, int mon,
|
|
|
|
int year, int wday, int yday, int isdst);
|
2006-01-06 01:06:52 +01:00
|
|
|
|
2003-07-24 23:08:03 +02:00
|
|
|
} // namespace __gnu_test
|
2002-07-31 04:47:36 +02:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#endif // _GLIBCXX_TESTSUITE_HOOKS_H
|
2001-08-07 05:38:33 +02:00
|
|
|
|