diff options
author | kan <kan@FreeBSD.org> | 2007-05-19 01:25:07 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2007-05-19 01:25:07 +0000 |
commit | 7865836f4b0f698454c31b4593effcb032c22c1e (patch) | |
tree | ea6c2718dc1e45ed535d194df808ef31f0ebac92 /contrib/libstdc++/include/c_std/std_cstdlib.h | |
parent | 1f9ea4d0a40cca64d60cf4dab152349da7b9dddf (diff) | |
download | FreeBSD-src-7865836f4b0f698454c31b4593effcb032c22c1e.zip FreeBSD-src-7865836f4b0f698454c31b4593effcb032c22c1e.tar.gz |
GCC 4.2.0 release C++ standard library and runtime support code.
Diffstat (limited to 'contrib/libstdc++/include/c_std/std_cstdlib.h')
-rw-r--r-- | contrib/libstdc++/include/c_std/std_cstdlib.h | 93 |
1 files changed, 58 insertions, 35 deletions
diff --git a/contrib/libstdc++/include/c_std/std_cstdlib.h b/contrib/libstdc++/include/c_std/std_cstdlib.h index d2d6e37..5c3d586 100644 --- a/contrib/libstdc++/include/c_std/std_cstdlib.h +++ b/contrib/libstdc++/include/c_std/std_cstdlib.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software @@ -28,19 +28,20 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -// -// ISO C++ 14882: 20.4.6 C library -// - -/** @file cstdlib +/** @file include/cstdlib * This is a Standard C++ Library file. You should @c #include this file * in your programs, rather than any of the "*.h" implementation files. * * This is the C++ version of the Standard C Library header @c stdlib.h, * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std. + * contained in the namespace @c std (except for names which are defined + * as macros in C). */ +// +// ISO C++ 14882: 20.4.6 C library +// + #ifndef _GLIBCXX_CSTDLIB #define _GLIBCXX_CSTDLIB 1 @@ -49,6 +50,25 @@ #include <bits/c++config.h> #include <cstddef> +#if !_GLIBCXX_HOSTED +// The C standard does not require a freestanding implementation to +// provide <stdlib.h>. However, the C++ standard does still require +// <cstdlib> -- but only the functionality mentioned in +// [lib.support.start.term]. + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 + +_GLIBCXX_BEGIN_NAMESPACE(std) + + extern "C" void abort(void); + extern "C" int atexit(void (*)()); + extern "C" void exit(int); + +_GLIBCXX_END_NAMESPACE + +#else + #include <stdlib.h> // Get rid of those macros defined in <stdlib.h> in lieu of real functions. @@ -81,8 +101,8 @@ #undef wcstombs #undef wctomb -namespace std -{ +_GLIBCXX_BEGIN_NAMESPACE(std) + using ::div_t; using ::ldiv_t; @@ -124,7 +144,8 @@ namespace std inline ldiv_t div(long __i, long __j) { return ldiv(__i, __j); } -} + +_GLIBCXX_END_NAMESPACE #if _GLIBCXX_USE_C99 @@ -137,8 +158,8 @@ namespace std #undef strtof #undef strtold -namespace __gnu_cxx -{ +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::lldiv_t; #endif @@ -152,17 +173,14 @@ namespace __gnu_cxx inline long long abs(long long __x) { return __x >= 0 ? __x : -__x; } - inline long long - llabs(long long __x) { return __x >= 0 ? __x : -__x; } - #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::llabs; + inline lldiv_t div(long long __n, long long __d) { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } - inline lldiv_t - lldiv(long long __n, long long __d) - { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } + using ::lldiv; #endif #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC @@ -179,26 +197,31 @@ namespace __gnu_cxx #endif using ::strtof; using ::strtold; -} -namespace std -{ +_GLIBCXX_END_NAMESPACE + +_GLIBCXX_BEGIN_NAMESPACE(std) + #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using __gnu_cxx::lldiv_t; + using ::__gnu_cxx::lldiv_t; #endif - using __gnu_cxx::_Exit; - using __gnu_cxx::abs; - using __gnu_cxx::llabs; + using ::__gnu_cxx::_Exit; + using ::__gnu_cxx::abs; #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using __gnu_cxx::div; - using __gnu_cxx::lldiv; -#endif - using __gnu_cxx::atoll; - using __gnu_cxx::strtof; - using __gnu_cxx::strtoll; - using __gnu_cxx::strtoull; - using __gnu_cxx::strtold; -} + using ::__gnu_cxx::llabs; + using ::__gnu_cxx::div; + using ::__gnu_cxx::lldiv; #endif + using ::__gnu_cxx::atoll; + using ::__gnu_cxx::strtof; + using ::__gnu_cxx::strtoll; + using ::__gnu_cxx::strtoull; + using ::__gnu_cxx::strtold; + +_GLIBCXX_END_NAMESPACE + +#endif // _GLIBCXX_USE_C99 + +#endif // !_GLIBCXX_HOSTED #endif |