/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/utility/func_exception.cpp

  • Committer: edam
  • Date: 2012-02-25 01:31:43 UTC
  • Revision ID: tim@ed.am-20120225013143-9fet2y2d3fjlrwez
added ulibc

Show diffs side-by-side

added added

removed removed

 
1
/*      Copyright (C) 2004 Garrett A. Kajmowicz
 
2
 
 
3
        This file is part of the uClibc++ Library.
 
4
 
 
5
        This library is free software; you can redistribute it and/or
 
6
        modify it under the terms of the GNU Lesser General Public
 
7
        License as published by the Free Software Foundation; either
 
8
        version 2.1 of the License, or (at your option) any later version.
 
9
 
 
10
        This library is distributed in the hope that it will be useful,
 
11
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
        Lesser General Public License for more details.
 
14
 
 
15
        You should have received a copy of the GNU Lesser General Public
 
16
        License along with this library; if not, write to the Free Software
 
17
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
*/
 
19
 
 
20
#include <exception>
 
21
#include <func_exception>
 
22
#include <stdexcept>
 
23
#include <cstdlib>
 
24
 
 
25
namespace std{
 
26
 
 
27
#ifdef __UCLIBCXX_EXCEPTION_SUPPORT__
 
28
 
 
29
_UCXXEXPORT void __throw_bad_alloc(){
 
30
        throw bad_alloc();
 
31
}
 
32
 
 
33
_UCXXEXPORT void __throw_out_of_range( const char * message){
 
34
        if(message == 0){
 
35
                throw out_of_range();
 
36
        }
 
37
        throw out_of_range(message);
 
38
}
 
39
 
 
40
_UCXXEXPORT void __throw_overflow_error( const char * message){
 
41
        if(message == 0){
 
42
                throw overflow_error();
 
43
        }
 
44
        throw overflow_error(message);
 
45
}
 
46
 
 
47
_UCXXEXPORT void __throw_length_error(const char * message){
 
48
        if(message == 0){
 
49
                throw length_error();
 
50
        }
 
51
        throw length_error(message);
 
52
}
 
53
 
 
54
_UCXXEXPORT void __throw_invalid_argument(const char * message){
 
55
        if(message == 0){
 
56
                throw invalid_argument();
 
57
        }
 
58
        throw invalid_argument(message);
 
59
}
 
60
 
 
61
#else
 
62
 
 
63
_UCXXEXPORT void __throw_bad_alloc(){
 
64
        abort();
 
65
}
 
66
 
 
67
_UCXXEXPORT void __throw_out_of_range( const char * ){
 
68
        abort();
 
69
}
 
70
 
 
71
_UCXXEXPORT void __throw_overflow_error( const char * ){
 
72
        abort();
 
73
}
 
74
 
 
75
_UCXXEXPORT void __throw_length_error(const char * ){
 
76
        abort();
 
77
}
 
78
 
 
79
_UCXXEXPORT void __throw_invalid_argument(const char *){
 
80
        abort();
 
81
}
 
82
 
 
83
#endif
 
84
 
 
85
 
 
86
 
 
87
}