]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/include/c_std/cstdlib
Makefile.am (std_headers): Remove cXXX from list.
[thirdparty/gcc.git] / libstdc++-v3 / include / c_std / cstdlib
1 // -*- C++ -*- forwarding header.
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
29
30 //
31 // ISO C++ 14882: 20.4.6 C library
32 //
33
34 #ifndef _CPP_CSTDLIB
35 #define _CPP_CSTDLIB 1
36
37 #include <bits/c++config.h>
38 #include <cstddef>
39
40 #pragma GCC system_header
41 #include <stdlib.h>
42
43 // Get rid of those macros defined in <stdlib.h> in lieu of real functions.
44 #undef abort
45 #undef abs
46 #undef atexit
47 #undef atof
48 #undef atoi
49 #undef atol
50 #undef bsearch
51 #undef calloc
52 #undef div
53 #undef exit
54 #undef free
55 #undef getenv
56 #undef labs
57 #undef ldiv
58 #undef malloc
59 #undef mblen
60 #undef mbstowcs
61 #undef mbtowc
62 #undef qsort
63 #undef rand
64 #undef realloc
65 #undef srand
66 #undef strtod
67 #undef strtol
68 #undef strtoul
69 #undef system
70 #undef wcstombs
71 #undef wctomb
72
73 namespace std
74 {
75 using ::div_t;
76 using ::ldiv_t;
77
78 using ::abort;
79 using ::abs;
80 using ::atexit;
81 using ::atof;
82 using ::atoi;
83 using ::atol;
84 using ::bsearch;
85 using ::calloc;
86 using ::div;
87 using ::exit;
88 using ::free;
89 using ::getenv;
90 using ::labs;
91 using ::ldiv;
92 using ::malloc;
93 using ::mblen;
94 using ::mbstowcs;
95 using ::mbtowc;
96 using ::qsort;
97 using ::rand;
98 using ::realloc;
99 using ::srand;
100 using ::strtod;
101 using ::strtol;
102 using ::strtoul;
103 using ::system;
104 using ::wcstombs;
105 using ::wctomb;
106
107 inline long
108 abs(long __i) { return labs(__i); }
109
110 inline ldiv_t
111 div(long __i, long __j) { return ldiv(__i, __j); }
112 }
113
114 #if _GLIBCPP_USE_C99
115
116 #undef _Exit
117 #undef llabs
118 #undef lldiv
119 #undef atoll
120 #undef strtoll
121 #undef strtoull
122 #undef strtof
123 #undef strtold
124
125 namespace __gnu_cxx
126 {
127 using ::lldiv_t;
128 using ::_Exit;
129
130 inline long long
131 abs(long long __x) { return __x >= 0 ? __x : -__x; }
132
133 inline long long
134 llabs(long long __x) { return __x >= 0 ? __x : -__x; }
135
136 inline lldiv_t
137 div(long long __n, long long __d)
138 { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
139
140 inline lldiv_t
141 lldiv(long long __n, long long __d)
142 { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
143
144 using ::atoll;
145 using ::strtof;
146 using ::strtoll;
147 using ::strtoull;
148 using ::strtold;
149 }
150
151 namespace std
152 {
153 using __gnu_cxx::lldiv_t;
154 using __gnu_cxx::_Exit;
155 using __gnu_cxx::abs;
156 using __gnu_cxx::llabs;
157 using __gnu_cxx::div;
158 using __gnu_cxx::lldiv;
159 using __gnu_cxx::atoll;
160 using __gnu_cxx::strtof;
161 using __gnu_cxx::strtoll;
162 using __gnu_cxx::strtoull;
163 using __gnu_cxx::strtold;
164 }
165 #endif
166
167 #endif