uClibc++ updates

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5295 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-11-01 22:54:55 +00:00
parent d7aefb08f7
commit 73bd482b41
6 changed files with 145 additions and 79 deletions
@@ -35,34 +35,20 @@
# define _UCXXLOCAL # define _UCXXLOCAL
#endif #endif
#ifdef __GCC__
# define __UCLIBCXX_NORETURN __attribute__ ((__noreturn__))
#else
# define __UCLIBCXX_NORETURN
#endif
#ifdef __UCLIBCXX_HAS_TLS__ #ifdef __UCLIBCXX_HAS_TLS__
# define __UCLIBCXX_TLS __thread # define __UCLIBCXX_TLS __thread
#else #else
# define __UCLIBCXX_TLS # define __UCLIBCXX_TLS
#endif #endif
// Testing purposes
//Testing purposes
#define __STRING_MAX_UNITS 65535 #define __STRING_MAX_UNITS 65535
namespace std{ namespace std
typedef signed long int streamsize; {
typedef signed long int streamsize;
} }
#pragma GCC visibility pop #pragma GCC visibility pop
#endif
#ifdef __DODEBUG__
#define UCLIBCXX_DEBUG 1
#else
#define UCLIBCXX_DEBUG 0
#endif #endif
+39 -30
View File
@@ -1,5 +1,5 @@
// Exception Handling support header for -*- C++ -*- // Exception Handling support header for -*- C++ -*-
//
// Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002
// Free Software Foundation // Free Software Foundation
// //
@@ -19,7 +19,7 @@
// along with GNU CC; see the file COPYING. If not, write to // along with GNU CC; see the file COPYING. If not, write to
// the Free Software Foundation, 59 Temple Place - Suite 330, // the Free Software Foundation, 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
//
// As a special exception, you may use this file as part of a free software // As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate // library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile // templates or use macros or inline functions from this file, or you compile
@@ -39,7 +39,8 @@
#include <basic_definitions> #include <basic_definitions>
extern "C++" { extern "C++"
{
namespace std namespace std
{ {
@@ -51,43 +52,62 @@ namespace std
* your own %exception classes, or use a different hierarchy, or to * your own %exception classes, or use a different hierarchy, or to
* throw non-class data (e.g., fundamental types). * throw non-class data (e.g., fundamental types).
*/ */
class exception class exception
{ {
public: public:
exception() throw() { } exception() throw() { }
virtual ~exception() throw(); virtual ~exception() throw();
/** Returns a C-style character string describing the general cause /** Returns a C-style character string describing the general cause
* of the current error. */ * of the current error.
*/
virtual const char* what() const throw(); virtual const char* what() const throw();
}; };
/** If an %exception is thrown which is not listed in a function's /** If an %exception is thrown which is not listed in a function's
* %exception specification, one of these may be thrown. */ * %exception specification, one of these may be thrown.
*/
class bad_exception : public exception class bad_exception : public exception
{ {
public: public:
bad_exception() throw() { } bad_exception() throw() { }
// This declaration is not useless: // This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_exception() throw(); virtual ~bad_exception() throw();
}; };
/// If you write a replacement %terminate handler, it must be of this type. // If you write a replacement %terminate handler, it must be of this type.
typedef void (*terminate_handler) ();
/// If you write a replacement %unexpected handler, it must be of this type. typedef CODE void (*terminate_handler)(void);
typedef void (*unexpected_handler) ();
// If you write a replacement %unexpected handler, it must be of this type.
typedef CODE void (*unexpected_handler)(void);
// Takes a new handler function as an argument, returns the old function.
/// Takes a new handler function as an argument, returns the old function.
terminate_handler set_terminate(terminate_handler) throw(); terminate_handler set_terminate(terminate_handler) throw();
/** The runtime will call this function if %exception handling must be
* abandoned for any reason. */
void terminate() __UCLIBCXX_NORETURN;
/// Takes a new handler function as an argument, returns the old function. /** The runtime will call this function if %exception handling must be
* abandoned for any reason.
*/
void terminate() noreturn_function;
// Takes a new handler function as an argument, returns the old function.
unexpected_handler set_unexpected(unexpected_handler) throw(); unexpected_handler set_unexpected(unexpected_handler) throw();
/** The runtime will call this function if an %exception is thrown which /** The runtime will call this function if an %exception is thrown which
* violates the function's %exception specification. */ * violates the function's %exception specification.
void unexpected() __UCLIBCXX_NORETURN; */
void unexpected() noreturn_function;
/** [18.6.4]/1: "Returns true after completing evaluation of a /** [18.6.4]/1: "Returns true after completing evaluation of a
* throw-expression until either completing initialization of the * throw-expression until either completing initialization of the
@@ -99,21 +119,10 @@ namespace std
* 2: "When @c uncaught_exception() is true, throwing an %exception can * 2: "When @c uncaught_exception() is true, throwing an %exception can
* result in a call of @c terminate() (15.5.1)." * result in a call of @c terminate() (15.5.1)."
*/ */
bool uncaught_exception() throw();
} // namespace std
namespace __gnu_cxx bool uncaught_exception() throw();
{
/** A replacement for the standard terminate_handler which prints more } // namespace std
information about the terminating exception (if any) on stderr. Call
@code
std::set_terminate (__gnu_cxx::__verbose_terminate_handler)
@endcode
to use. For more info, see
http://gcc.gnu.org/onlinedocs/libstdc++/19_diagnostics/howto.html#4
*/
void __verbose_terminate_handler ();
} // namespace __gnu_cxx
} // extern "C++" } // extern "C++"
+7 -8
View File
@@ -282,17 +282,16 @@ namespace std{
pop_front(); pop_front();
} }
delete list_start->val; delete list_start->val;
#if UCLIBCXX_DEBUG #ifdef CONFIG_DEBUG_LIB
list_start->val = 0; list_start->val = 0;
#endif #endif
delete list_start; delete list_start;
#if UCLIBCXX_DEBUG #ifdef CONFIG_DEBUG_LIB
list_start = 0; list_start = 0;
list_end = 0; list_end = 0;
#endif #endif
} }
template<class T, class Allocator> void list<T, Allocator>::swap_nodes(node * x, node * y){ template<class T, class Allocator> void list<T, Allocator>::swap_nodes(node * x, node * y){
T * v = x->val; T * v = x->val;
x->val = y->val; x->val = y->val;
@@ -398,7 +397,7 @@ namespace std{
if(elements > 0){ if(elements > 0){
list_start = list_start->next; list_start = list_start->next;
delete list_start->previous->val; delete list_start->previous->val;
#if UCLIBCXX_DEBUG #ifdef CONFIG_DEBUG_LIB
list_start->previous->val = 0; list_start->previous->val = 0;
list_start->previous->next = 0; list_start->previous->next = 0;
list_start->previous->previous = 0; list_start->previous->previous = 0;
@@ -438,13 +437,13 @@ namespace std{
list_end->previous = temp->previous; list_end->previous = temp->previous;
} }
delete temp->val; delete temp->val;
#if UCLIBCXX_DEBUG #ifdef CONFIG_DEBUG_LIB
temp->val = 0; temp->val = 0;
temp->next = 0; temp->next = 0;
temp->previous = 0; temp->previous = 0;
#endif #endif
delete temp; delete temp;
#if UCLIBCXX_DEBUG #ifdef CONFIG_DEBUG_LIB
temp = 0; temp = 0;
#endif #endif
--elements; --elements;
@@ -503,13 +502,13 @@ namespace std{
++position; ++position;
} }
delete temp->val; delete temp->val;
#if UCLIBCXX_DEBUG #ifdef CONFIG_DEBUG_LIB
temp->next = 0; temp->next = 0;
temp->previous = 0; temp->previous = 0;
temp->val = 0; temp->val = 0;
#endif #endif
delete temp; delete temp;
#if UCLIBCXX_DEBUG #ifdef CONFIG_DEBUG_LIB
temp = 0; temp = 0;
#endif #endif
--elements; --elements;
+1 -1
View File
@@ -37,7 +37,7 @@
CXXSRCS += algorithm.cxx associative_base.cxx bitset.cxx char_traits.cxx CXXSRCS += algorithm.cxx associative_base.cxx bitset.cxx char_traits.cxx
CXXSRCS += complex.cxx del_op.cxx del_opnt.cxx del_opv.cxx del_opvnt.cxx CXXSRCS += complex.cxx del_op.cxx del_opnt.cxx del_opv.cxx del_opvnt.cxx
CXXSRCS += deque.cxx eh_alloc.cxx eh_globals.cxx exception.cxx CXXSRCS += deque.cxx eh_alloc.cxx eh_globals.cxx eh_terminate.cxx exception.cxx
CXXSRCS += fstream.cxx func_exception.cxx iomanip.cxx ios.cxx CXXSRCS += fstream.cxx func_exception.cxx iomanip.cxx ios.cxx
CXXSRCS += iostream.cxx istream.cxx iterator.cxx limits.cxx list.cxx CXXSRCS += iostream.cxx istream.cxx iterator.cxx limits.cxx list.cxx
CXXSRCS += locale.cxx map.cxx new_handler.cxx new_op.cxx new_opnt.cxx CXXSRCS += locale.cxx map.cxx new_handler.cxx new_op.cxx new_opnt.cxx
@@ -0,0 +1,75 @@
/* Copyright (C) 2004 Garrett A. Kajmowicz
*
* This file is part of the uClibc++ Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <cstdlib>
#include <exception>
#ifdef CONFIG_UCLIBCXX_EXCEPTION
namespace std
{
_UCXXEXPORT static terminate_handler __terminate_handler = abort;
_UCXXEXPORT static unexpected_handler __unexpected_handler = terminate;
// Takes a new handler function as an argument, returns the old function.
_UCXXEXPORT terminate_handler set_terminate(terminate_handler func) throw()
{
terminate_handler old = __terminate_handler;
__terminate_handler = func;
return old;
}
/** The runtime will call this function if %exception handling must be
* abandoned for any reason.
*/
_UCXXEXPORT void terminate(void) throw()
{
if (__terminate_handler)
{
__terminate_handler();
}
abort();
}
_UCXXEXPORT terminate_handler set_unexpected(unexpected_handler func) throw()
{
unexpected_handler old = __unexpected_handler;
__unexpected_handler = func;
return old;
}
/** The runtime will call this function if an %exception is thrown which
* violates the function's %exception specification.
*/
_UCXXEXPORT void unexpected(void) throw()
{
if (__unexpected_handler)
{
__unexpected_handler();
}
terminate();
}
}
#endif
+20 -23
View File
@@ -1,22 +1,21 @@
/* Copyright (C) 2004 Garrett A. Kajmowicz /* Copyright (C) 2004 Garrett A. Kajmowicz
*
This file is part of the uClibc++ Library. * This file is part of the uClibc++ Library.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
*
This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
#include <exception> #include <exception>
@@ -31,22 +30,20 @@ namespace std
{ {
_UCXXEXPORT static char * __std_exception_what_value = "exception"; _UCXXEXPORT static char * __std_exception_what_value = "exception";
//We are providing our own versions to be sneaky // We are providing our own versions to be sneaky
_UCXXEXPORT exception::~exception() throw() _UCXXEXPORT exception::~exception() throw()
{ {
//Empty function // Empty function
} }
_UCXXEXPORT const char* exception::what() const throw() _UCXXEXPORT const char *exception::what() const throw()
{ {
return __std_exception_what_value; return __std_exception_what_value;
} }
_UCXXEXPORT bad_exception::~bad_exception() throw() _UCXXEXPORT bad_exception::~bad_exception() throw()
{ {
} }
} }