OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libstdc++-v3/] [include/] [c_std/] [cstdlib] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// -*- C++ -*- forwarding header.
2
 
3
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4
// 2009, 2010  Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 3, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// Under Section 7 of GPL version 3, you are granted additional
18
// permissions described in the GCC Runtime Library Exception, version
19
// 3.1, as published by the Free Software Foundation.
20
 
21
// You should have received a copy of the GNU General Public License and
22
// a copy of the GCC Runtime Library Exception along with this program;
23
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24
// .
25
 
26
/** @file include/cstdlib
27
 *  This is a Standard C++ Library file.  You should @c #include this file
28
 *  in your programs, rather than any of the @a *.h implementation files.
29
 *
30
 *  This is the C++ version of the Standard C Library header @c stdlib.h,
31
 *  and its contents are (mostly) the same as that header, but are all
32
 *  contained in the namespace @c std (except for names which are defined
33
 *  as macros in C).
34
 */
35
 
36
//
37
// ISO C++ 14882: 20.4.6  C library
38
//
39
 
40
#ifndef _GLIBCXX_CSTDLIB
41
#define _GLIBCXX_CSTDLIB 1
42
 
43
#pragma GCC system_header
44
 
45
#include 
46
#include 
47
 
48
#if !_GLIBCXX_HOSTED
49
// The C standard does not require a freestanding implementation to
50
// provide .  However, the C++ standard does still require
51
//  -- but only the functionality mentioned in
52
// [lib.support.start.term].
53
 
54
#define EXIT_SUCCESS 0
55
#define EXIT_FAILURE 1
56
 
57
_GLIBCXX_BEGIN_NAMESPACE(std)
58
 
59
  extern "C" void abort(void) throw () _GLIBCXX_NORETURN;
60
  extern "C" int atexit(void (*)()) throw ();
61
  extern "C" void exit(int) throw () _GLIBCXX_NORETURN;
62
 
63
_GLIBCXX_END_NAMESPACE
64
 
65
#else
66
 
67
#include 
68
 
69
// Get rid of those macros defined in  in lieu of real functions.
70
#undef abort
71
#undef abs
72
#undef atexit
73
#undef atof
74
#undef atoi
75
#undef atol
76
#undef bsearch
77
#undef calloc
78
#undef div
79
#undef exit
80
#undef free
81
#undef getenv
82
#undef labs
83
#undef ldiv
84
#undef malloc
85
#undef mblen
86
#undef mbstowcs
87
#undef mbtowc
88
#undef qsort
89
#undef rand
90
#undef realloc
91
#undef srand
92
#undef strtod
93
#undef strtol
94
#undef strtoul
95
#undef system
96
#undef wcstombs
97
#undef wctomb
98
 
99
_GLIBCXX_BEGIN_NAMESPACE(std)
100
 
101
  using ::div_t;
102
  using ::ldiv_t;
103
 
104
  using ::abort;
105
  using ::abs;
106
  using ::atexit;
107
  using ::atof;
108
  using ::atoi;
109
  using ::atol;
110
  using ::bsearch;
111
  using ::calloc;
112
  using ::div;
113
  using ::exit;
114
  using ::free;
115
  using ::getenv;
116
  using ::labs;
117
  using ::ldiv;
118
  using ::malloc;
119
#ifdef _GLIBCXX_HAVE_MBSTATE_T
120
  using ::mblen;
121
  using ::mbstowcs;
122
  using ::mbtowc;
123
#endif // _GLIBCXX_HAVE_MBSTATE_T
124
  using ::qsort;
125
  using ::rand;
126
  using ::realloc;
127
  using ::srand;
128
  using ::strtod;
129
  using ::strtol;
130
  using ::strtoul;
131
  using ::system;
132
#ifdef _GLIBCXX_USE_WCHAR_T
133
  using ::wcstombs;
134
  using ::wctomb;
135
#endif // _GLIBCXX_USE_WCHAR_T
136
 
137
  inline long
138
  abs(long __i) { return labs(__i); }
139
 
140
  inline ldiv_t
141
  div(long __i, long __j) { return ldiv(__i, __j); }
142
 
143
_GLIBCXX_END_NAMESPACE
144
 
145
#if _GLIBCXX_USE_C99
146
 
147
#undef _Exit
148
#undef llabs
149
#undef lldiv
150
#undef atoll
151
#undef strtoll
152
#undef strtoull
153
#undef strtof
154
#undef strtold
155
 
156
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
157
 
158
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
159
  using ::lldiv_t;
160
#endif
161
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
162
  extern "C" void (_Exit)(int) throw () _GLIBCXX_NORETURN;
163
#endif
164
#if !_GLIBCXX_USE_C99_DYNAMIC
165
  using ::_Exit;
166
#endif
167
 
168
  inline long long
169
  abs(long long __x) { return __x >= 0 ? __x : -__x; }
170
 
171
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
172
  using ::llabs;
173
 
174
  inline lldiv_t
175
  div(long long __n, long long __d)
176
  { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
177
 
178
  using ::lldiv;
179
#endif
180
 
181
#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
182
  extern "C" long long int (atoll)(const char *) throw ();
183
  extern "C" long long int
184
    (strtoll)(const char * restrict, char ** restrict, int) throw ();
185
  extern "C" unsigned long long int
186
    (strtoull)(const char * restrict, char ** restrict, int) throw ();
187
#endif
188
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
189
  using ::atoll;
190
  using ::strtoll;
191
  using ::strtoull;
192
#endif
193
  using ::strtof;
194
  using ::strtold;
195
 
196
_GLIBCXX_END_NAMESPACE
197
 
198
_GLIBCXX_BEGIN_NAMESPACE(std)
199
 
200
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
201
  using ::__gnu_cxx::lldiv_t;
202
#endif
203
  using ::__gnu_cxx::_Exit;
204
  using ::__gnu_cxx::abs;
205
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
206
  using ::__gnu_cxx::llabs;
207
  using ::__gnu_cxx::div;
208
  using ::__gnu_cxx::lldiv;
209
#endif
210
  using ::__gnu_cxx::atoll;
211
  using ::__gnu_cxx::strtof;
212
  using ::__gnu_cxx::strtoll;
213
  using ::__gnu_cxx::strtoull;
214
  using ::__gnu_cxx::strtold;
215
 
216
_GLIBCXX_END_NAMESPACE
217
 
218
#endif // _GLIBCXX_USE_C99
219
 
220
#endif // !_GLIBCXX_HOSTED
221
 
222
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.