From: Benjamin Kosnik Date: Mon, 29 Oct 2007 21:13:23 +0000 (+0000) Subject: c++config (_GLIBCXX_DEPRECATED, [...]): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=40abbf1f1737b16b1ae6a8d8094e825f6a3b41f2;p=gcc.git c++config (_GLIBCXX_DEPRECATED, [...]): New. 2007-10-29 Benjamin Kosnik * include/bits/c++config (_GLIBCXX_DEPRECATED, _GLIBCXX_USE_DEPRECATED): New. Adjust comments. * include/bits/stl_auto_ptr.h: Move... * includse/backward/auto_ptr.h: ...here. * include/bits/stl_function.h (binder1st, binder2nd, bind1st, bind2nd): Move... * include/backward/binders.h: ...here. Deprecate in C++0x. * include/tr1_impl/boost_shared_ptr.h: Guard auto_ptr usage. * include/std/memory: Same. * include/std/streambuf: Consistent use of _GLIBCXX_USE_DEPRECATED. * include/backward/strstream: Fix guard macros. * include/backward/backward_warning.h: Adjust for all new items. * config/abi/pre/gnu.ver: Export basic_streambuf::stossc. * include/Makefile.am (backward_headers): Adjust. * include/Makefile.in: Regenerate. * configure: Regenerate. From-SVN: r129733 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 904c253a6a8..cbaf73ddcd8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,26 @@ +2007-10-29 Benjamin Kosnik + + * include/bits/c++config (_GLIBCXX_DEPRECATED, + _GLIBCXX_USE_DEPRECATED): New. Adjust comments. + * include/bits/stl_auto_ptr.h: Move... + * includse/backward/auto_ptr.h: ...here. + * include/bits/stl_function.h (binder1st, binder2nd, bind1st, + bind2nd): Move... + * include/backward/binders.h: ...here. Deprecate in C++0x. + + * include/tr1_impl/boost_shared_ptr.h: Guard auto_ptr usage. + * include/std/memory: Same. + * include/std/streambuf: Consistent use of _GLIBCXX_USE_DEPRECATED. + + * include/backward/strstream: Fix guard macros. + * include/backward/backward_warning.h: Adjust for all new items. + + * config/abi/pre/gnu.ver: Export basic_streambuf::stossc. + + * include/Makefile.am (backward_headers): Adjust. + * include/Makefile.in: Regenerate. + * configure: Regenerate. + 2007-10-29 Benjamin Kosnik * include/Makefile.am (ext_compat_headers): New. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index cc6252e91c7..87cc92ec5ad 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -48,7 +48,7 @@ GLIBCXX_3.4 { std::basic_ostr[a-d]*; std::basic_ostr[f-z]*; std::basic_[p-r]*; - std::basic_streambuf*; +# std::basic_streambuf # std::basic_string # std::basic_stringbuf std::basic_stringstream*; @@ -233,6 +233,13 @@ GLIBCXX_3.4 { _ZNKSbIwSt11char_traitsIwESaIwEE9_M_ibeginEv; _ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_E*; + # std::basic_streambuf + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[CD]*; + _ZNKSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9]*; + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9][a-z][^t]*; + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9][0-9][a-z][^t]*; + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EEaSERKS2_; + # std::basic_stringbuf _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[CD]*; _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][a-r]*; @@ -777,6 +784,8 @@ GLIBCXX_3.4.10 { _ZNSt9__cxx199815_List_node_base7reverseEv; _ZNSt9__cxx199815_List_node_base8transfer*; + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE6stosscEv; + } GLIBCXX_3.4.9; # Symbols in the support library (libsupc++) have their own tag. diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index c1b549badd4..b3d12571097 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -119,7 +119,6 @@ bits_headers = \ ${bits_srcdir}/stl_iterator_base_types.h \ ${bits_srcdir}/stl_list.h \ ${bits_srcdir}/stl_map.h \ - ${bits_srcdir}/stl_auto_ptr.h \ ${bits_srcdir}/stl_move.h \ ${bits_srcdir}/stl_multimap.h \ ${bits_srcdir}/stl_multiset.h \ @@ -145,12 +144,14 @@ bits_headers = \ backward_srcdir = ${glibcxx_srcdir}/include/backward backward_builddir = ./backward backward_headers = \ - ${backward_srcdir}/strstream \ + ${backward_srcdir}/auto_ptr.h \ + ${backward_srcdir}/backward_warning.h \ + ${backward_srcdir}/binders.h \ ${backward_srcdir}/hash_map \ ${backward_srcdir}/hash_set \ ${backward_srcdir}/hash_fun.h \ ${backward_srcdir}/hashtable.h \ - ${backward_srcdir}/backward_warning.h + ${backward_srcdir}/strstream pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds pb_builddir = ./ext/pb_ds diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index b08e447017b..5a70ed136e8 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -368,7 +368,6 @@ bits_headers = \ ${bits_srcdir}/stl_iterator_base_types.h \ ${bits_srcdir}/stl_list.h \ ${bits_srcdir}/stl_map.h \ - ${bits_srcdir}/stl_auto_ptr.h \ ${bits_srcdir}/stl_move.h \ ${bits_srcdir}/stl_multimap.h \ ${bits_srcdir}/stl_multiset.h \ @@ -394,12 +393,14 @@ bits_headers = \ backward_srcdir = ${glibcxx_srcdir}/include/backward backward_builddir = ./backward backward_headers = \ - ${backward_srcdir}/strstream \ + ${backward_srcdir}/auto_ptr.h \ + ${backward_srcdir}/backward_warning.h \ + ${backward_srcdir}/binders.h \ ${backward_srcdir}/hash_map \ ${backward_srcdir}/hash_set \ ${backward_srcdir}/hash_fun.h \ ${backward_srcdir}/hashtable.h \ - ${backward_srcdir}/backward_warning.h + ${backward_srcdir}/strstream pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds pb_builddir = ./ext/pb_ds diff --git a/libstdc++-v3/include/backward/auto_ptr.h b/libstdc++-v3/include/backward/auto_ptr.h new file mode 100644 index 00000000000..3be41d10ab8 --- /dev/null +++ b/libstdc++-v3/include/backward/auto_ptr.h @@ -0,0 +1,301 @@ +// auto_ptr implementation -*- C++ -*- + +// Copyright (C) 2007 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, 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301, 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. + +/** @file backward/auto_ptr.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + +#ifndef _STL_AUTO_PTR_H +#define _STL_AUTO_PTR_H 1 + +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** + * A wrapper class to provide auto_ptr with reference semantics. + * For example, an auto_ptr can be assigned (or constructed from) + * the result of a function which returns an auto_ptr by value. + * + * All the auto_ptr_ref stuff should happen behind the scenes. + */ + template + struct auto_ptr_ref + { + _Tp1* _M_ptr; + + explicit + auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { } + } _GLIBCXX_DEPRECATED; + + + /** + * @brief A simple smart pointer providing strict ownership semantics. + * + * The Standard says: + *
+   *  An @c auto_ptr owns the object it holds a pointer to.  Copying
+   *  an @c auto_ptr copies the pointer and transfers ownership to the
+   *  destination.  If more than one @c auto_ptr owns the same object
+   *  at the same time the behavior of the program is undefined.
+   *
+   *  The uses of @c auto_ptr include providing temporary
+   *  exception-safety for dynamically allocated memory, passing
+   *  ownership of dynamically allocated memory to a function, and
+   *  returning dynamically allocated memory from a function.  @c
+   *  auto_ptr does not meet the CopyConstructible and Assignable
+   *  requirements for Standard Library container elements and thus
+   *  instantiating a Standard Library container with an @c auto_ptr
+   *  results in undefined behavior.
+   *  
+ * Quoted from [20.4.5]/3. + * + * Good examples of what can and cannot be done with auto_ptr can + * be found in the libstdc++ testsuite. + * + * @if maint + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * 127. auto_ptr<> conversion issues + * These resolutions have all been incorporated. + * @endif + */ + template + class auto_ptr + { + private: + _Tp* _M_ptr; + + public: + /// The pointed-to type. + typedef _Tp element_type; + + /** + * @brief An %auto_ptr is usually constructed from a raw pointer. + * @param p A pointer (defaults to NULL). + * + * This object now @e owns the object pointed to by @a p. + */ + explicit + auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } + + /** + * @brief An %auto_ptr can be constructed from another %auto_ptr. + * @param a Another %auto_ptr of the same type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. + */ + auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } + + /** + * @brief An %auto_ptr can be constructed from another %auto_ptr. + * @param a Another %auto_ptr of a different but related type. + * + * A pointer-to-Tp1 must be convertible to a + * pointer-to-Tp/element_type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. + */ + template + auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { } + + /** + * @brief %auto_ptr assignment operator. + * @param a Another %auto_ptr of the same type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. The object that this one @e + * used to own and track has been deleted. + */ + auto_ptr& + operator=(auto_ptr& __a) throw() + { + reset(__a.release()); + return *this; + } + + /** + * @brief %auto_ptr assignment operator. + * @param a Another %auto_ptr of a different but related type. + * + * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. The object that this one @e + * used to own and track has been deleted. + */ + template + auto_ptr& + operator=(auto_ptr<_Tp1>& __a) throw() + { + reset(__a.release()); + return *this; + } + + /** + * When the %auto_ptr goes out of scope, the object it owns is + * deleted. If it no longer owns anything (i.e., @c get() is + * @c NULL), then this has no effect. + * + * @if maint + * The C++ standard says there is supposed to be an empty throw + * specification here, but omitting it is standard conforming. Its + * presence can be detected only if _Tp::~_Tp() throws, but this is + * prohibited. [17.4.3.6]/2 + * @endif + */ + ~auto_ptr() { delete _M_ptr; } + + /** + * @brief Smart pointer dereferencing. + * + * If this %auto_ptr no longer owns anything, then this + * operation will crash. (For a smart pointer, "no longer owns + * anything" is the same as being a null pointer, and you know + * what happens when you dereference one of those...) + */ + element_type& + operator*() const throw() + { + _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + return *_M_ptr; + } + + /** + * @brief Smart pointer dereferencing. + * + * This returns the pointer itself, which the language then will + * automatically cause to be dereferenced. + */ + element_type* + operator->() const throw() + { + _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + return _M_ptr; + } + + /** + * @brief Bypassing the smart pointer. + * @return The raw pointer being managed. + * + * You can get a copy of the pointer that this object owns, for + * situations such as passing to a function which only accepts + * a raw pointer. + * + * @note This %auto_ptr still owns the memory. + */ + element_type* + get() const throw() { return _M_ptr; } + + /** + * @brief Bypassing the smart pointer. + * @return The raw pointer being managed. + * + * You can get a copy of the pointer that this object owns, for + * situations such as passing to a function which only accepts + * a raw pointer. + * + * @note This %auto_ptr no longer owns the memory. When this object + * goes out of scope, nothing will happen. + */ + element_type* + release() throw() + { + element_type* __tmp = _M_ptr; + _M_ptr = 0; + return __tmp; + } + + /** + * @brief Forcibly deletes the managed object. + * @param p A pointer (defaults to NULL). + * + * This object now @e owns the object pointed to by @a p. The + * previous object has been deleted. + */ + void + reset(element_type* __p = 0) throw() + { + if (__p != _M_ptr) + { + delete _M_ptr; + _M_ptr = __p; + } + } + + /** + * @brief Automatic conversions + * + * These operations convert an %auto_ptr into and from an auto_ptr_ref + * automatically as needed. This allows constructs such as + * @code + * auto_ptr func_returning_auto_ptr(.....); + * ... + * auto_ptr ptr = func_returning_auto_ptr(.....); + * @endcode + */ + auto_ptr(auto_ptr_ref __ref) throw() + : _M_ptr(__ref._M_ptr) { } + + auto_ptr& + operator=(auto_ptr_ref __ref) throw() + { + if (__ref._M_ptr != this->get()) + { + delete _M_ptr; + _M_ptr = __ref._M_ptr; + } + return *this; + } + + template + operator auto_ptr_ref<_Tp1>() throw() + { return auto_ptr_ref<_Tp1>(this->release()); } + + template + operator auto_ptr<_Tp1>() throw() + { return auto_ptr<_Tp1>(this->release()); } + } _GLIBCXX_DEPRECATED; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 541. shared_ptr template assignment and void + template<> + class auto_ptr + { + public: + typedef void element_type; + } _GLIBCXX_DEPRECATED; + +_GLIBCXX_END_NAMESPACE + +#endif /* _STL_AUTO_PTR_H */ diff --git a/libstdc++-v3/include/backward/backward_warning.h b/libstdc++-v3/include/backward/backward_warning.h index 5954bd02953..01371a7db0d 100644 --- a/libstdc++-v3/include/backward/backward_warning.h +++ b/libstdc++-v3/include/backward/backward_warning.h @@ -30,15 +30,24 @@ #ifdef __DEPRECATED #warning This file includes at least one deprecated or antiquated header. \ - Please consider the use of alternate interfaces as follows: \ - basic_stringbuf strstreambuf \ - basic_istringstream istrstream \ - basic_ostringstream ostrstream \ - basic_stringstream strstream \ - unordered_set hash_set \ - unordered_multiset hash_multiset \ - unordered_map hash_map \ - unordered_multimap hash_multimap \ + Please consider use of an equivalent, non-deprecated interface for the \ + requested functionality. A list of valid replacements is as follows: \ + \ + Use: Instead of: \ + , basic_stringbuf , strstreambuf \ + , basic_istringstream , istrstream \ + , basic_ostringstream , ostrstream \ + , basic_stringstream , strstream \ + , unordered_set , hash_set \ + , unordered_multiset , hash_multiset \ + , unordered_map , hash_map \ + , unordered_multimap , hash_multimap \ + , bind , binder1st \ + , bind , binder2nd \ + , bind , bind1st \ + , bind , bind2nd \ + , unique_ptr , auto_ptr \ + \ To disable this warning use -Wno-deprecated. #endif diff --git a/libstdc++-v3/include/backward/binders.h b/libstdc++-v3/include/backward/binders.h new file mode 100644 index 00000000000..313bffcd824 --- /dev/null +++ b/libstdc++-v3/include/backward/binders.h @@ -0,0 +1,171 @@ +// Functor implementations -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// 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. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file backward/binders.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + +#ifndef _GLIBCXX_BINDERS_H +#define _GLIBCXX_BINDERS_H 1 + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // 20.3.6 binders + /** @defgroup s20_3_6_binder Binder Classes + * Binders turn functions/functors with two arguments into functors with + * a single argument, storing an argument to be applied later. For + * example, a variable @c B of type @c binder1st is constructed from a + * functor @c f and an argument @c x. Later, B's @c operator() is called + * with a single argument @c y. The return value is the value of @c f(x,y). + * @c B can be "called" with various arguments (y1, y2, ...) and will in + * turn call @c f(x,y1), @c f(x,y2), ... + * + * The function @c bind1st is provided to save some typing. It takes the + * function and an argument as parameters, and returns an instance of + * @c binder1st. + * + * The type @c binder2nd and its creator function @c bind2nd do the same + * thing, but the stored argument is passed as the second parameter instead + * of the first, e.g., @c bind2nd(std::minus,1.3) will create a + * functor whose @c operator() accepts a floating-point number, subtracts + * 1.3 from it, and returns the result. (If @c bind1st had been used, + * the functor would perform "1.3 - x" instead. + * + * Creator-wrapper functions like @c bind1st are intended to be used in + * calling algorithms. Their return values will be temporary objects. + * (The goal is to not require you to type names like + * @c std::binder1st> for declaring a variable to hold the + * return value from @c bind1st(std::plus,5). + * + * These become more useful when combined with the composition functions. + * + * @{ + */ + /// One of the @link s20_3_6_binder binder functors@endlink. + template + class binder1st + : public unary_function + { + protected: + _Operation op; + typename _Operation::first_argument_type value; + + public: + binder1st(const _Operation& __x, + const typename _Operation::first_argument_type& __y) + : op(__x), value(__y) { } + + typename _Operation::result_type + operator()(const typename _Operation::second_argument_type& __x) const + { return op(value, __x); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + typename _Operation::result_type + operator()(typename _Operation::second_argument_type& __x) const + { return op(value, __x); } + } _GLIBCXX_DEPRECATED; + + /// One of the @link s20_3_6_binder binder functors@endlink. + template + inline binder1st<_Operation> + bind1st(const _Operation& __fn, const _Tp& __x) + { + typedef typename _Operation::first_argument_type _Arg1_type; + return binder1st<_Operation>(__fn, _Arg1_type(__x)); + } + + /// One of the @link s20_3_6_binder binder functors@endlink. + template + class binder2nd + : public unary_function + { + protected: + _Operation op; + typename _Operation::second_argument_type value; + + public: + binder2nd(const _Operation& __x, + const typename _Operation::second_argument_type& __y) + : op(__x), value(__y) { } + + typename _Operation::result_type + operator()(const typename _Operation::first_argument_type& __x) const + { return op(__x, value); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + typename _Operation::result_type + operator()(typename _Operation::first_argument_type& __x) const + { return op(__x, value); } + } _GLIBCXX_DEPRECATED; + + /// One of the @link s20_3_6_binder binder functors@endlink. + template + inline binder2nd<_Operation> + bind2nd(const _Operation& __fn, const _Tp& __x) + { + typedef typename _Operation::second_argument_type _Arg2_type; + return binder2nd<_Operation>(__fn, _Arg2_type(__x)); + } + /** @} */ + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_BINDERS_H */ diff --git a/libstdc++-v3/include/backward/strstream b/libstdc++-v3/include/backward/strstream index d0d5a13863f..18617419c35 100644 --- a/libstdc++-v3/include/backward/strstream +++ b/libstdc++-v3/include/backward/strstream @@ -42,11 +42,11 @@ // WARNING: The classes defined in this header are DEPRECATED. This // header is defined in section D.7.1 of the C++ standard, and it -// MAY BE REMOVED in a future standard revision. You should use the +// MAY BE REMOVED in a future standard revision. One should use the // header instead. -#ifndef __SGI_STL_STRSTREAM -#define __SGI_STL_STRSTREAM +#ifndef _GLIBCXX_STRSTREAM +#define _GLIBCXX_STRSTREAM #include "backward_warning.h" #include diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 51b8f2dde99..58c34733ec8 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -45,7 +45,9 @@ // The current version of the C++ library in compressed ISO date format. #define __GLIBCXX__ -// Macros for visibility support. +// Macros for visibility. +// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY +// _GLIBCXX_VISIBILITY #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY @@ -54,6 +56,24 @@ # define _GLIBCXX_VISIBILITY(V) #endif +// Macros for deprecated. +// _GLIBCXX_USE_DEPRECATED +// _GLIBCXX_DEPRECATED +#ifndef _GLIBCXX_USE_DEPRECATED +# define _GLIBCXX_USE_DEPRECATED 1 +#endif + +#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__) +# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) +#else +# define _GLIBCXX_DEPRECATED +#endif + +// Macros for activating various namespace association modes. +// _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG +// _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL +// _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION + // Guide to libstdc++ namespaces. /* namespace std @@ -67,11 +87,6 @@ } */ -// Macros for activating various namespace association modes. -// _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG -// _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL -// _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION - #ifdef _GLIBCXX_DEBUG # define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1 #endif @@ -89,8 +104,8 @@ # define _GLIBCXX_USE_NAMESPACE_ASSOCIATION 1 #endif -// Macros for namespace scope. Either namespace std:: or __gnu_cxx::, -// or the name of some nested namespace within it. +// Macros for namespace scope. Either namespace std:: or the name +// of some nested namespace within it. // _GLIBCXX_STD // _GLIBCXX_STD_D // _GLIBCXX_STD_P diff --git a/libstdc++-v3/include/bits/stl_auto_ptr.h b/libstdc++-v3/include/bits/stl_auto_ptr.h deleted file mode 100644 index 6e0f9c7e2ae..00000000000 --- a/libstdc++-v3/include/bits/stl_auto_ptr.h +++ /dev/null @@ -1,301 +0,0 @@ -// auto_ptr implementation -*- C++ -*- - -// Copyright (C) 2007 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, 51 Franklin Street, Fifth Floor, -// Boston, MA 02110-1301, 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. - -/** @file stl_auto_ptr.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - -#ifndef _STL_AUTO_PTR_H -#define _STL_AUTO_PTR_H 1 - -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - /** - * A wrapper class to provide auto_ptr with reference semantics. - * For example, an auto_ptr can be assigned (or constructed from) - * the result of a function which returns an auto_ptr by value. - * - * All the auto_ptr_ref stuff should happen behind the scenes. - */ - template - struct auto_ptr_ref - { - _Tp1* _M_ptr; - - explicit - auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { } - }; - - - /** - * @brief A simple smart pointer providing strict ownership semantics. - * - * The Standard says: - *
-   *  An @c auto_ptr owns the object it holds a pointer to.  Copying
-   *  an @c auto_ptr copies the pointer and transfers ownership to the
-   *  destination.  If more than one @c auto_ptr owns the same object
-   *  at the same time the behavior of the program is undefined.
-   *
-   *  The uses of @c auto_ptr include providing temporary
-   *  exception-safety for dynamically allocated memory, passing
-   *  ownership of dynamically allocated memory to a function, and
-   *  returning dynamically allocated memory from a function.  @c
-   *  auto_ptr does not meet the CopyConstructible and Assignable
-   *  requirements for Standard Library container elements and thus
-   *  instantiating a Standard Library container with an @c auto_ptr
-   *  results in undefined behavior.
-   *  
- * Quoted from [20.4.5]/3. - * - * Good examples of what can and cannot be done with auto_ptr can - * be found in the libstdc++ testsuite. - * - * @if maint - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * 127. auto_ptr<> conversion issues - * These resolutions have all been incorporated. - * @endif - */ - template - class auto_ptr - { - private: - _Tp* _M_ptr; - - public: - /// The pointed-to type. - typedef _Tp element_type; - - /** - * @brief An %auto_ptr is usually constructed from a raw pointer. - * @param p A pointer (defaults to NULL). - * - * This object now @e owns the object pointed to by @a p. - */ - explicit - auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } - - /** - * @brief An %auto_ptr can be constructed from another %auto_ptr. - * @param a Another %auto_ptr of the same type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. - */ - auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } - - /** - * @brief An %auto_ptr can be constructed from another %auto_ptr. - * @param a Another %auto_ptr of a different but related type. - * - * A pointer-to-Tp1 must be convertible to a - * pointer-to-Tp/element_type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. - */ - template - auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { } - - /** - * @brief %auto_ptr assignment operator. - * @param a Another %auto_ptr of the same type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. The object that this one @e - * used to own and track has been deleted. - */ - auto_ptr& - operator=(auto_ptr& __a) throw() - { - reset(__a.release()); - return *this; - } - - /** - * @brief %auto_ptr assignment operator. - * @param a Another %auto_ptr of a different but related type. - * - * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. The object that this one @e - * used to own and track has been deleted. - */ - template - auto_ptr& - operator=(auto_ptr<_Tp1>& __a) throw() - { - reset(__a.release()); - return *this; - } - - /** - * When the %auto_ptr goes out of scope, the object it owns is - * deleted. If it no longer owns anything (i.e., @c get() is - * @c NULL), then this has no effect. - * - * @if maint - * The C++ standard says there is supposed to be an empty throw - * specification here, but omitting it is standard conforming. Its - * presence can be detected only if _Tp::~_Tp() throws, but this is - * prohibited. [17.4.3.6]/2 - * @endif - */ - ~auto_ptr() { delete _M_ptr; } - - /** - * @brief Smart pointer dereferencing. - * - * If this %auto_ptr no longer owns anything, then this - * operation will crash. (For a smart pointer, "no longer owns - * anything" is the same as being a null pointer, and you know - * what happens when you dereference one of those...) - */ - element_type& - operator*() const throw() - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return *_M_ptr; - } - - /** - * @brief Smart pointer dereferencing. - * - * This returns the pointer itself, which the language then will - * automatically cause to be dereferenced. - */ - element_type* - operator->() const throw() - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return _M_ptr; - } - - /** - * @brief Bypassing the smart pointer. - * @return The raw pointer being managed. - * - * You can get a copy of the pointer that this object owns, for - * situations such as passing to a function which only accepts - * a raw pointer. - * - * @note This %auto_ptr still owns the memory. - */ - element_type* - get() const throw() { return _M_ptr; } - - /** - * @brief Bypassing the smart pointer. - * @return The raw pointer being managed. - * - * You can get a copy of the pointer that this object owns, for - * situations such as passing to a function which only accepts - * a raw pointer. - * - * @note This %auto_ptr no longer owns the memory. When this object - * goes out of scope, nothing will happen. - */ - element_type* - release() throw() - { - element_type* __tmp = _M_ptr; - _M_ptr = 0; - return __tmp; - } - - /** - * @brief Forcibly deletes the managed object. - * @param p A pointer (defaults to NULL). - * - * This object now @e owns the object pointed to by @a p. The - * previous object has been deleted. - */ - void - reset(element_type* __p = 0) throw() - { - if (__p != _M_ptr) - { - delete _M_ptr; - _M_ptr = __p; - } - } - - /** - * @brief Automatic conversions - * - * These operations convert an %auto_ptr into and from an auto_ptr_ref - * automatically as needed. This allows constructs such as - * @code - * auto_ptr func_returning_auto_ptr(.....); - * ... - * auto_ptr ptr = func_returning_auto_ptr(.....); - * @endcode - */ - auto_ptr(auto_ptr_ref __ref) throw() - : _M_ptr(__ref._M_ptr) { } - - auto_ptr& - operator=(auto_ptr_ref __ref) throw() - { - if (__ref._M_ptr != this->get()) - { - delete _M_ptr; - _M_ptr = __ref._M_ptr; - } - return *this; - } - - template - operator auto_ptr_ref<_Tp1>() throw() - { return auto_ptr_ref<_Tp1>(this->release()); } - - template - operator auto_ptr<_Tp1>() throw() - { return auto_ptr<_Tp1>(this->release()); } - }; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 541. shared_ptr template assignment and void - template<> - class auto_ptr - { - public: - typedef void element_type; - }; - -_GLIBCXX_END_NAMESPACE - -#endif /* _STL_AUTO_PTR_H */ diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h index ece42a3e2eb..7b392fc104d 100644 --- a/libstdc++-v3/include/bits/stl_function.h +++ b/libstdc++-v3/include/bits/stl_function.h @@ -386,108 +386,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return binary_negate<_Predicate>(__pred); } /** @} */ - // 20.3.6 binders - /** @defgroup s20_3_6_binder Binder Classes - * Binders turn functions/functors with two arguments into functors with - * a single argument, storing an argument to be applied later. For - * example, a variable @c B of type @c binder1st is constructed from a - * functor @c f and an argument @c x. Later, B's @c operator() is called - * with a single argument @c y. The return value is the value of @c f(x,y). - * @c B can be "called" with various arguments (y1, y2, ...) and will in - * turn call @c f(x,y1), @c f(x,y2), ... - * - * The function @c bind1st is provided to save some typing. It takes the - * function and an argument as parameters, and returns an instance of - * @c binder1st. - * - * The type @c binder2nd and its creator function @c bind2nd do the same - * thing, but the stored argument is passed as the second parameter instead - * of the first, e.g., @c bind2nd(std::minus,1.3) will create a - * functor whose @c operator() accepts a floating-point number, subtracts - * 1.3 from it, and returns the result. (If @c bind1st had been used, - * the functor would perform "1.3 - x" instead. - * - * Creator-wrapper functions like @c bind1st are intended to be used in - * calling algorithms. Their return values will be temporary objects. - * (The goal is to not require you to type names like - * @c std::binder1st> for declaring a variable to hold the - * return value from @c bind1st(std::plus,5). - * - * These become more useful when combined with the composition functions. - * - * @{ - */ - /// One of the @link s20_3_6_binder binder functors@endlink. - template - class binder1st - : public unary_function - { - protected: - _Operation op; - typename _Operation::first_argument_type value; - - public: - binder1st(const _Operation& __x, - const typename _Operation::first_argument_type& __y) - : op(__x), value(__y) { } - - typename _Operation::result_type - operator()(const typename _Operation::second_argument_type& __x) const - { return op(value, __x); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 109. Missing binders for non-const sequence elements - typename _Operation::result_type - operator()(typename _Operation::second_argument_type& __x) const - { return op(value, __x); } - }; - - /// One of the @link s20_3_6_binder binder functors@endlink. - template - inline binder1st<_Operation> - bind1st(const _Operation& __fn, const _Tp& __x) - { - typedef typename _Operation::first_argument_type _Arg1_type; - return binder1st<_Operation>(__fn, _Arg1_type(__x)); - } - - /// One of the @link s20_3_6_binder binder functors@endlink. - template - class binder2nd - : public unary_function - { - protected: - _Operation op; - typename _Operation::second_argument_type value; - - public: - binder2nd(const _Operation& __x, - const typename _Operation::second_argument_type& __y) - : op(__x), value(__y) { } - - typename _Operation::result_type - operator()(const typename _Operation::first_argument_type& __x) const - { return op(__x, value); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 109. Missing binders for non-const sequence elements - typename _Operation::result_type - operator()(typename _Operation::first_argument_type& __x) const - { return op(__x, value); } - }; - - /// One of the @link s20_3_6_binder binder functors@endlink. - template - inline binder2nd<_Operation> - bind2nd(const _Operation& __fn, const _Tp& __x) - { - typedef typename _Operation::second_argument_type _Arg2_type; - return binder2nd<_Operation>(__fn, _Arg2_type(__x)); - } - /** @} */ - // 20.3.7 adaptors pointers functions /** @defgroup s20_3_7_adaptors Adaptors for pointers to functions * The advantage of function objects over pointers to functions is that @@ -802,4 +700,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_END_NAMESPACE +#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED +# include +#endif + #endif /* _STL_FUNCTION_H */ diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory index a099b3ed177..39f72563d17 100644 --- a/libstdc++-v3/include/std/memory +++ b/libstdc++-v3/include/std/memory @@ -56,7 +56,6 @@ #include #include #include -#include #include #ifdef __GXX_EXPERIMENTAL_CXX0X__ @@ -73,6 +72,9 @@ # include // std::less # include # include +# if _GLIBCXX_USE_DEPRECATED +# include +# endif # if defined(_GLIBCXX_INCLUDE_AS_CXX0X) # include # else @@ -86,6 +88,8 @@ # undef _GLIBCXX_BEGIN_NAMESPACE_TR1 # undef _GLIBCXX_INCLUDE_AS_CXX0X # endif +#else +# include #endif #endif /* _GLIBCXX_MEMORY */ diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf index b6ec8255c63..d5842fa2bc1 100644 --- a/libstdc++-v3/include/std/streambuf +++ b/libstdc++-v3/include/std/streambuf @@ -1,7 +1,7 @@ // Stream buffer classes -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -// Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007 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 @@ -763,7 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) overflow(int_type /* __c */ = traits_type::eof()) { return traits_type::eof(); } -#ifdef _GLIBCXX_DEPRECATED +#if _GLIBCXX_USE_DEPRECATED // Annex D.6 public: /** diff --git a/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h b/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h index e3d8827b65d..55c60bc0e17 100644 --- a/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h +++ b/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h @@ -277,6 +277,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 } } +#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED // Special case for auto_ptr<_Tp> to provide the strong guarantee. template explicit @@ -284,7 +285,8 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 : _M_pi(new _Sp_counted_base_impl<_Tp*, _Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>())) { __r.release(); } - +#endif + // Throw bad_weak_ptr when __r._M_get_use_count() == 0. explicit __shared_count(const __weak_count<_Lp>& __r); @@ -578,6 +580,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 /** * @post use_count() == 1 and __r.get() == 0 */ +#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED template explicit __shared_ptr(std::auto_ptr<_Tp1>& __r) @@ -589,6 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 _M_refcount = __shared_count<_Lp>(__r); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); } +#endif template __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __static_cast_tag) @@ -620,6 +624,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 return *this; } +#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED template __shared_ptr& operator=(std::auto_ptr<_Tp1>& __r) @@ -627,6 +632,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 __shared_ptr(__r).swap(*this); return *this; } +#endif void reset() // never throws @@ -993,10 +999,12 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 shared_ptr(const weak_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { } +#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED template explicit shared_ptr(std::auto_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { } +#endif template shared_ptr(const shared_ptr<_Tp1>& __r, __static_cast_tag) @@ -1018,6 +1026,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 return *this; } +#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED template shared_ptr& operator=(std::auto_ptr<_Tp1>& __r) @@ -1025,6 +1034,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 this->__shared_ptr<_Tp>::operator=(__r); return *this; } +#endif }; template