diff options
Diffstat (limited to 'libstdc++-v3')
39 files changed, 579 insertions, 1839 deletions
diff --git a/libstdc++-v3/config/allocator/bitmap_allocator_base.h b/libstdc++-v3/config/allocator/bitmap_allocator_base.h deleted file mode 100644 index bf84ae06d7f..00000000000 --- a/libstdc++-v3/config/allocator/bitmap_allocator_base.h +++ /dev/null @@ -1,37 +0,0 @@ -// Base to std::allocator -*- C++ -*- - -// 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. - -#ifndef _CXX_ALLOCATOR_H -#define _CXX_ALLOCATOR_H 1 - -// Define bitmap_allocator as the base class to std::allocator. -#include <ext/bitmap_allocator.h> -#define ___glibcxx_base_allocator __gnu_cxx::bitmap_allocator - -#endif diff --git a/libstdc++-v3/config/allocator/malloc_allocator_base.h b/libstdc++-v3/config/allocator/malloc_allocator_base.h deleted file mode 100644 index 4a82ec362c5..00000000000 --- a/libstdc++-v3/config/allocator/malloc_allocator_base.h +++ /dev/null @@ -1,37 +0,0 @@ -// Base to std::allocator -*- C++ -*- - -// 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. - -#ifndef _CXX_ALLOCATOR_H -#define _CXX_ALLOCATOR_H 1 - -// Define new_allocator as the base class to std::allocator. -#include <ext/malloc_allocator.h> -#define ___glibcxx_base_allocator __gnu_cxx::malloc_allocator - -#endif diff --git a/libstdc++-v3/config/allocator/mt_allocator_base.h b/libstdc++-v3/config/allocator/mt_allocator_base.h deleted file mode 100644 index 52b4421a439..00000000000 --- a/libstdc++-v3/config/allocator/mt_allocator_base.h +++ /dev/null @@ -1,37 +0,0 @@ -// Base to std::allocator -*- C++ -*- - -// 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. - -#ifndef _CXX_ALLOCATOR_H -#define _CXX_ALLOCATOR_H 1 - -// Define mt_allocator as the base class to std::allocator. -#include <ext/mt_allocator.h> -#define ___glibcxx_base_allocator __gnu_cxx::__mt_alloc - -#endif diff --git a/libstdc++-v3/config/allocator/new_allocator_base.h b/libstdc++-v3/config/allocator/new_allocator_base.h deleted file mode 100644 index 442f89cc535..00000000000 --- a/libstdc++-v3/config/allocator/new_allocator_base.h +++ /dev/null @@ -1,37 +0,0 @@ -// Base to std::allocator -*- C++ -*- - -// 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. - -#ifndef _CXX_ALLOCATOR_H -#define _CXX_ALLOCATOR_H 1 - -// Define new_allocator as the base class to std::allocator. -#include <ext/new_allocator.h> -#define ___glibcxx_base_allocator __gnu_cxx::new_allocator - -#endif diff --git a/libstdc++-v3/config/os/bsd/darwin/ctype_base.h b/libstdc++-v3/config/os/bsd/darwin/ctype_base.h new file mode 100644 index 00000000000..66f59010649 --- /dev/null +++ b/libstdc++-v3/config/os/bsd/darwin/ctype_base.h @@ -0,0 +1,77 @@ +// APPLE LOCAL file darwin-specific headers +// Locale support -*- C++ -*- + +// Copyright (C) 2000 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. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h on FreeBSD 3.4, +// 4.0 and all versions of the CVS managed file at: +// :pserver:anoncvs@anoncvs.freebsd.org:/home/ncvs/src/include/ctype.h + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned long mask; +#ifdef _CTYPE_S + // FreeBSD 4.0 uses this style of define. + static const mask upper = _CTYPE_U; + static const mask lower = _CTYPE_L; + static const mask alpha = _CTYPE_A; + static const mask digit = _CTYPE_D; + static const mask xdigit = _CTYPE_X; + static const mask space = _CTYPE_S; + static const mask print = _CTYPE_R; + static const mask graph = _CTYPE_G; + static const mask cntrl = _CTYPE_C; + static const mask punct = _CTYPE_P; + static const mask alnum = _CTYPE_A | _CTYPE_D; +#else + // Older versions, including Free BSD 3.4, use this style of define. + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _A; + static const mask digit = _D; + static const mask xdigit = _X; + static const mask space = _S; + static const mask print = _R; + static const mask graph = _G; + static const mask cntrl = _C; + static const mask punct = _P; + static const mask alnum = _A | _D; +#endif + }; + + + diff --git a/libstdc++-v3/config/os/bsd/darwin/ctype_inline.h b/libstdc++-v3/config/os/bsd/darwin/ctype_inline.h new file mode 100644 index 00000000000..ea8e93539f3 --- /dev/null +++ b/libstdc++-v3/config/os/bsd/darwin/ctype_inline.h @@ -0,0 +1,95 @@ +// APPLE LOCAL file darwin-specific headers +// Locale support -*- C++ -*- + +// Copyright (C) 2000 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. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { + return __istype(__c, __m); + } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + for (;__low < __high; ++__vec, ++__low) + { +#if defined (_CTYPE_S) || defined (__istype) + *__vec = __maskrune (*__low, upper | lower | alpha | digit | xdigit + | space | print | graph | cntrl | punct | alnum); +#else + mask __m = 0; + if (this->is(upper, *__low)) __m |= upper; + if (this->is(lower, *__low)) __m |= lower; + if (this->is(alpha, *__low)) __m |= alpha; + if (this->is(digit, *__low)) __m |= digit; + if (this->is(xdigit, *__low)) __m |= xdigit; + if (this->is(space, *__low)) __m |= space; + if (this->is(print, *__low)) __m |= print; + if (this->is(graph, *__low)) __m |= graph; + if (this->is(cntrl, *__low)) __m |= cntrl; + if (this->is(punct, *__low)) __m |= punct; + // Do not include explicit line for alnum mask since it is a + // pure composite of masks on FreeBSD. + *__vec = __m; +#endif + } + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } + + + + + diff --git a/libstdc++-v3/config/os/bsd/darwin/ctype_noninline.h b/libstdc++-v3/config/os/bsd/darwin/ctype_noninline.h new file mode 100644 index 00000000000..34bbe5cb2c7 --- /dev/null +++ b/libstdc++-v3/config/os/bsd/darwin/ctype_noninline.h @@ -0,0 +1,82 @@ +// APPLE LOCAL file darwin-specific headers +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 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. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { return ::toupper((int) __c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper((int) *__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return ::tolower((int) __c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower((int) *__low); + ++__low; + } + return __high; + } diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h b/libstdc++-v3/config/os/bsd/darwin/os_defines.h new file mode 100644 index 00000000000..6a006e30217 --- /dev/null +++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h @@ -0,0 +1,161 @@ +// APPLE LOCAL file darwin-specific headers +// Specific definitions for BSD -*- C++ -*- + +// Copyright (C) 2000 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. + + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#define __glibcpp_long_double_bits __glibcpp_double_bits + +#define _GLIBCPP_AVOID_FSEEK 1 + +/* APPLE LOCAL begin keymgr */ +/* Copyright (C) 1989, 92-97, 1998, Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC 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. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +/* + * This file added by Apple Computer Inc. for its OS X + * environment. + */ + +#ifndef __KEYMGR_H +#define __KEYMGR_H + +#ifdef __cplusplus +extern "C" { +#endif + + + +/* + * keymgr - Create and maintain process-wide global data known to + * all threads across all dynamic libraries. + * + */ + +typedef enum node_kinds { + NODE_THREAD_SPECIFIC_DATA=1, + NODE_PROCESSWIDE_PTR=2, + NODE_LAST_KIND + } TnodeKind ; + +/* + * These enum members are bits or combination of bits. + */ + +typedef enum node_mode { + NM_ALLOW_RECURSION=1, + NM_RECURSION_ILLEGAL=2, + NM_ENHANCED_LOCKING=3, + NM_LOCKED=4 + } TnodeMode ; + + + +extern void * _keymgr_get_per_thread_data(unsigned int key) ; +extern void _keymgr_set_per_thread_data(unsigned int key, void *keydata) ; +extern void *_keymgr_get_and_lock_processwide_ptr(unsigned int key) ; +extern void _keymgr_set_and_unlock_processwide_ptr(unsigned int key, void *ptr) ; +extern void _keymgr_unlock_processwide_ptr(unsigned int key) ; +extern void _keymgr_set_lockmode_processwide_ptr(unsigned int key, unsigned int mode) ; +extern unsigned int _keymgr_get_lockmode_processwide_ptr(unsigned int key) ; +extern int _keymgr_get_lock_count_processwide_ptr(unsigned int key) ; + +#ifndef NULL +#define NULL (0) +#endif + +/* + * Keys currently in use: + */ + +#define KEYMGR_EH_CONTEXT_KEY 1 /*stores handle for root pointer of exception context node.*/ + +#define KEYMGR_NEW_HANLDER_KEY 2 /*store handle for new handler pointer.*/ + +#define KEYMGR_UNEXPECTED_HANDLER_KEY 3 /*store handle for unexpected exception pointer.*/ + +#define KEYMGR_TERMINATE_HANDLER_KEY 4 /*store handle for terminate handler pointer. */ + +#define KEYMGR_MODE_BITS 5 /*stores handle for runtime mode bits.*/ + +#define KEYMGR_IO_LIST 6 /*Root pointer to the list of open streams.*/ + +#define KEYMGR_IO_STDIN 7 /*GNU stdin.*/ + +#define KEYMGR_IO_STDOUT 8 /*GNU stdout.*/ + +#define KEYMGR_IO_STDERR 9 /*GNU stderr.*/ + +#define KEYMGR_IO_REFCNT 10 /*How many plugins/main program currently using streams.*/ + +#define KEYMGR_IO_MODE_BITS 11 /*Flags controlling the behavior of C++ I/O.*/ + +#define KEYMGR_ZOE_IMAGE_LIST 12 /*Head pointer for list of per image dwarf2 unwind sections.*/ + + + +/* + * Other important data. + */ + +#define KEYMGR_API_REV_MAJOR 2 /*Major revision number of the keymgr API.*/ +#define KEYMGR_API_REV_MINOR 1 /*Minor revision number of the keymgr API.*/ + + + +#ifdef __cplusplus +} +#endif + +#endif /* __KEYMGR_H */ +/* APPLE LOCAL end keymgr */ + +#endif /* _GLIBCPP_OS_DEFINES */ diff --git a/libstdc++-v3/docs/html/ext/ballocator_doc.txt b/libstdc++-v3/docs/html/ext/ballocator_doc.txt deleted file mode 100644 index 2173b618f4f..00000000000 --- a/libstdc++-v3/docs/html/ext/ballocator_doc.txt +++ /dev/null @@ -1,374 +0,0 @@ - BITMAPPED ALLOCATOR - =================== - -2004-03-11 Dhruv Matani <dhruvbird@HotPOP.com> - ---------------------------------------------------------------------- - -As this name suggests, this allocator uses a bit-map to keep track of -the used and unused memory locations for it's book-keeping purposes. - -This allocator will make use of 1 single bit to keep track of whether -it has been allocated or not. A bit 1 indicates free, while 0 -indicates allocated. This has been done so that you can easily check a -collection of bits for a free block. This kind of Bitmapped strategy -works best for single object allocations, and with the STL type -parameterized allocators, we do not need to choose any size for the -block which will be represented by a single bit. This will be the size -of the parameter around which the allocator has been -parameterized. Thus, close to optimal performance will result. Hence, -this should be used for node based containers which call the allocate -function with an argument of 1. - -The bitmapped allocator's internal pool is exponentially -growing. Meaning that internally, the blocks acquired from the Free -List Store will double every time the bitmapped allocator runs out of -memory. - --------------------------------------------------------------------- - -The macro __GTHREADS decides whether to use Mutex Protection around -every allocation/deallocation. The state of the macro is picked up -automatically from the gthr abstration layer. - ----------------------------------------------------------------------- - -What is the Free List Store? ----------------------------- - -The Free List Store (referred to as FLS for the remaining part of this -document) is the Global memory pool that is shared by all instances of -the bitmapped allocator instantiated for any type. This maintains a -sorted order of all free memory blocks given back to it by the -bitmapped allocator, and is also responsible for giving memory to the -bitmapped allocator when it asks for more. - -Internally, there is a Free List threshold which indicates the Maximum -number of free lists that the FLS can hold internally -(cache). Currently, this value is set at 64. So, if there are more -than 64 free lists coming in, then some of them will be given back to -the OS using operator delete so that at any given time the Free List's -size does not exceed 64 entries. This is done because a Binary Search -is used to locate an entry in a free list when a request for memory -comes along. Thus, the run-time complexity of the search would go up -given an increasing size, for 64 entries however, lg(64) == 6 -comparisons are enough to locate the correct free list if it exists. - -Suppose the free list size has reached it's threshold, then the -largest block from among those in the list and the new block will be -selected and given back to the OS. This is done because it reduces -external fragmentation, and allows the OS to use the larger blocks -later in an orderly fashion, possibly merging them later. Also, on -some systems, large blocks are obtained via calls to mmap, so giving -them back to free system resources becomes most important. - -The function _S_should_i_give decides the policy that determines -whether the current block of memory should be given to the allocator -for the request that it has made. That's because we may not always -have exact fits for the memory size that the allocator requests. We do -this mainly to prevent external fragmentation at the cost of a little -internal fragmentation. Now, the value of this internal fragmentation -has to be decided by this function. I can see 3 possibilities right -now. Please add more as and when you find better strategies. - -1. Equal size check. Return true only when the 2 blocks are of equal - size. - -2. Difference Threshold: Return true only when the _block_size is - greater than or equal to the _required_size, and if the _BS is > - _RS by a difference of less than some THRESHOLD value, then return - true, else return false. - -3. Percentage Threshold. Return true only when the _block_size is - greater than or equal to the _required_size, and if the _BS is > - _RS by a percentage of less than some THRESHOLD value, then return - true, else return false. - -Currently, (3) is being used with a value of 36% Maximum wastage per -Super Block. - --------------------------------------------------------------------- - -1) What is a super block? Why is it needed? - - A super block is the block of memory acquired from the FLS from - which the bitmap allocator carves out memory for single objects and - satisfies the user's requests. These super blocks come in sizes that - are powers of 2 and multiples of 32 (_Bits_Per_Block). Yes both at - the same time! That's because the next super block acquired will be - 2 times the previous one, and also all super blocks have to be - multiples of the _Bits_Per_Block value. - -2) How does it interact with the free list store? - - The super block is contained in the FLS, and the FLS is responsible - for getting / returning Super Bocks to and from the OS using - operator new as defined by the C++ standard. - ---------------------------------------------------------------------- - -How does the allocate function Work? ------------------------------------- - -The allocate function is specialized for single object allocation -ONLY. Thus, ONLY if n == 1, will the bitmap_allocator's specialized -algorithm be used. Otherwise, the request is satisfied directly by -calling operator new. - -Suppose n == 1, then the allocator does the following: - -1. Checks to see whether the a free block exists somewhere in a region - of memory close to the last satisfied request. If so, then that - block is marked as allocated in the bit map and given to the - user. If not, then (2) is executed. - -2. Is there a free block anywhere after the current block right upto - the end of the memory that we have? If so, that block is found, and - the same procedure is applied as above, and returned to the - user. If not, then (3) is executed. - -3. Is there any block in whatever region of memory that we own free? - This is done by checking (a) The use count for each super block, - and if that fails then (b) The individual bit-maps for each super - block. Note: Here we are never touching any of the memory that the - user will be given, and we are confining all memory accesses to a - small region of memory! This helps reduce cache misses. If this - succeeds then we apply the same procedure on that bit-map as (1), - and return that block of memory to the user. However, if this - process fails, then we resort to (4). - -4. This process involves Refilling the internal exponentially growing - memory pool. The said effect is achieved by calling _S_refill_pool - which does the following: - (a). Gets more memory from the Global Free List of the - Required size. - (b). Adjusts the size for the next call to itself. - (c). Writes the appropriate headers in the bit-maps. - (d). Sets the use count for that super-block just allocated - to 0 (zero). - (e). All of the above accounts to maintaining the basic - invariant for the allocator. If the invariant is - maintained, we are sure that all is well. - Now, the same process is applied on the newly acquired free blocks, - which are dispatched accordingly. - -Thus, you can clearly see that the allocate function is nothing but a -combination of the next-fit and first-fit algorithm optimized ONLY for -single object allocations. - - -------------------------------------------------------------------------- - -How does the deallocate function work? --------------------------------------- - -The deallocate function again is specialized for single objects ONLY. -For all n belonging to > 1, the operator delete is called without -further ado, and the deallocate function returns. - -However for n == 1, a series of steps are performed: - -1. We first need to locate that super-block which holds the memory - location given to us by the user. For that purpose, we maintain a - static variable _S_last_dealloc_index, which holds the index into - the vector of block pairs which indicates the index of the last - super-block from which memory was freed. We use this strategy in - the hope that the user will deallocate memory in a region close to - what he/she deallocated the last time around. If the check for - belongs_to succeeds, then we determine the bit-map for the given - pointer, and locate the index into that bit-map, and mark that bit - as free by setting it. - -2. If the _S_last_dealloc_index does not point to the memory block - that we're looking for, then we do a linear search on the block - stored in the vector of Block Pairs. This vector in code is called - _S_mem_blocks. When the corresponding super-block is found, we - apply the same procedure as we did for (1) to mark the block as - free in the bit-map. - -Now, whenever a block is freed, the use count of that particular super -block goes down by 1. When this use count hits 0, we remove that super -block from the list of all valid super blocks stored in the -vector. While doing this, we also make sure that the basic invariant -is maintained by making sure that _S_last_request and -_S_last_dealloc_index point to valid locations within the vector. - --------------------------------------------------------------------- - - -Data Layout for a Super Block: -============================== - -Each Super Block will be of some size that is a multiple of the number -of Bits Per Block. Typically, this value is chosen as Bits_Per_Byte X -sizeof(unsigned int). On an X86 system, this gives the figure -8 X 4 = 32. Thus, each Super Block will be of size 32 X Some_Value. -This Some_Value is sizeof(value_type). For now, let it be called 'K'. -Thus, finally, Super Block size is 32 X K bytes. - -This value of 32 has been chosen because each unsigned int has 32-bits -and Maximum use of these can be made with such a figure. - -Consider a block of size 32 ints. -In memory, it would look like this: - ---------------------------------------------------------------------- -| 136 | 0 | 4294967295 | Data-> Space for 32-ints | ---------------------------------------------------------------------- - -The first Columns represents the size of the Block in bytes as seen by -the Bitmap Allocator. Internally, a global free list is used to keep -track of the free blocks used and given back by the bitmap -allocator. It is this Free List Store that is responsible for writing -and managing this information. Actually the number of bytes allocated -in this case would be: 4 + 4 + 4 + 32*4 = 140 bytes, but the first 4 -bytes are an addition by the Free List Store, so the Bitmap Allocator -sees only 136 bytes. These first 4 bytes about which the bitmapped -allocator is not aware hold the value 136. - -What do the remaining values represent? ---------------------------------------- - -The 2nd 4 in the expression is the sizeof(unsigned int) because the -Bitmapped Allocator maintains a used count for each Super Block, which -is initially set to 0 (as indicated in the diagram). This is -incremented every time a block is removed from this super block -(allocated), and decremented whenever it is given back. So, when the -used count falls to 0, the whole super block will be given back to the -Free List Store. - -The value 4294967295 represents the integer corresponding to the -bit representation of all bits set: 11111111111111111111111111111111. - -The 3rd 4 is size of the bitmap itself, which is the size of 32-bits, -which is 4-bytes, or 1 X sizeof(unsigned int). - - --------------------------------------------------------------------- - -Another issue would be whether to keep the all bitmaps in a separate -area in memory, or to keep them near the actual blocks that will be -given out or allocated for the client. After some testing, I've -decided to keep these bitmaps close to the actual blocks. this will -help in 2 ways. - -1. Constant time access for the bitmap themselves, since no kind of - look up will be needed to find the correct bitmap list or it's - equivalent. - -2. And also this would preserve the cache as far as possible. - -So in effect, this kind of an allocator might prove beneficial from a -purely cache point of view. But this allocator has been made to try -and roll out the defects of the node_allocator, wherein the nodes get -skewed about in memory, if they are not returned in the exact reverse -order or in the same order in which they were allocated. Also, the -new_allocator's book keeping overhead is too much for small objects -and single object allocations, though it preserves the locality of -blocks very well when they are returned back to the allocator. - -------------------------------------------------------------------- - -Expected overhead per block would be 1 bit in memory. Also, once -the address of the free list has been found, the cost for -allocation/deallocation would be negligible, and is supposed to be -constant time. For these very reasons, it is very important to -minimize the linear time costs, which include finding a free list -with a free block while allocating, and finding the corresponding -free list for a block while deallocating. Therefore, I have decided -that the growth of the internal pool for this allocator will be -exponential as compared to linear for node_allocator. There, linear -time works well, because we are mainly concerned with speed of -allocation/deallocation and memory consumption, whereas here, the -allocation/deallocation part does have some linear/logarithmic -complexity components in it. Thus, to try and minimize them would -be a good thing to do at the cost of a little bit of memory. - -Another thing to be noted is the the pool size will double every time -the internal pool gets exhausted, and all the free blocks have been -given away. The initial size of the pool would be sizeof(unsigned -int)*8 which is the number of bits in an integer, which can fit -exactly in a CPU register. Hence, the term given is exponential growth -of the internal pool. - ---------------------------------------------------------------------- - -After reading all this, you may still have a few questions about the -internal working of this allocator, like my friend had! - -Well here are the exact questions that he posed: - -1) The "Data Layout" section is cryptic. I have no idea of what you - are trying to say. Layout of what? The free-list? Each bitmap? The - Super Block? - - The layout of a Super Block of a given size. In the example, a super - block of size 32 X 1 is taken. The general formula for calculating - the size of a super block is 32*sizeof(value_type)*2^n, where n - ranges from 0 to 32 for 32-bit systems. - -2) And since I just mentioned the term `each bitmap', what in the - world is meant by it? What does each bitmap manage? How does it - relate to the super block? Is the Super Block a bitmap as well? - - Good question! Each bitmap is part of a Super Block which is made up - of 3 parts as I have mentioned earlier. Re-iterating, 1. The use - count, 2. The bit-map for that Super Block. 3. The actual memory - that will be eventually given to the user. Each bitmap is a multiple - of 32 in size. If there are 32*(2^3) blocks of single objects to be - given, there will be '32*(2^3)' bits present. Each 32 bits managing - the allocated / free status for 32 blocks. Since each unsigned int - contains 32-bits, one unsigned int can manage upto 32 blocks' - status. Each bit-map is made up of a number of unsigned ints, whose - exact number for a super-block of a given size I have just - mentioned. - -3) How do the allocate and deallocate functions work in regard to - bitmaps? - - The allocate and deallocate functions manipulate the bitmaps and have - nothing to do with the memory that is given to the user. As I have - earlier mentioned, a 1 in the bitmap's bit field indicates free, - while a 0 indicates allocated. This lets us check 32 bits at a time - to check whether there is at lease one free block in those 32 blocks - by testing for equality with (0). Now, the allocate function will - given a memory block find the corresponding bit in the bitmap, and - will reset it (ie. make it re-set (0)). And when the deallocate - function is called, it will again set that bit after locating it to - indicate that that particular block corresponding to this bit in the - bit-map is not being used by anyone, and may be used to satisfy - future requests. - ----------------------------------------------------------------------- - -(Tech-Stuff, Please stay out if you are not interested in the -selection of certain constants. This has nothing to do with the -algorithm per-se, only with some vales that must be chosen correctly -to ensure that the allocator performs well in a real word scenario, -and maintains a good balance between the memory consumption and the -allocation/deallocation speed). - -The formula for calculating the maximum wastage as a percentage: - -(32 X k + 1) / (2 X (32 X k + 1 + 32 X c)) X 100. - -Where, - k => The constant overhead per node. eg. for list, it is 8 - bytes, and for map it is 12 bytes. - c => The size of the base type on which the map/list is - instantiated. Thus, suppose the the type1 is int and type2 is - double, they are related by the relation sizeof(double) == - 2*sizeof(int). Thus, all types must have this double size - relation for this formula to work properly. - -Plugging-in: For List: k = 8 and c = 4 (int and double), we get: -33.376% - -For map/multimap: k = 12, and c = 4 (int and double), we get: -37.524% - -Thus, knowing these values, and based on the sizeof(value_type), we -may create a function that returns the Max_Wastage_Percentage for us -to use. - - diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index aefeda4ffb4..c1506b20c0f 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -35,7 +35,7 @@ #include <bits/os_defines.h> // The current version of the C++ library in compressed ISO date format. -#define __GLIBCXX__ 20040320 +#define __GLIBCXX__ 20040417 // Allow use of "export template." This is currently not a feature // that g++ supports. diff --git a/libstdc++-v3/include/c_std/std_cctype.h b/libstdc++-v3/include/c_std/std_cctype.h index 65a4214657c..b6151c308f4 100644 --- a/libstdc++-v3/include/c_std/std_cctype.h +++ b/libstdc++-v3/include/c_std/std_cctype.h @@ -63,6 +63,27 @@ #undef tolower #undef toupper +/* APPLE LOCAL begin supply missing ctype.h decls 2001-07-11 sts */ +/* These are supposed be in ctype.h like the standard says! We need + this until Darwin ctype.h gets fixed and/or GCC has a fixincludes + to supply these if they're missing. */ +#if defined(__APPLE__) && defined(__MACH__) +extern "C" { +extern int isalnum(int c); +extern int isalpha(int c); +extern int iscntrl(int c); +extern int isdigit(int c); +extern int isgraph(int c); +extern int islower(int c); +extern int isprint(int c); +extern int ispunct(int c); +extern int isspace(int c); +extern int isupper(int c); +extern int isxdigit(int c); +} +#endif +/* APPLE LOCAL end supply missing ctype.h decls 2001-07-11 sts */ + namespace std { using ::isalnum; diff --git a/libstdc++-v3/include/std/std_fstream.h b/libstdc++-v3/include/std/std_fstream.h index 040f5798b11..96231e28fcc 100644 --- a/libstdc++-v3/include/std/std_fstream.h +++ b/libstdc++-v3/include/std/std_fstream.h @@ -512,7 +512,8 @@ namespace std * @doctodo * @endif */ - __filebuf_type _M_filebuf; + /* APPLE LOCAL work with -malign-natural. */ + __filebuf_type _M_filebuf __attribute((aligned(8))); public: // Constructors/Destructors: @@ -634,7 +635,8 @@ namespace std * @doctodo * @endif */ - __filebuf_type _M_filebuf; + /* APPLE LOCAL work with -malign-natural. */ + __filebuf_type _M_filebuf __attribute__((aligned(8))); public: // Constructors: diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index f4ba9701d2c..ba6719aac33 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -64,6 +64,14 @@ using namespace __cxxabiv1; # define EMERGENCY_OBJ_COUNT 4 #endif +/* APPLE LOCAL begin reduce emergency buffer size */ +/* 256 bytes is more than large enough for an std::bad_alloc object */ +#undef EMERGENCY_OBJ_SIZE +#undef EMERGENCY_OBJ_COUNT +#define EMERGENCY_OBJ_SIZE 256 +#define EMERGENCY_OBJ_COUNT 2 +/* APPLE LOCAL end reduce emergency buffer size */ + #if INT_MAX == 32767 || EMERGENCY_OBJ_COUNT <= 32 typedef unsigned int bitmask_type; #else diff --git a/libstdc++-v3/libsupc++/eh_terminate.cc b/libstdc++-v3/libsupc++/eh_terminate.cc index bf9d74db116..e8c30c470e4 100644 --- a/libstdc++-v3/libsupc++/eh_terminate.cc +++ b/libstdc++-v3/libsupc++/eh_terminate.cc @@ -34,6 +34,12 @@ #include "unwind-cxx.h" #include "exception_defines.h" +/* APPLE LOCAL begin keymgr */ +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) +#include "bits/os_defines.h" +#endif +/* APPLE LOCAL end keymgr */ + using namespace __cxxabiv1; void @@ -50,7 +56,19 @@ __cxxabiv1::__terminate (std::terminate_handler handler) void std::terminate () { + /* APPLE LOCAL begin keymgr */ +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) + /* + * If the Key Manager has a terminate function assigned to this thread, invoke that fn. + * If not (KeyMgr has 0), use whatever is initialized into my local static pointer (above). + */ + std::terminate_handler __keymgr_terminate_func = (std::terminate_handler) + _keymgr_get_per_thread_data (KEYMGR_TERMINATE_HANDLER_KEY); + if (__keymgr_terminate_func) + __terminate_handler = __keymgr_terminate_func; +#endif /* APPLE_KEYMGR */ __terminate (__terminate_handler); + /* APPLE LOCAL end keymgr */ } void @@ -63,13 +81,32 @@ __cxxabiv1::__unexpected (std::unexpected_handler handler) void std::unexpected () { + /* APPLE LOCAL begin keymgr */ +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) + /* Similar to terminate case above. */ + std::unexpected_handler __keymgr_unexpected_func = (std::unexpected_handler) + _keymgr_get_per_thread_data (KEYMGR_UNEXPECTED_HANDLER_KEY); + if (__keymgr_unexpected_func) + __unexpected_handler = __keymgr_unexpected_func; +#endif /* APPLE_KEYMGR */ + /* APPLE LOCAL end keymgr */ __unexpected (__unexpected_handler); } std::terminate_handler std::set_terminate (std::terminate_handler func) throw() { + /* APPLE LOCAL begin keymgr */ +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) + std::terminate_handler old = + (std::terminate_handler) _keymgr_get_per_thread_data (KEYMGR_TERMINATE_HANDLER_KEY); + _keymgr_set_per_thread_data (KEYMGR_TERMINATE_HANDLER_KEY, (void *) func) ; + if ( ! old) + old = __terminate_handler; +#else std::terminate_handler old = __terminate_handler; +#endif /* APPLE_KEYMGR */ + /* APPLE LOCAL end keymgr */ __terminate_handler = func; return old; } @@ -77,7 +114,17 @@ std::set_terminate (std::terminate_handler func) throw() std::unexpected_handler std::set_unexpected (std::unexpected_handler func) throw() { + /* APPLE LOCAL begin keymgr */ +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) + std::unexpected_handler old = + (std::unexpected_handler) _keymgr_get_per_thread_data (KEYMGR_UNEXPECTED_HANDLER_KEY); + _keymgr_set_per_thread_data (KEYMGR_UNEXPECTED_HANDLER_KEY, (void *) func); + if ( ! old) + old = __unexpected_handler; +#else std::unexpected_handler old = __unexpected_handler; +#endif /* APPLE_KEYMGR */ + /* APPLE LOCAL end keymgr */ __unexpected_handler = func; return old; } diff --git a/libstdc++-v3/libsupc++/new_handler.cc b/libstdc++-v3/libsupc++/new_handler.cc index 2f9f6bd3579..bffb3d80a63 100644 --- a/libstdc++-v3/libsupc++/new_handler.cc +++ b/libstdc++-v3/libsupc++/new_handler.cc @@ -31,6 +31,12 @@ #include "new" +/* APPLE LOCAL begin keymgr */ +#if defined APPLE_KEYMGR && ! defined(LIBCC_KEXT) && ! defined(APPLE_KERNEL_EXTENSION) +#include "bits/os_defines.h" +#endif +/* APPLE LOCAL end keymgr */ + const std::nothrow_t std::nothrow = { }; using std::new_handler; @@ -39,9 +45,19 @@ new_handler __new_handler; new_handler std::set_new_handler (new_handler handler) throw() { +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) + new_handler prev_handler = + (new_handler) _keymgr_get_per_thread_data (KEYMGR_NEW_HANLDER_KEY); + if ( ! prev_handler) + prev_handler = __new_handler; + _keymgr_set_per_thread_data (KEYMGR_NEW_HANLDER_KEY, (void *) handler); +#else /* ! APPLE_KEYMGR */ new_handler prev_handler = __new_handler; +#endif /* APPLE_KEYMGR */ __new_handler = handler; return prev_handler; } +#if !defined(LIBCC_KEXT) std::bad_alloc::~bad_alloc() throw() { } +#endif diff --git a/libstdc++-v3/libsupc++/new_op.cc b/libstdc++-v3/libsupc++/new_op.cc index 29eac93ecf0..10f65c10adc 100644 --- a/libstdc++-v3/libsupc++/new_op.cc +++ b/libstdc++-v3/libsupc++/new_op.cc @@ -28,12 +28,27 @@ // the GNU General Public License. #include "new" +/* APPLE LOCAL begin libcc_kext */ +#ifdef LIBCC_KEXT +extern "C" { +extern void *malloc (size_t); +extern int panic (); +} +#define ABORT() panic () +#else #include <cstdlib> +#define ABORT() std::abort () +#endif +/* APPLE LOCAL end libcc_kext */ #include <exception_defines.h> using std::new_handler; using std::bad_alloc; +/* APPLE LOCAL libcc_kext */ +#ifndef LIBCC_KEXT using std::malloc; +/* APPLE LOCAL libcc_kext */ +#endif extern new_handler __new_handler; @@ -48,12 +63,21 @@ operator new (std::size_t sz) throw (std::bad_alloc) p = (void *) malloc (sz); while (p == 0) { + /* APPLE LOCAL begin keymgr */ +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) + /* Ask Key Manager for new_handler; if provided (!=0), use it, else use local version. */ + new_handler handler = + (new_handler) _keymgr_get_per_thread_data (KEYMGR_NEW_HANLDER_KEY); +#else /* ! APPLE_KEYMGR */ new_handler handler = __new_handler; +#endif /* APPLE_KEYMGR */ + /* APPLE LOCAL end keymgr */ if (! handler) #ifdef __EXCEPTIONS throw bad_alloc(); #else - std::abort(); + /* APPLE LOCAL libcc_kext */ + ABORT(); #endif handler (); p = (void *) malloc (sz); diff --git a/libstdc++-v3/libsupc++/new_opnt.cc b/libstdc++-v3/libsupc++/new_opnt.cc index 4d7a5087c14..6406a50086c 100644 --- a/libstdc++-v3/libsupc++/new_opnt.cc +++ b/libstdc++-v3/libsupc++/new_opnt.cc @@ -30,6 +30,12 @@ #include "new" #include <exception_defines.h> +/* APPLE LOCAL begin keymgr */ +#if defined APPLE_KEYMGR && ! defined(LIBCC_KEXT) && ! defined(APPLE_KERNEL_EXTENSION) +#include "bits/os_defines.h" +#endif /* APPLE_KEYMGR */ +/* APPLE LOCAL end keymgr */ + using std::new_handler; using std::bad_alloc; @@ -47,7 +53,14 @@ operator new (std::size_t sz, const std::nothrow_t&) throw() p = (void *) malloc (sz); while (p == 0) { + /* APPLE LOCAL begin keymgr */ +#if defined(APPLE_KEYMGR) && ! defined(APPLE_KERNEL_EXTENSION) && ! defined(LIBCC_KEXT) + new_handler handler = + (new_handler) _keymgr_get_per_thread_data (KEYMGR_NEW_HANLDER_KEY); +#else /* ! APPLE_KEYMGR */ new_handler handler = __new_handler; +#endif /* APPLE_KEYMGR */ + /* APPLE LOCAL end keymgr */ if (! handler) return 0; try diff --git a/libstdc++-v3/libsupc++/pure.cc b/libstdc++-v3/libsupc++/pure.cc index 66ccb7d12dd..fb31d54c2ca 100644 --- a/libstdc++-v3/libsupc++/pure.cc +++ b/libstdc++-v3/libsupc++/pure.cc @@ -27,8 +27,12 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. +/* APPLE LOCAL begin libcc_kext */ +#ifndef LIBCC_KEXT /* Kludge: easier than identifying correct -Ipath, and unnecessary for kext */ #include <bits/c++config.h> #include "unwind-cxx.h" +#endif +/* APPLE LOCAL end libcc_kext */ #ifdef _GLIBCXX_HAVE_UNISTD_H # include <unistd.h> @@ -46,6 +50,14 @@ extern "C" void __cxa_pure_virtual (void) { + +/* APPLE LOCAL begin libcc_kext */ +#ifndef LIBCC_KEXT writestr ("pure virtual method called\n"); std::terminate (); +#else + extern void panic (void); + panic (); +#endif +/* APPLE LOCAL end libcc_kext */ } diff --git a/libstdc++-v3/src/functexcept.cc b/libstdc++-v3/src/functexcept.cc index fb158a61242..fb041effbce 100644 --- a/libstdc++-v3/src/functexcept.cc +++ b/libstdc++-v3/src/functexcept.cc @@ -94,9 +94,15 @@ namespace std __throw_underflow_error(const char* __s) { throw underflow_error(_(__s)); } + /* APPLE LOCAL begin make libstdc++ more fine-grained */ + /* This function now lives in ios.cc, so that we can avoid dragging in all + of IOS when some other function in this file is called. */ +#ifndef APPLE_KEYMGR void __throw_ios_failure(const char* __s) { throw ios_base::failure(_(__s)); } +#endif /* APPLE_KEYMGR */ + /* APPLE LOCAL end make libstdc++ more fine-grained */ #else void __throw_bad_exception(void) diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc index 0dfa482d9bb..0aeb4d2ef61 100644 --- a/libstdc++-v3/src/ios.cc +++ b/libstdc++-v3/src/ios.cc @@ -222,4 +222,15 @@ namespace std } _M_callbacks = 0; } + + /* APPLE LOCAL begin make libstdc++ more fine-grained */ +#ifdef APPLE_KEYMGR + /* This function used to live in functexcept.cc, but now lives here to + avoid dragging in all of IOS when some other function in functexcept.cc + is called. */ + void + __throw_ios_failure(const char* __s) + { throw ios_base::failure(__s); } +#endif /* APPLE_KEYMGR */ + /* APPLE LOCAL end make libstdc++ more fine-grained */ } // namespace std diff --git a/libstdc++-v3/testsuite/20_util/allocator/14176.cc b/libstdc++-v3/testsuite/20_util/allocator/14176.cc deleted file mode 100644 index cb8a2f5c4bf..00000000000 --- a/libstdc++-v3/testsuite/20_util/allocator/14176.cc +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - -// 20.4.1.1 allocator members - -#include <memory> -#include <testsuite_hooks.h> - -// libstdc++/14176 -void test02() -{ - unsigned int len = 0; - std::allocator<int> a; - int* p = a.allocate(len); - a.deallocate(p, len); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -// Explicitly instantiate for systems with no COMDAT or weak support. -template class __gnu_cxx::__mt_alloc<int>; -#endif - -int main() -{ - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc deleted file mode 100644 index 3a89d371f62..00000000000 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread.cc +++ /dev/null @@ -1,67 +0,0 @@ -// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } } -// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* } } -// { dg-options "-pthreads" { target *-*-solaris* } } - -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 22.1.1.2 locale constructors and destructors [lib.locale.cons] - -#include <locale> -#include <pthread.h> - -const int max_thread_count = 20; -//const int max_loop_count = 1000000; // orig value -const int max_loop_count = 100000; -const int max_locales = 10; - -void* thread_main(void*) -{ - try - { - std::locale loc_c = std::locale::classic(); - std::locale loc[max_locales]; - for (int j = 0; j < max_locales; ++j) - loc[j] = std::locale(j % 2 ? "en_US" : "fr_FR"); - - for (int i = 0; i < max_loop_count; ++i) - { - int k = i % max_locales; - loc[k] = std::locale::global(loc[k]); - - if (i % 37 == 0) - loc[k] = loc[k].combine<std::ctype<char> >(loc_c); - } - } - catch (...) { } - return 0; -} - -int -main() -{ - pthread_t tid[max_thread_count]; - - for (int i = 0; i < max_thread_count; i++) - pthread_create (&tid[i], NULL, thread_main, 0); - - for (int i = 0; i < max_thread_count; i++) - pthread_join (tid[i], NULL); - - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc deleted file mode 100644 index 5216b414aae..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/17.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2004-03-08 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// 22.2.6.3, p2: "The value _space_ indicates that at least one space -// is required at that position." -void test01() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de = __gnu_test::try_named_locale("de_DE@euro"); - VERIFY( loc_c != loc_de ); - - iterator_type end, end02; - istringstream iss; - iss.imbue(loc_de); - // cache the money_get facet - const money_get<char>& mon_get = - use_facet<money_get<char> >(iss.getloc()); - - iss.str("7.200.000.000,00"); - iterator_type is_it01(iss); - string result1; - ios_base::iostate err01 = ios_base::goodbit; - mon_get.get(is_it01, end, true, iss, err01, result1); - VERIFY( err01 == (ios_base::failbit | ios_base::eofbit) ); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str("7.200.000.000,00EUR "); - iterator_type is_it02(iss); - string result2; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result2); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == 'E' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc deleted file mode 100644 index 3da65de43d1..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/18.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// If (str.flags() & str.showbase) is false, the currency symbol is optional, -// but, if found, must be consumed entirely. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk = __gnu_test::try_named_locale("en_HK"); - VERIFY( loc_c != loc_hk ); - - iterator_type end, end01, end02; - istringstream iss; - iss.imbue(loc_hk); - // cache the money_get facet - const money_get<char>& mon_get = - use_facet<money_get<char> >(iss.getloc()); - - iss.str("HK7,200,000,000.00"); - iterator_type is_it01(iss); - string result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get.get(is_it01, end, false, iss, err01, result01); - VERIFY( err01 == ios_base::failbit ); - VERIFY( *end01 == '7' ); - - iss.str("(HK100,000,000,000.00)"); - iterator_type is_it02(iss); - string result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result02); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == '1' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc deleted file mode 100644 index 5d9dea2be1e..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/19.cc +++ /dev/null @@ -1,125 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io_01 : public std::moneypunct<char, false> -{ - std::string do_curr_symbol() const { return "$"; } - std::string do_positive_sign() const { return ""; } - std::string do_negative_sign() const { return ""; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, none, sign } }; - return pat; - } -}; - -struct My_money_io_02 : public std::moneypunct<char, false> -{ - std::string do_curr_symbol() const { return "%"; } - std::string do_positive_sign() const { return ""; } - std::string do_negative_sign() const { return "-"; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, sign, none } }; - return pat; - } -}; - -struct My_money_io_03 : public std::moneypunct<char, false> -{ - std::string do_curr_symbol() const { return "&"; } - std::string do_positive_sign() const { return ""; } - std::string do_negative_sign() const { return ""; } - - pattern do_neg_format() const - { - pattern pat = { { value, space, symbol, sign } }; - return pat; - } -}; - -// When both do_positive_sign and do_negative_sign return an empty -// string, patterns of the forms { value, symbol, none, sign }, -// { value, symbol, sign, none } and { X, Y, symbol, sign } imply -// that the symbol is not consumed since no other characters are -// needed to complete the format. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<char> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_01(locale::classic(), new My_money_io_01); - locale loc_02(locale::classic(), new My_money_io_02); - locale loc_03(locale::classic(), new My_money_io_03); - - iterator_type end, end01, end02, end03; - istringstream iss_01, iss_02, iss_03; - iss_01.imbue(loc_01); - iss_02.imbue(loc_02); - iss_03.imbue(loc_03); - // cache the money_get facet - const money_get<char>& mon_get_01 = - use_facet<money_get<char> >(iss_01.getloc()); - const money_get<char>& mon_get_02 = - use_facet<money_get<char> >(iss_02.getloc()); - const money_get<char>& mon_get_03 = - use_facet<money_get<char> >(iss_03.getloc()); - - iss_01.str("10$"); - iterator_type is_it01(iss_01); - string result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get_01.get(is_it01, end, false, iss_01, err01, result01); - VERIFY( err01 == ios_base::goodbit ); - VERIFY( *end01 == '$' ); - - iss_02.str("50%"); - iterator_type is_it02(iss_02); - string result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get_02.get(is_it02, end, false, iss_02, err02, result02); - VERIFY( err02 == ios_base::goodbit ); - VERIFY( *end02 == '%' ); - - iss_03.str("7 &"); - iterator_type is_it03(iss_03); - string result03; - ios_base::iostate err03 = ios_base::goodbit; - end03 = mon_get_03.get(is_it03, end, false, iss_03, err03, result03); - VERIFY( err03 == ios_base::goodbit ); - VERIFY( *end03 == '&' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc deleted file mode 100644 index e8affd81bb8..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/17.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 2004-03-08 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// 22.2.6.3, p2: "The value _space_ indicates that at least one space -// is required at that position." -void test01() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_de = __gnu_test::try_named_locale("de_DE@euro"); - VERIFY( loc_c != loc_de ); - - iterator_type end, end02; - wistringstream iss; - iss.imbue(loc_de); - // cache the money_get facet - const money_get<wchar_t>& mon_get = - use_facet<money_get<wchar_t> >(iss.getloc()); - - iss.str(L"7.200.000.000,00"); - iterator_type is_it01(iss); - wstring result1; - ios_base::iostate err01 = ios_base::goodbit; - mon_get.get(is_it01, end, true, iss, err01, result1); - VERIFY( err01 == (ios_base::failbit | ios_base::eofbit) ); - - // now try with showbase, to get currency symbol in format - iss.setf(ios_base::showbase); - - iss.str(L"7.200.000.000,00EUR "); - iterator_type is_it02(iss); - wstring result2; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result2); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == L'E' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc deleted file mode 100644 index 285de236276..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/18.cc +++ /dev/null @@ -1,69 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -// If (str.flags() & str.showbase) is false, the currency symbol is optional, -// but, if found, must be consumed entirely. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_c = locale::classic(); - locale loc_hk = __gnu_test::try_named_locale("en_HK"); - VERIFY( loc_c != loc_hk ); - - iterator_type end, end01, end02; - wistringstream iss; - iss.imbue(loc_hk); - // cache the money_get facet - const money_get<wchar_t>& mon_get = - use_facet<money_get<wchar_t> >(iss.getloc()); - - iss.str(L"HK7,200,000,000.00"); - iterator_type is_it01(iss); - wstring result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get.get(is_it01, end, false, iss, err01, result01); - VERIFY( err01 == ios_base::failbit ); - VERIFY( *end01 == L'7' ); - - iss.str(L"(HK100,000,000,000.00)"); - iterator_type is_it02(iss); - wstring result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get.get(is_it02, end, true, iss, err02, result02); - VERIFY( err02 == ios_base::failbit ); - VERIFY( *end02 == L'1' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc deleted file mode 100644 index 93c63e6ea29..00000000000 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/19.cc +++ /dev/null @@ -1,125 +0,0 @@ -// 2004-03-15 Paolo Carlini <pcarlini@suse.de> - -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 22.2.6.1.1 money_get members - -#include <locale> -#include <sstream> -#include <testsuite_hooks.h> - -struct My_money_io_01 : public std::moneypunct<wchar_t, false> -{ - std::wstring do_curr_symbol() const { return L"$"; } - std::wstring do_positive_sign() const { return L""; } - std::wstring do_negative_sign() const { return L""; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, none, sign } }; - return pat; - } -}; - -struct My_money_io_02 : public std::moneypunct<wchar_t, false> -{ - std::wstring do_curr_symbol() const { return L"%"; } - std::wstring do_positive_sign() const { return L""; } - std::wstring do_negative_sign() const { return L"-"; } - - pattern do_neg_format() const - { - pattern pat = { { value, symbol, sign, none } }; - return pat; - } -}; - -struct My_money_io_03 : public std::moneypunct<wchar_t, false> -{ - std::wstring do_curr_symbol() const { return L"&"; } - std::wstring do_positive_sign() const { return L""; } - std::wstring do_negative_sign() const { return L""; } - - pattern do_neg_format() const - { - pattern pat = { { value, space, symbol, sign } }; - return pat; - } -}; - -// When both do_positive_sign and do_negative_sign return an empty -// string, patterns of the forms { value, symbol, none, sign }, -// { value, symbol, sign, none } and { X, Y, symbol, sign } imply -// that the symbol is not consumed since no other characters are -// needed to complete the format. -void test01() -{ - using namespace std; - typedef istreambuf_iterator<wchar_t> iterator_type; - - bool test __attribute__((unused)) = true; - - // basic construction - locale loc_01(locale::classic(), new My_money_io_01); - locale loc_02(locale::classic(), new My_money_io_02); - locale loc_03(locale::classic(), new My_money_io_03); - - iterator_type end, end01, end02, end03; - wistringstream iss_01, iss_02, iss_03; - iss_01.imbue(loc_01); - iss_02.imbue(loc_02); - iss_03.imbue(loc_03); - // cache the money_get facet - const money_get<wchar_t>& mon_get_01 = - use_facet<money_get<wchar_t> >(iss_01.getloc()); - const money_get<wchar_t>& mon_get_02 = - use_facet<money_get<wchar_t> >(iss_02.getloc()); - const money_get<wchar_t>& mon_get_03 = - use_facet<money_get<wchar_t> >(iss_03.getloc()); - - iss_01.str(L"10$"); - iterator_type is_it01(iss_01); - wstring result01; - ios_base::iostate err01 = ios_base::goodbit; - end01 = mon_get_01.get(is_it01, end, false, iss_01, err01, result01); - VERIFY( err01 == ios_base::goodbit ); - VERIFY( *end01 == L'$' ); - - iss_02.str(L"50%"); - iterator_type is_it02(iss_02); - wstring result02; - ios_base::iostate err02 = ios_base::goodbit; - end02 = mon_get_02.get(is_it02, end, false, iss_02, err02, result02); - VERIFY( err02 == ios_base::goodbit ); - VERIFY( *end02 == L'%' ); - - iss_03.str(L"7 &"); - iterator_type is_it03(iss_03); - wstring result03; - ios_base::iostate err03 = ios_base::goodbit; - end03 = mon_get_03.get(is_it03, end, false, iss_03, err03, result03); - VERIFY( err03 == ios_base::goodbit ); - VERIFY( *end03 == L'&' ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc deleted file mode 100644 index 43dc6867d3d..00000000000 --- a/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -#include <deque> -#include <testsuite_hooks.h> - -struct T { int i; }; - -int swap_calls; - -namespace std -{ - template<> - void - deque<T, allocator<T> >::swap(deque<T, allocator<T> >&) - { ++swap_calls; } -} - -// Should use deque specialization for swap. -void test01() -{ - bool test __attribute__((unused)) = true; - std::deque<T> A; - std::deque<T> B; - swap_calls = 0; - std::swap(A, B); - VERIFY(1 == swap_calls); -} - -// Should use deque specialization for swap. -void test02() -{ - bool test __attribute__((unused)) = true; - using namespace std; - deque<T> A; - deque<T> B; - swap_calls = 0; - swap(A, B); - VERIFY(1 == swap_calls); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -template class __gnu_cxx::__mt_alloc<T>; -template class __gnu_cxx::__mt_alloc<T*>; -#endif - -// See c++/13658 for background info. -int main() -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc deleted file mode 100644 index a51d1263fb4..00000000000 --- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -#include <list> -#include <testsuite_hooks.h> - -struct T { int i; }; - -int swap_calls; - -namespace std -{ - template<> - void - list<T, allocator<T> >::swap(list<T, allocator<T> >&) - { ++swap_calls; } -} - -// Should use list specialization for swap. -void test01() -{ - bool test __attribute__((unused)) = true; - std::list<T> A; - std::list<T> B; - swap_calls = 0; - std::swap(A, B); - VERIFY(1 == swap_calls); -} - -// Should use list specialization for swap. -void test02() -{ - bool test __attribute__((unused)) = true; - using namespace std; - list<T> A; - list<T> B; - swap_calls = 0; - swap(A, B); - VERIFY(1 == swap_calls); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -template class __gnu_cxx::__mt_alloc<std::_List_node<T> >; -#endif - -// See c++/13658 for background info. -int main() -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc deleted file mode 100644 index 1afde71dd8a..00000000000 --- a/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -#include <map> -#include <testsuite_hooks.h> - -struct T { int i; }; - -int swap_calls; - -namespace std -{ - template<> - void - map<T, int>::swap(map<T, int>&) - { ++swap_calls; } -} - -// Should use map specialization for swap. -void test01() -{ - bool test __attribute__((unused)) = true; - std::map<T, int> A; - std::map<T, int> B; - swap_calls = 0; - std::swap(A, B); - VERIFY(1 == swap_calls); -} - -// Should use map specialization for swap. -void test02() -{ - bool test __attribute__((unused)) = true; - using namespace std; - map<T, int> A; - map<T, int> B; - swap_calls = 0; - swap(A, B); - VERIFY(1 == swap_calls); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<T const, int> > >; -#endif - -// See c++/13658 for background info. -int main() -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc deleted file mode 100644 index 2e87dff1632..00000000000 --- a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -#include <map> -#include <testsuite_hooks.h> - -struct T { int i; }; - -int swap_calls; - -namespace std -{ - template<> - void - multimap<T, int>::swap(multimap<T, int>&) - { ++swap_calls; } -} - -// Should use multimap specialization for swap. -void test01() -{ - bool test __attribute__((unused)) = true; - std::multimap<T, int> A; - std::multimap<T, int> B; - swap_calls = 0; - std::swap(A, B); - VERIFY(1 == swap_calls); -} - -// Should use multimap specialization for swap. -void test02() -{ - bool test __attribute__((unused)) = true; - using namespace std; - multimap<T, int> A; - multimap<T, int> B; - swap_calls = 0; - swap(A, B); - VERIFY(1 == swap_calls); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<T const, int> > >; -#endif - -// See c++/13658 for background info. -int main() -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc deleted file mode 100644 index b9632cb88ae..00000000000 --- a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -#include <set> -#include <testsuite_hooks.h> - -struct T { int i; }; - -int swap_calls; - -namespace std -{ - template<> - void - multiset<T>::swap(multiset<T>&) - { ++swap_calls; } -} - -// Should use multiset specialization for swap. -void test01() -{ - bool test __attribute__((unused)) = true; - std::multiset<T> A; - std::multiset<T> B; - swap_calls = 0; - std::swap(A, B); - VERIFY(1 == swap_calls); -} - -// Should use multiset specialization for swap. -void test02() -{ - bool test __attribute__((unused)) = true; - using namespace std; - multiset<T> A; - multiset<T> B; - swap_calls = 0; - swap(A, B); - VERIFY(1 == swap_calls); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<T> >; -#endif - -// See c++/13658 for background info. -int main() -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc deleted file mode 100644 index dcc69c99b3a..00000000000 --- a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -#include <set> -#include <testsuite_hooks.h> - -struct T { int i; }; - -int swap_calls; - -namespace std -{ - template<> - void - set<T>::swap(set<T>&) - { ++swap_calls; } -} - -// Should use set specialization for swap. -void test01() -{ - bool test __attribute__((unused)) = true; - std::set<T> A; - std::set<T> B; - swap_calls = 0; - std::swap(A, B); - VERIFY(1 == swap_calls); -} - -// Should use set specialization for swap. -void test02() -{ - bool test __attribute__((unused)) = true; - using namespace std; - set<T> A; - set<T> B; - swap_calls = 0; - swap(A, B); - VERIFY(1 == swap_calls); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -template class __gnu_cxx::__mt_alloc<std::_Rb_tree_node<T> >; -#endif - -// See c++/13658 for background info. -int main() -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc deleted file mode 100644 index 4e49635bc22..00000000000 --- a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -#include <vector> -#include <testsuite_hooks.h> - -struct T { int i; }; - -int swap_calls; - -namespace std -{ - template<> - void - vector<T, allocator<T> >::swap(vector<T, allocator<T> >&) - { ++swap_calls; } -} - -// Should use vector specialization for swap. -void test01() -{ - bool test __attribute__((unused)) = true; - std::vector<T> A; - std::vector<T> B; - swap_calls = 0; - std::swap(A, B); - VERIFY(1 == swap_calls); -} - -// Should use vector specialization for swap. -void test02() -{ - bool test __attribute__((unused)) = true; - using namespace std; - vector<T> A; - vector<T> B; - swap_calls = 0; - swap(A, B); - VERIFY(1 == swap_calls); -} - -#if !__GXX_WEAK__ && _MT_ALLOCATOR_H -template class __gnu_cxx::__mt_alloc<T>; -#endif - -// See c++/13658 for background info. -int main() -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/cmath/overloads.cc b/libstdc++-v3/testsuite/26_numerics/cmath/overloads.cc deleted file mode 100644 index 4d41a9640b4..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/cmath/overloads.cc +++ /dev/null @@ -1,27 +0,0 @@ -// PR 3181 -// Origin: pete@toyon.com - -#include <cmath> - -int main() -{ - int i = -1; - int j = 9; - double ans; - ans = std::acos(i); - ans = std::asin(i); - ans = std::atan(i); - ans = std::atan2(i, j); - ans = std::cos(i); - ans = std::cosh(i); - ans = std::exp(i); - ans = std::fabs(i); - ans = std::floor(i); - ans = std::log(i); - ans = std::log10(i); - ans = std::sqrt(i); - ans = std::sin(i); - ans = std::sinh(j); - ans = std::tan(i); - ans = std::tanh(i); -} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/13450.cc b/libstdc++-v3/testsuite/26_numerics/complex/13450.cc deleted file mode 100644 index 50f4bad3b93..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/complex/13450.cc +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2004 Free Software Foundation -// -// 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. - -// 26.2.8 complex transcendentals - -#include <complex> -#include <limits> -#include <testsuite_hooks.h> - -template<typename T> - void test01_do(T a, T b) - { - using namespace std; - bool test __attribute__((unused)) = true; - typedef complex<T> cplx; - - T eps = numeric_limits<T>::epsilon() * 100; - - cplx ref = pow(cplx(a, T()), cplx(b, T())); - cplx res1 = pow(a, cplx(b, T())); - cplx res2 = pow(cplx(a, T()), b); - - VERIFY( abs(ref - res1) < eps ); - VERIFY( abs(ref - res2) < eps ); - VERIFY( abs(res1 - res2) < eps ); - } - -// libstdc++/13450 -void test01() -{ - float f1 = -1.0f; - float f2 = 0.5f; - test01_do(f1, f2); - - f1 = -3.2f; - f2 = 1.4f; - test01_do(f1, f2); - - double d1 = -1.0; - double d2 = 0.5; - test01_do(d1, d2); - - d1 = -3.2; - d2 = 1.4; - test01_do(d1, d2); - - long double ld1 = -1.0l; - long double ld2 = 0.5l; - test01_do(ld1, ld2); - - ld1 = -3.2l; - ld2 = 1.4l; - test01_do(ld1, ld2); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/pow.cc b/libstdc++-v3/testsuite/26_numerics/complex/pow.cc deleted file mode 100644 index 58d0fc5909b..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/complex/pow.cc +++ /dev/null @@ -1,14 +0,0 @@ -// PR libbstdc++/10689 -// Origin: Daniel.Levine@jhuaph.edu - -#include <complex> -#include <testsuite_hooks.h> - -int main() -{ - std::complex<double> z; - - VERIFY( pow(z, 1.0/3.0) == 0.0 ); - - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray_subset_assignment.cc b/libstdc++-v3/testsuite/26_numerics/valarray_subset_assignment.cc deleted file mode 100644 index 9298bfb046f..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/valarray_subset_assignment.cc +++ /dev/null @@ -1,88 +0,0 @@ -// 2004-01-03 Jerry Quinn <jlquinn@optonline.net> - -// 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. - -// PR 3247 - -// This is DR-253. Test for accessible assignment-operators. -#include <valarray> -#include <testsuite_hooks.h> - -bool check_array(std::valarray<double>& a, double b[]) -{ - for (int i=0; i < a.size(); i++) - if (a[i] != b[i]) return false; - return true; -} - -int main() -{ - double dvar = 1.0; - std::valarray<double> val_d(10); // 0 1 2 3 4 5 6 7 8 9 - std::valarray<double> val_d1(10); // 10 9 8 7 6 5 4 3 2 1 - - for (int i=0; i< 10; i++) { val_d[i] = 10; val_d1[i] = i; } - std::valarray<double> val_c(val_d); - std::valarray<double> val_f(val_d); - std::valarray<double> val_g(val_d); - - std::slice slc(1, 3, 3); // 1 4 7 - val_d[slc] = val_d1[slc]; - - double ans1[10] = {10, 1, 10, 10, 4, 10, 10, 7, 10, 10}; - VERIFY(check_array(val_d, ans1)); - - std::valarray<std::size_t> val_size(2); - std::valarray<std::size_t> val_stride(2); - val_size[0] = 2; val_size[1] = 3; - val_stride[0] = 4; val_stride[1] = 1; - - std::gslice gslc(1, val_size, val_stride); - val_c[gslc] = val_d1[gslc]; - - double ans2[10] = {10, 1, 2, 3, 10, 5, 6, 7, 10, 10}; - VERIFY(check_array(val_c, ans2)); - - std::valarray<bool> val_b(false, 10); - val_b[2] = val_b[6] = val_b[9] = true; - val_f[val_b] = val_d1[val_b]; - - double ans3[10] = {10, 10, 2, 10, 10, 10, 6, 10, 10, 9}; - VERIFY(check_array(val_f, ans3)); - - size_t addr[] = {1, 2, 3, 4, 5}; - size_t addr1[] = {2, 7, 1, 9, 4}; - std::valarray<std::size_t> val_indirect(addr, 5); - std::valarray<std::size_t> val_indirect1(addr1, 5); - val_g[val_indirect] = val_d1[val_indirect1]; - - double ans4[10] = {10, 2, 7, 1, 9, 4, 10, 10, 10, 10}; - VERIFY(check_array(val_g, ans4)); - - return 0; -}; |