diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-01 21:08:56 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-01 21:08:56 +0000 |
commit | 6bd29cb2e3c9dfedee2cbd73a324eaef76c292ae (patch) | |
tree | a99511f64eea990fb7d0f9595cc4933608fc8567 /misc/uClibc++/libxx | |
parent | 43f7ddc7d410a4982ec78cc45cc413a3270d1b52 (diff) | |
download | nuttx-6bd29cb2e3c9dfedee2cbd73a324eaef76c292ae.tar.gz nuttx-6bd29cb2e3c9dfedee2cbd73a324eaef76c292ae.tar.bz2 nuttx-6bd29cb2e3c9dfedee2cbd73a324eaef76c292ae.zip |
uClibc++ compiles... but it is a long way from linking
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5293 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'misc/uClibc++/libxx')
-rw-r--r-- | misc/uClibc++/libxx/uClibc++/Make.defs | 3 | ||||
-rw-r--r-- | misc/uClibc++/libxx/uClibc++/eh_alloc.cxx | 130 | ||||
-rw-r--r-- | misc/uClibc++/libxx/uClibc++/exception.cxx | 63 | ||||
-rw-r--r-- | misc/uClibc++/libxx/uClibc++/func_exception.cxx | 110 | ||||
-rw-r--r-- | misc/uClibc++/libxx/uClibc++/istream.cxx | 4 | ||||
-rw-r--r-- | misc/uClibc++/libxx/uClibc++/stdexcept.cxx | 2 | ||||
-rw-r--r-- | misc/uClibc++/libxx/uClibc++/support.cxx | 53 |
7 files changed, 180 insertions, 185 deletions
diff --git a/misc/uClibc++/libxx/uClibc++/Make.defs b/misc/uClibc++/libxx/uClibc++/Make.defs index 9f1b2f51f..a4e7a02f7 100644 --- a/misc/uClibc++/libxx/uClibc++/Make.defs +++ b/misc/uClibc++/libxx/uClibc++/Make.defs @@ -43,8 +43,7 @@ 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 += new_opv.cxx new_opvnt.cxx numeric.cxx ostream.cxx queue.cxx CXXSRCS += set.cxx sstream.cxx stack.cxx stdexcept.cxx streambuf.cxx -CXXSRCS += string.cxx support.cxx typeinfo.cxx utility.cxx valarray.cxx -CXXSRCS += vector.cxx +CXXSRCS += string.cxx typeinfo.cxx utility.cxx valarray.cxx vector.cxx # Add the path to the uClibc++ subdirectory diff --git a/misc/uClibc++/libxx/uClibc++/eh_alloc.cxx b/misc/uClibc++/libxx/uClibc++/eh_alloc.cxx index 5098196d8..ea3308a30 100644 --- a/misc/uClibc++/libxx/uClibc++/eh_alloc.cxx +++ b/misc/uClibc++/libxx/uClibc++/eh_alloc.cxx @@ -1,61 +1,93 @@ -/* Copyright (C) 2006 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, version 2.1 - of the License. - - 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 -*/ +/* Copyright (C) 2006 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, version 2.1 + * of the License. + * + * 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 <cstring> #include <func_exception> -//This is a system-specific header which does all of the error-handling management +// This is a system-specific header which does all of the error-handling +// management + #include <unwind-cxx.h> -namespace __cxxabiv1{ - -extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw(){ - void *retval; - //The sizeof crap is required by Itanium ABI because we need to provide space for - //accounting information which is implementaion (gcc) specified - retval = malloc (thrown_size + sizeof(__cxa_exception)); - if (0 == retval){ - std::terminate(); - } - memset (retval, 0, sizeof(__cxa_exception)); - return (void *)((unsigned char *)retval + sizeof(__cxa_exception)); -} +namespace __cxxabiv1 +{ + extern "C" void *__cxa_allocate_exception(std::size_t thrown_size) throw() + { + void *retval; -extern "C" void __cxa_free_exception(void *vptr) throw(){ - free( (char *)(vptr) - sizeof(__cxa_exception) ); -} + // The amount of data needed is the size of the object *PLUS* + // the size of the header. The header is of struct __cxa_exception + // The address needs to be adjusted because the pointer we return + // should not point to the start of the memory, but to the point + // where the object being thrown actually starts + retval = malloc (thrown_size + sizeof(__cxa_exception)); -extern "C" __cxa_dependent_exception * __cxa_allocate_dependent_exception() throw(){ - __cxa_dependent_exception *retval; - //The sizeof crap is required by Itanium ABI because we need to provide space for - //accounting information which is implementaion (gcc) specified - retval = static_cast<__cxa_dependent_exception*>(malloc (sizeof(__cxa_dependent_exception))); - if (0 == retval){ - std::terminate(); - } - memset (retval, 0, sizeof(__cxa_dependent_exception)); - return retval; -} + // Check to see that we actuall allocated memory -extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *vptr) throw(){ - free( (char *)(vptr) ); -} + if (0 == retval) + { + std::terminate(); + } + + // Need to do a typecast to char* otherwize we are doing math with + // a void* which makes the compiler cranky (Like me) + + memset (retval, 0, sizeof(__cxa_exception)); + return (void *)((unsigned char *)retval + sizeof(__cxa_exception)); + } + + extern "C" void __cxa_free_exception(void *vptr) throw() + { + free( (char *)(vptr) - sizeof(__cxa_exception) ); + } + + extern "C" __cxa_dependent_exception *__cxa_allocate_dependent_exception() throw() + { + __cxa_dependent_exception *retval; + + // The amount of data needed is the size of the object *PLUS* + // the size of the header. The header is of struct __cxa_exception + // The address needs to be adjusted because the pointer we return + // should not point to the start of the memory, but to the point + // where the object being thrown actually starts + + retval = static_cast<__cxa_dependent_exception*>(malloc (sizeof(__cxa_dependent_exception))); + + // Check to see that we actuall allocated memory + + if (0 == retval) + { + std::terminate(); + } + + memset (retval, 0, sizeof(__cxa_dependent_exception)); + return retval; + } + + extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *vptr) throw() + { + free( (char *)(vptr) ); + } + + extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest) (void *)) + { + } } diff --git a/misc/uClibc++/libxx/uClibc++/exception.cxx b/misc/uClibc++/libxx/uClibc++/exception.cxx index 82021ddb6..6d487a116 100644 --- a/misc/uClibc++/libxx/uClibc++/exception.cxx +++ b/misc/uClibc++/libxx/uClibc++/exception.cxx @@ -1,52 +1,53 @@ -/* 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 - 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 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. + 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 + 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 <exception> -//We can't do this yet because gcc is too stupid to be able to handle -//different implementations of exception class. +// We can't do this yet because gcc is too stupid to be able to handle +// different implementations of exception class. -#undef __UCLIBCXX_EXCEPTION_SUPPORT__ +#undef CONFIG_UCLIBCXX_EXCEPTION -#ifdef __UCLIBCXX_EXCEPTION_SUPPORT__ +#ifdef CONFIG_UCLIBCXX_EXCEPTION -namespace std{ - _UCXXEXPORT static char * __std_exception_what_value = "exception"; +namespace std +{ + _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(){ - //Empty function - } + _UCXXEXPORT exception::~exception() throw() + { + //Empty function + } - _UCXXEXPORT const char* exception::what() const throw(){ - return __std_exception_what_value; - } - - _UCXXEXPORT bad_exception::~bad_exception() throw(){ - - } + _UCXXEXPORT const char* exception::what() const throw() + { + return __std_exception_what_value; + } + _UCXXEXPORT bad_exception::~bad_exception() throw() + { + } } - #endif diff --git a/misc/uClibc++/libxx/uClibc++/func_exception.cxx b/misc/uClibc++/libxx/uClibc++/func_exception.cxx index fab095f3d..9971871ef 100644 --- a/misc/uClibc++/libxx/uClibc++/func_exception.cxx +++ b/misc/uClibc++/libxx/uClibc++/func_exception.cxx @@ -1,20 +1,20 @@ -/* 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 - 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 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. + 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 + 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 <exception> @@ -24,60 +24,78 @@ namespace std{ -#ifdef __UCLIBCXX_EXCEPTION_SUPPORT__ +#ifdef CONFIG_UCLIBCXX_EXCEPTION -_UCXXEXPORT void __throw_bad_alloc(){ - throw bad_alloc(); +_UCXXEXPORT void __throw_bad_alloc() +{ + throw bad_alloc(); } -_UCXXEXPORT void __throw_out_of_range( const char * message){ - if(message == 0){ - throw out_of_range(); - } - throw out_of_range(message); +_UCXXEXPORT void __throw_out_of_range(const char * message) +{ + if(message == 0) + { + throw out_of_range(); + } + + throw out_of_range(message); } -_UCXXEXPORT void __throw_overflow_error( const char * message){ - if(message == 0){ - throw overflow_error(); - } - throw overflow_error(message); +_UCXXEXPORT void __throw_overflow_error(const char * message) +{ + if(message == 0) + { + throw overflow_error(); + } + + throw overflow_error(message); } -_UCXXEXPORT void __throw_length_error(const char * message){ - if(message == 0){ - throw length_error(); - } - throw length_error(message); +_UCXXEXPORT void __throw_length_error(const char * message) +{ + if(message == 0) + { + throw length_error(); + } + + throw length_error(message); } -_UCXXEXPORT void __throw_invalid_argument(const char * message){ - if(message == 0){ - throw invalid_argument(); - } - throw invalid_argument(message); +_UCXXEXPORT void __throw_invalid_argument(const char * message) +{ + if(message == 0) + { + throw invalid_argument(); + } + + throw invalid_argument(message); } #else -_UCXXEXPORT void __throw_bad_alloc(){ - abort(); +_UCXXEXPORT void __throw_bad_alloc() +{ + abort(); } -_UCXXEXPORT void __throw_out_of_range( const char * ){ - abort(); +_UCXXEXPORT void __throw_out_of_range(const char *) +{ + abort(); } -_UCXXEXPORT void __throw_overflow_error( const char * ){ - abort(); +_UCXXEXPORT void __throw_overflow_error(const char *) +{ + abort(); } -_UCXXEXPORT void __throw_length_error(const char * ){ - abort(); +_UCXXEXPORT void __throw_length_error(const char *) +{ + abort(); } -_UCXXEXPORT void __throw_invalid_argument(const char *){ - abort(); +_UCXXEXPORT void __throw_invalid_argument(const char *) +{ + abort(); } #endif diff --git a/misc/uClibc++/libxx/uClibc++/istream.cxx b/misc/uClibc++/libxx/uClibc++/istream.cxx index 9e9613973..bcb81c0f9 100644 --- a/misc/uClibc++/libxx/uClibc++/istream.cxx +++ b/misc/uClibc++/libxx/uClibc++/istream.cxx @@ -22,7 +22,6 @@ #include <istream> - namespace std{ #ifdef __UCLIBCXX_EXPAND_ISTREAM_CHAR__ @@ -59,8 +58,7 @@ namespace std{ template _UCXXEXPORT istream & istream::operator>>(void *& p); template _UCXXEXPORT istream & operator>>(istream & is, char & c); - -#ifdef __UCLIBCXX_HAS_FLOATS__ +#ifdef CONFIG_HAVE_FLOAT template _UCXXEXPORT istream & istream::operator>>(float &f); template _UCXXEXPORT istream & istream::operator>>(double &f); template _UCXXEXPORT istream & istream::operator>>(long double &f); diff --git a/misc/uClibc++/libxx/uClibc++/stdexcept.cxx b/misc/uClibc++/libxx/uClibc++/stdexcept.cxx index 90dccc7a4..d372c0b77 100644 --- a/misc/uClibc++/libxx/uClibc++/stdexcept.cxx +++ b/misc/uClibc++/libxx/uClibc++/stdexcept.cxx @@ -20,7 +20,7 @@ #include <exception> #include <stdexcept> -#ifdef __UCLIBCXX_EXCEPTION_SUPPORT__ +#ifdef CONFIG_UCLIBCXX_EXCEPTION namespace std{ diff --git a/misc/uClibc++/libxx/uClibc++/support.cxx b/misc/uClibc++/libxx/uClibc++/support.cxx deleted file mode 100644 index 875459442..000000000 --- a/misc/uClibc++/libxx/uClibc++/support.cxx +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 <support> - -extern "C" void *__cxa_allocate_exception(size_t thrown_size){ - void * retval; - -// The amount of data needed is the size of the object *PLUS* -// the size of the header. The header is of struct __cxa_exception -// The address needs to be adjusted because the pointer we return -// should not point to the start of the memory, but to the point -// where the object being thrown actually starts -// - retval = malloc(thrown_size + sizeof(__cxa_exception)); - -// Check to see that we actuall allocated memory - if(retval == 0){ - std::terminate(); - } - - //Need to do a typecast to char* otherwize we are doing math with - //a void* which makes the compiler cranky (Like me) - return ((char *)retval + sizeof(__cxa_exception)); -} - -extern "C" void __cxa_free_exception(void *thrown_exception){ - - - -} - -extern "C" void __cxa_throw (void *thrown_exception, void *info,void (*dest) (void *) ){ - - -} - |