Commit 0517cb99 by Benjamin Kosnik

[multiple changes]


2000-10-02  Steven King  <sxking@uswest.net>

        * mkcshadow: Fixed script to output proper include guard.
        * bits/char_traits.h: Cleaned up types in char_traits<char> functions.
        * libio/_G_config.h: Hacked to make work with shadow heraders.
        * shadow/*: Hacked to make shadow headers work.

2000-10-02  Benjamin Kosnik  <bkoz@purist.soma.redhat.com>

	Self-compile with shadow headers.
	* acconfig.h (_GLIBCPP_USE_SHADOW_HEADERS): Define. Eventually,
	like _GLIBCPP_USE_NAMESPACES before it, this macro will die when
	it becomes the default way the library is built.
	* acinclude.m4 (GLIBCPP_ENABLE_SHADOW): New macro.
	* config/gnu-linux/bits/ctype_base.h (ctype_base): Use it.
	* config/gnu-linux/ctype.cc (ctype): Use it.

	* src/localename.cc (locale::_Impl::_M_replace_categories): Remove
	call to assert.
	* src/locale.cc: Explicitly cast mbstate_t to void* in calls to
	memset. This should not be necessary, but an ambiguous overload
	with it in.

	* shadow/bits/std_cwchar.h: Fix.
	* shadow/wchar.h: Fix.

	* config/gnu-linux/bits/ctype_base.h (ctype_base): Inject ctype
	enums into namespace std:: for ctype_base enum. Other OS types
	will have to do this as well.
	* config/gnu-linux/ctype.cc (ctype): Inject ctype data into
	namespace std, in particular __ctype_toupper, __ctype_tolower,
	__ctype_b.

	* shadow/iolibio.h: New file.
	* shadow/bits/wrap_iolibio.h: New file.
	* shadow/libioP.h: New file.
	* shadow/bits/wrap_libioP.h: New file.
	* shadow/bits/wrap_fcntl.h: New file.
	* shadow/fcntl.h: New file.
	* shadow/iconv.h: New file. Inject iconv names into the global
	namespace, unmangled for the moment.
	* shadow/bits/wrap_iconv.h: New file.
	* shadow/unistd.h: Remove. Useless.
	* shadow/bits/wrap_unistd.h: Remove.

	* src/Makefile.am: Take out machine-ansi.h, add fcntl.h unistd.h.
	* src/Makefile.in: Regenerate.

	* config/c_io_libio.h (_IO_codecvt): Change to normal C++ decl.

	* shadow/libio.h: Fix.
	* shadow/bits/wrap_libio.h: Fix.

	* shadow/bits/std_clocale.h: Remove typedef struct construct,
	which will not compile.
	* shadow/bits/std_ctime.h: Same.

	* shadow/pthread.h: New file. Put pthreads types and functions
	into global scope, which is probably not the correct long-term
	solution but has to be done at the moment before libio wrappers
	can even be started.
	* shadow/bits/wrap_pthread.h: New file.

	* bits/std_ios.h: Formatting tweak.
	* shadow/bits/std_cstdio.h: Format. Remove extraneous bits.

	* acinclude.m4 (GLIBCPP_CHECK_COMPILER_FEATURES): Add -Werror to
	tests for compiler features.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	* config/c_io_libio.cc: Remove fcntl.h include, as SEEK_SET
	redefined.
	* libio/libioP.h: Comment out fcntl.h include.

	* shadow/math.h: Add in float and long declarations, as per ISO C9X.

	* bits/c++config: Define _ISOC99_SOURCE.

	* acinclude.m4 (GLIBCPP_ENABLE_SHADOW): Add -fno-builtins to
	CSHADOWFLAGS, as well as _ISOC99_SOURCE.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* src/Makefile.am (CSHADOW_INCLUDES): Enable, again.
	(CSHADOW_INCLUDES): Add -I$(top_srcdir)/std before shadow include dir.
	(CXXCOMPILE): Remove $(DEFS), which searches $(top_srcdir) before
	std or shadow directories.
	(LTCXXCOMPILE): Same.
	(INCLUDES): Add $(top_builddir) before $(top_srcdir).
	(AC_CXXFLAGS): Add CSHADOWFLAGS.
	* src/Makefile.in: Regenerate.

	* src/complex.cc (FCT): Change ::name to name.
	* src/complexl.cc (FCT): Same. Use _GLIBCPP_USE_LONG_LONG here.
	* src/complexf.cc (FCT): Same.

	* src/complexf.cc: Remove FCT define, as things are properly
	overloaded in the std namespace with the shadow headers.
	* src/complexl.cc: Same.
	* src/complex.cc: Same.

From-SVN: r36707
parent 1792c91c
2000-10-02 Steven King <sxking@uswest.net>
* mkcshadow: Fixed script to output proper include guard.
* bits/char_traits.h: Cleaned up types in char_traits<char> functions.
* libio/_G_config.h: Hacked to make work with shadow heraders.
* shadow/*: Hacked to make shadow headers work.
2000-10-02 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
Self-compile with shadow headers.
* acconfig.h (_GLIBCPP_USE_SHADOW_HEADERS): Define. Eventually,
like _GLIBCPP_USE_NAMESPACES before it, this macro will die when
it becomes the default way the library is built.
* acinclude.m4 (GLIBCPP_ENABLE_SHADOW): New macro.
* config/gnu-linux/bits/ctype_base.h (ctype_base): Use it.
* config/gnu-linux/ctype.cc (ctype): Use it.
* src/localename.cc (locale::_Impl::_M_replace_categories): Remove
call to assert.
* src/locale.cc: Explicitly cast mbstate_t to void* in calls to
memset. This should not be necessary, but an ambiguous overload
with it in.
* shadow/bits/std_cwchar.h: Fix.
* shadow/wchar.h: Fix.
* config/gnu-linux/bits/ctype_base.h (ctype_base): Inject ctype
enums into namespace std:: for ctype_base enum. Other OS types
will have to do this as well.
* config/gnu-linux/ctype.cc (ctype): Inject ctype data into
namespace std, in particular __ctype_toupper, __ctype_tolower,
__ctype_b.
* shadow/iolibio.h: New file.
* shadow/bits/wrap_iolibio.h: New file.
* shadow/libioP.h: New file.
* shadow/bits/wrap_libioP.h: New file.
* shadow/bits/wrap_fcntl.h: New file.
* shadow/fcntl.h: New file.
* shadow/iconv.h: New file. Inject iconv names into the global
namespace, unmangled for the moment.
* shadow/bits/wrap_iconv.h: New file.
* shadow/unistd.h: Remove. Useless.
* shadow/bits/wrap_unistd.h: Remove.
* src/Makefile.am: Take out machine-ansi.h, add fcntl.h unistd.h.
* src/Makefile.in: Regenerate.
* config/c_io_libio.h (_IO_codecvt): Change to normal C++ decl.
* shadow/libio.h: Fix.
* shadow/bits/wrap_libio.h: Fix.
* shadow/bits/std_clocale.h: Remove typedef struct construct,
which will not compile.
* shadow/bits/std_ctime.h: Same.
* shadow/pthread.h: New file. Put pthreads types and functions
into global scope, which is probably not the correct long-term
solution but has to be done at the moment before libio wrappers
can even be started.
* shadow/bits/wrap_pthread.h: New file.
* bits/std_ios.h: Formatting tweak.
* shadow/bits/std_cstdio.h: Format. Remove extraneous bits.
* acinclude.m4 (GLIBCPP_CHECK_COMPILER_FEATURES): Add -Werror to
tests for compiler features.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* config/c_io_libio.cc: Remove fcntl.h include, as SEEK_SET
redefined.
* libio/libioP.h: Comment out fcntl.h include.
* shadow/math.h: Add in float and long declarations, as per ISO C9X.
* bits/c++config: Define _ISOC99_SOURCE.
* acinclude.m4 (GLIBCPP_ENABLE_SHADOW): Add -fno-builtins to
CSHADOWFLAGS, as well as _ISOC99_SOURCE.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* src/Makefile.am (CSHADOW_INCLUDES): Enable, again.
(CSHADOW_INCLUDES): Add -I$(top_srcdir)/std before shadow include dir.
(CXXCOMPILE): Remove $(DEFS), which searches $(top_srcdir) before
std or shadow directories.
(LTCXXCOMPILE): Same.
(INCLUDES): Add $(top_builddir) before $(top_srcdir).
(AC_CXXFLAGS): Add CSHADOWFLAGS.
* src/Makefile.in: Regenerate.
* src/complex.cc (FCT): Change ::name to name.
* src/complexl.cc (FCT): Same. Use _GLIBCPP_USE_LONG_LONG here.
* src/complexf.cc (FCT): Same.
* src/complexf.cc: Remove FCT define, as things are properly
overloaded in the std namespace with the shadow headers.
* src/complexl.cc: Same.
* src/complex.cc: Same.
2000-09-25 Phil Edwards <pme@sources.redhat.com> 2000-09-25 Phil Edwards <pme@sources.redhat.com>
* docs/documentation.html: Add link to... * docs/documentation.html: Add link to...
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
// Include support for 'long long' and 'unsigned long long'. // Include support for 'long long' and 'unsigned long long'.
#undef _GLIBCPP_USE_LONG_LONG #undef _GLIBCPP_USE_LONG_LONG
// Include support for shadow headers, ie --enable-cshadow-headers.
#undef _GLIBCPP_USE_SHADOW_HEADERS
// Define if the host has a type mbstate_t defined in // Define if the host has a type mbstate_t defined in
// wchar.h, as required by 21.1.3.1. Some systems, namely // wchar.h, as required by 21.1.3.1. Some systems, namely
// hppa-hp-hpux10.20 do not meet this requirement, and must be worked // hppa-hp-hpux10.20 do not meet this requirement, and must be worked
......
...@@ -205,7 +205,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ ...@@ -205,7 +205,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
# Check for more sophisticated diagnostic control. # Check for more sophisticated diagnostic control.
AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once]) AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
CXXFLAGS='-fdiagnostics-show-location=once' CXXFLAGS='-Werror -fdiagnostics-show-location=once'
AC_TRY_COMPILE(, [int foo; AC_TRY_COMPILE(, [int foo;
], [ac_gabydiags=yes], [ac_gabydiags=no]) ], [ac_gabydiags=yes], [ac_gabydiags=no])
if test "$ac_test_CXXFLAGS" = set; then if test "$ac_test_CXXFLAGS" = set; then
...@@ -221,7 +221,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ ...@@ -221,7 +221,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
# Check for -ffunction-sections -fdata-sections # Check for -ffunction-sections -fdata-sections
AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
CXXFLAGS='-ffunction-sections -fdata-sections' CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
AC_TRY_COMPILE(, [int foo; AC_TRY_COMPILE(, [int foo;
], [ac_fdsections=yes], [ac_fdsections=no]) ], [ac_fdsections=yes], [ac_fdsections=no])
if test "$ac_test_CXXFLAGS" = set; then if test "$ac_test_CXXFLAGS" = set; then
...@@ -1446,10 +1446,11 @@ changequote([, ]) ...@@ -1446,10 +1446,11 @@ changequote([, ])
AC_MSG_RESULT($enable_cshadow_headers) AC_MSG_RESULT($enable_cshadow_headers)
dnl Option parsed, now set things appropriately dnl Option parsed, now set things appropriately
dnl CSHADOWFLAGS is currently unused, but may be useful in the future. dnl NB: these things may be duplicated in c++config.h as well.
case "$enable_cshadow_headers" in case "$enable_cshadow_headers" in
yes) yes)
CSHADOWFLAGS="" CSHADOWFLAGS="-fno-builtin"
AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
;; ;;
no) no)
CSHADOWFLAGS="" CSHADOWFLAGS=""
......
...@@ -217,7 +217,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ ...@@ -217,7 +217,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
# Check for more sophisticated diagnostic control. # Check for more sophisticated diagnostic control.
AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once]) AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
CXXFLAGS='-fdiagnostics-show-location=once' CXXFLAGS='-Werror -fdiagnostics-show-location=once'
AC_TRY_COMPILE(, [int foo; AC_TRY_COMPILE(, [int foo;
], [ac_gabydiags=yes], [ac_gabydiags=no]) ], [ac_gabydiags=yes], [ac_gabydiags=no])
if test "$ac_test_CXXFLAGS" = set; then if test "$ac_test_CXXFLAGS" = set; then
...@@ -233,7 +233,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ ...@@ -233,7 +233,7 @@ AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
# Check for -ffunction-sections -fdata-sections # Check for -ffunction-sections -fdata-sections
AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
CXXFLAGS='-ffunction-sections -fdata-sections' CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
AC_TRY_COMPILE(, [int foo; AC_TRY_COMPILE(, [int foo;
], [ac_fdsections=yes], [ac_fdsections=no]) ], [ac_fdsections=yes], [ac_fdsections=no])
if test "$ac_test_CXXFLAGS" = set; then if test "$ac_test_CXXFLAGS" = set; then
...@@ -1458,10 +1458,11 @@ changequote([, ]) ...@@ -1458,10 +1458,11 @@ changequote([, ])
AC_MSG_RESULT($enable_cshadow_headers) AC_MSG_RESULT($enable_cshadow_headers)
dnl Option parsed, now set things appropriately dnl Option parsed, now set things appropriately
dnl CSHADOWFLAGS is currently unused, but may be useful in the future. dnl NB: these things may be duplicated in c++config.h as well.
case "$enable_cshadow_headers" in case "$enable_cshadow_headers" in
yes) yes)
CSHADOWFLAGS="" CSHADOWFLAGS="-fno-builtin"
AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
;; ;;
no) no)
CSHADOWFLAGS="" CSHADOWFLAGS=""
......
...@@ -33,10 +33,12 @@ ...@@ -33,10 +33,12 @@
// The current version of the C++ library in compressed ISO date format. // The current version of the C++ library in compressed ISO date format.
#define __GLIBCPP__ 20000911 #define __GLIBCPP__ 20000911
// By enabling this, __USE_ISOC99 is also enabled, along with other // By enabling this, all GNU extensions are enabled.
// bits like POSIX, SVID, X/Open and GNU extensions.
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
// By enabling this, all ISO C99, ISO C9X functionality is enabled.
#define _ISOC99_SOURCE 1
// This flag controls the error handling in string, and perhaps other // This flag controls the error handling in string, and perhaps other
// bits as time goes on: check out bits/basic_string.h for more // bits as time goes on: check out bits/basic_string.h for more
// info. It also helps alleviate the circular dependency between // info. It also helps alleviate the circular dependency between
......
...@@ -176,23 +176,23 @@ namespace std { ...@@ -176,23 +176,23 @@ namespace std {
static const char_type* static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a) find(const char_type* __s, size_t __n, const char_type& __a)
{ return static_cast<char*>(memchr(__s, __a, __n)); } { return static_cast<const char_type*>(memchr(__s, __a, __n)); }
static char_type* static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n) move(char_type* __s1, const char_type* __s2, size_t __n)
{ return static_cast<char*>(memmove(__s1, __s2, __n)); } { return static_cast<char_type*>(memmove(__s1, __s2, __n)); }
static char_type* static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n) copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return static_cast<char*>(memcpy(__s1, __s2, __n)); } { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }
static char_type* static char_type*
assign(char_type* __s, size_t __n, char_type __a) assign(char_type* __s, size_t __n, char_type __a)
{ return static_cast<char*>(memset(__s, __a, __n)); } { return static_cast<char_type*>(memset(__s, __a, __n)); }
static char_type static char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ return static_cast<char>(__c); } { return static_cast<char_type>(__c); }
// To keep both the byte 0xff and the eof symbol 0xffffffff // To keep both the byte 0xff and the eof symbol 0xffffffff
// from ending up as 0xffffffff. // from ending up as 0xffffffff.
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos #include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos
#include <bits/stl_string_fwd.h>// For string. #include <bits/stl_string_fwd.h>// For string.
#include <bits/std_cstdio.h> // For SEEK_SET, SEEK_CUR, SEEK_END #include <bits/std_cstdio.h> // For SEEK_SET, SEEK_CUR, SEEK_END
# include <bits/localefwd.h> // For class locale #include <bits/localefwd.h> // For class locale
#include <bits/ios_base.h> // For ios_base declarations. #include <bits/ios_base.h> // For ios_base declarations.
#include <bits/std_streambuf.h> #include <bits/std_streambuf.h>
#include <bits/basic_ios.h> #include <bits/basic_ios.h>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define _CPP_IOSFWD 1 #define _CPP_IOSFWD 1
#include <bits/c++config.h> #include <bits/c++config.h>
#include <bits/std_cwchar.h> //For mbstate_t #include <bits/std_cwchar.h> // For mbstate_t
namespace std { namespace std {
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
// Include support for 'long long' and 'unsigned long long'. // Include support for 'long long' and 'unsigned long long'.
#undef _GLIBCPP_USE_LONG_LONG #undef _GLIBCPP_USE_LONG_LONG
// Include support for shadow headers, ie --enable-cshadow-headers.
#undef _GLIBCPP_USE_SHADOW_HEADERS
// Define if the host has a type mbstate_t defined in // Define if the host has a type mbstate_t defined in
// wchar.h, as required by 21.1.3.1. Some systems, namely // wchar.h, as required by 21.1.3.1. Some systems, namely
// hppa-hp-hpux10.20 do not meet this requirement, and must be worked // hppa-hp-hpux10.20 do not meet this requirement, and must be worked
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <bits/basic_file.h> #include <bits/basic_file.h>
#include <libioP.h> #include <libioP.h>
#include <fcntl.h> // Solaris needs for O_* macros
namespace std { namespace std {
......
...@@ -57,46 +57,45 @@ namespace std { ...@@ -57,46 +57,45 @@ namespace std {
typedef _IO_FILE __c_file_type; typedef _IO_FILE __c_file_type;
typedef _IO_wide_data __c_wfile_type; typedef _IO_wide_data __c_wfile_type;
extern "C" struct _IO_codecvt __c_libio_codecvt; extern "C" _IO_codecvt __c_libio_codecvt;
// from ios_base.h // from ios_base.h
struct __ios_flags struct __ios_flags
{ {
typedef short __int_type; typedef short __int_type;
static const __int_type _S_boolalpha = _IO_BAD_SEEN; static const __int_type _S_boolalpha = _IO_BAD_SEEN;
static const __int_type _S_dec = _IO_DEC; static const __int_type _S_dec = _IO_DEC;
static const __int_type _S_fixed = _IO_FIXED; static const __int_type _S_fixed = _IO_FIXED;
static const __int_type _S_hex = _IO_HEX; static const __int_type _S_hex = _IO_HEX;
static const __int_type _S_internal = _IO_INTERNAL; static const __int_type _S_internal = _IO_INTERNAL;
static const __int_type _S_left = _IO_LEFT; static const __int_type _S_left = _IO_LEFT;
static const __int_type _S_oct = _IO_OCT; static const __int_type _S_oct = _IO_OCT;
static const __int_type _S_right = _IO_RIGHT; static const __int_type _S_right = _IO_RIGHT;
static const __int_type _S_scientific = _IO_SCIENTIFIC; static const __int_type _S_scientific = _IO_SCIENTIFIC;
static const __int_type _S_showbase = _IO_SHOWBASE; static const __int_type _S_showbase = _IO_SHOWBASE;
static const __int_type _S_showpoint = _IO_SHOWPOINT; static const __int_type _S_showpoint = _IO_SHOWPOINT;
static const __int_type _S_showpos = _IO_SHOWPOS; static const __int_type _S_showpos = _IO_SHOWPOS;
static const __int_type _S_skipws = _IO_SKIPWS; static const __int_type _S_skipws = _IO_SKIPWS;
static const __int_type _S_unitbuf = _IO_UNITBUF; static const __int_type _S_unitbuf = _IO_UNITBUF;
static const __int_type _S_uppercase = _IO_UPPERCASE; static const __int_type _S_uppercase = _IO_UPPERCASE;
static const __int_type _S_adjustfield = _IO_LEFT static const __int_type _S_adjustfield = _IO_LEFT | _IO_RIGHT
| _IO_RIGHT | _IO_INTERNAL;
| _IO_INTERNAL; static const __int_type _S_basefield = _IO_DEC | _IO_OCT | _IO_HEX;
static const __int_type _S_basefield = _IO_DEC | _IO_OCT | _IO_HEX; static const __int_type _S_floatfield = _IO_SCIENTIFIC | _IO_FIXED;
static const __int_type _S_floatfield = _IO_SCIENTIFIC | _IO_FIXED;
// 27.4.2.1.3 Type ios_base::iostate // 27.4.2.1.3 Type ios_base::iostate
static const __int_type _S_badbit = _IO_BAD_SEEN; static const __int_type _S_badbit = _IO_BAD_SEEN;
static const __int_type _S_eofbit = _IO_EOF_SEEN; static const __int_type _S_eofbit = _IO_EOF_SEEN;
static const __int_type _S_failbit = _IO_ERR_SEEN; static const __int_type _S_failbit = _IO_ERR_SEEN;
// 27.4.2.1.4 Type openmode // 27.4.2.1.4 Type openmode
static const __int_type _S_app = _IOS_APPEND; static const __int_type _S_app = _IOS_APPEND;
static const __int_type _S_ate = _IOS_ATEND; static const __int_type _S_ate = _IOS_ATEND;
static const __int_type _S_bin = _IOS_BIN; static const __int_type _S_bin = _IOS_BIN;
static const __int_type _S_in = _IOS_INPUT; static const __int_type _S_in = _IOS_INPUT;
static const __int_type _S_out = _IOS_OUTPUT; static const __int_type _S_out = _IOS_OUTPUT;
static const __int_type _S_trunc = _IOS_TRUNC; static const __int_type _S_trunc = _IOS_TRUNC;
}; };
} }
......
// Locale support -*- C++ -*- // Locale support -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -33,6 +33,20 @@ ...@@ -33,6 +33,20 @@
// Information as gleaned from /usr/include/ctype.h // Information as gleaned from /usr/include/ctype.h
#if _GLIBCPP_USE_SHADOW_HEADERS
using _C_legacy::_ISspace;
using _C_legacy::_ISprint;
using _C_legacy::_IScntrl;
using _C_legacy::_ISupper;
using _C_legacy::_ISlower;
using _C_legacy::_ISalpha;
using _C_legacy::_ISdigit;
using _C_legacy::_ISpunct;
using _C_legacy::_ISxdigit;
using _C_legacy::_ISalnum;
using _C_legacy::_ISgraph;
#endif
struct ctype_base struct ctype_base
{ {
// Non-standard typedefs. // Non-standard typedefs.
......
...@@ -33,6 +33,12 @@ ...@@ -33,6 +33,12 @@
// Information as gleaned from /usr/include/ctype.h // Information as gleaned from /usr/include/ctype.h
#if _GLIBCPP_USE_SHADOW_HEADERS
using _C_legacy::__ctype_toupper;
using _C_legacy::__ctype_tolower;
using _C_legacy::__ctype_b;
#endif
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del), : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
_M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
...@@ -71,3 +77,12 @@ ...@@ -71,3 +77,12 @@
This source diff could not be displayed because it is too large. You can view the blob instead.
2000-09-27 benjamin kosnik <bkoz@haight.constant.com>
* libioP.h: Remove fcntl.h include.
2000-08-22 Benjamin Kosnik <bkoz@gnu.org> 2000-08-22 Benjamin Kosnik <bkoz@gnu.org>
* iofwide.c (_IO_fwide): Simplify, as nl_langinfo is assumed. * iofwide.c (_IO_fwide): Simplify, as nl_langinfo is assumed.
......
...@@ -19,15 +19,6 @@ ...@@ -19,15 +19,6 @@
#include <bits/std_cstddef.h> #include <bits/std_cstddef.h>
/* For use as part of glibc (native) or as part of libstdc++ (maybe
not glibc) */
#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1)
# ifdef _GLIBCPP_USE_WCHAR_T
# include <bits/std_cwchar.h>
typedef mbstate_t __mbstate_t;
# endif
#endif
#ifndef _WINT_T #ifndef _WINT_T
/* Integral type unchanged by default argument promotions that can /* Integral type unchanged by default argument promotions that can
hold any value corresponding to members of the extended character hold any value corresponding to members of the extended character
...@@ -36,9 +27,22 @@ typedef mbstate_t __mbstate_t; ...@@ -36,9 +27,22 @@ typedef mbstate_t __mbstate_t;
# define _WINT_T # define _WINT_T
typedef unsigned int wint_t; typedef unsigned int wint_t;
#endif #endif
#define __need_mbstate_t
#include <bits/std_cwchar.h> /* For use as part of glibc (native) or as part of libstdc++ (maybe
#define _G_size_t size_t not glibc) */
#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1)
# ifdef _GLIBCPP_USE_WCHAR_T
typedef struct
{
int count;
wint_t value;
}__mbstate_t;
# endif
#endif
typedef size_t _G_size_t;
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
typedef struct typedef struct
{ {
......
...@@ -78,3 +78,5 @@ _IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *)); ...@@ -78,3 +78,5 @@ _IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *));
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
...@@ -66,8 +66,10 @@ while read header; do ...@@ -66,8 +66,10 @@ while read header; do
// script. RTFM! // script. RTFM!
#ifndef _INCLUDED_CPP_${UPNAME}_ #ifndef _INCLUDED_CPP_${UPNAME}_
# define _INCLUDED_CPP_${UPNAME}_
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */ # ifdef _IN_C_LEGACY_ /* sub-included by a C header */
# pragma GCC system_header
# include_next <${header}> # include_next <${header}>
# else # else
...@@ -76,9 +78,11 @@ while read header; do ...@@ -76,9 +78,11 @@ while read header; do
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header
# include_next <${header}> # include_next <${header}>
} // close extern "C" } // close extern "C"
} // close namespace _C_legacy:: } // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# endif /* _IN_C_LEGACY_ */ # endif /* _IN_C_LEGACY_ */
#endif /* _INCLUDED_CPP_${UPNAME}_ */ #endif /* _INCLUDED_CPP_${UPNAME}_ */
......
...@@ -29,7 +29,23 @@ ...@@ -29,7 +29,23 @@
// no include guard here. // no include guard here.
# undef _SHADOW_NAME #ifdef _IN_C_LEGACY_ /* sub-included by a C header */
# define _SHADOW_NAME <cassert> // get out of the "legacy"
# include <bits/generic_shadow.h> } // close extern "C"
# undef _SHADOW_NAME } // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _ASSERT_NEED_C_LEGACY_
#endif
#include <cassert>
// expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
#ifdef _ASSERT_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _ASSERT_NEED_C_LEGACY_
#endif /* _ASSERT_NEED_C_LEGACY_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -31,13 +31,19 @@ ...@@ -31,13 +31,19 @@
// ISO C++ 14882: 19.2 Assertions // ISO C++ 14882: 19.2 Assertions
// //
// No include guards or wrappers on this header... #ifndef _CPP_CASSERT
// #define _CPP_CASSERT 1
// If <assert.h> sub-includes anything else that
// defines a global used in other headers, we are sunk. namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# pragma GCC system_header
# include_next <assert.h>
}
} // namespace _C_legacy
#undef _IN_C_LEGACY_
#endif
extern "C" {
# pragma GCC system_header
# include_next <assert.h>
}
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -33,30 +33,52 @@ ...@@ -33,30 +33,52 @@
#ifndef _CPP_CCTYPE #ifndef _CPP_CCTYPE
#define _CPP_CCTYPE 1 #define _CPP_CCTYPE 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <ctype.h> # include_next <ctype.h>
} }
inline int _CPP_isalnum_capture(int c) { return isalnum (c); } inline int
inline int _CPP_isalpha_capture(int c) { return isalpha (c); } _CPP_isalnum_capture(int c) { return isalnum(c); }
inline int _CPP_iscntrl_capture(int c) { return iscntrl (c); }
inline int _CPP_isdigit_capture(int c) { return isdigit (c); } inline int
inline int _CPP_isgraph_capture(int c) { return isgraph (c); } _CPP_isalpha_capture(int c) { return isalpha(c); }
inline int _CPP_islower_capture(int c) { return islower (c); }
inline int _CPP_isprint_capture(int c) { return isprint (c); } inline int
inline int _CPP_ispunct_capture(int c) { return ispunct (c); } _CPP_iscntrl_capture(int c) { return iscntrl(c); }
inline int _CPP_isspace_capture(int c) { return isspace (c); }
inline int _CPP_isupper_capture(int c) { return isupper (c); } inline int
inline int _CPP_isxdigit_capture(int c) { return isxdigit (c); } _CPP_isdigit_capture(int c) { return isdigit(c); }
inline int _CPP_tolower_capture(int c) { return tolower (c); } inline int
inline int _CPP_toupper_capture(int c) { return toupper (c); } _CPP_isgraph_capture(int c) { return isgraph(c); }
namespace _C_shadow { } inline int
} // close namespace ::_C_legacy:: _CPP_islower_capture(int c) { return islower(c); }
inline int
_CPP_isprint_capture(int c) { return isprint(c); }
inline int
_CPP_ispunct_capture(int c) { return ispunct(c); }
inline int
_CPP_isspace_capture(int c) { return isspace(c); }
inline int
_CPP_isupper_capture(int c) { return isupper(c); }
inline int
_CPP_isxdigit_capture(int c) { return isxdigit(c); }
inline int
_CPP_tolower_capture(int c) { return tolower(c); }
inline int
_CPP_toupper_capture(int c) { return toupper(c); }
} // namespace _C_legacy
# undef isalnum # undef isalnum
# undef isalpha # undef isalpha
...@@ -73,71 +95,51 @@ ...@@ -73,71 +95,51 @@
# undef tolower # undef tolower
# undef toupper # undef toupper
#if 0 /* these might not be necessary any more. 98-09-29 */ namespace std {
# undef _U inline int
# undef _L isalnum(int __c) { return _C_legacy::_CPP_isalnum_capture(__c); }
# undef _N
# undef _S
# undef _P
# undef _C
# undef _B
# undef _X
#endif
namespace _C_legacy { inline int
namespace _C_shadow { isalpha(int __c) { return _C_legacy::_CPP_isalpha_capture(__c); }
}
} inline int
namespace std { iscntrl(int __c) { return _C_legacy::_CPP_iscntrl_capture(__c); }
inline int isalnum(int __c) inline int
{ return ::_C_legacy::_CPP_isalnum_capture (__c); } isdigit(int __c) { return _C_legacy::_CPP_isdigit_capture(__c); }
inline int isalpha (int __c)
{ return ::_C_legacy::_CPP_isalpha_capture (__c); } inline int
inline int iscntrl (int __c) isgraph(int __c) { return _C_legacy::_CPP_isgraph_capture(__c); }
{ return ::_C_legacy::_CPP_iscntrl_capture (__c); }
inline int isdigit (int __c) inline int
{ return ::_C_legacy::_CPP_isdigit_capture (__c); } islower(int __c) { return _C_legacy::_CPP_islower_capture(__c); }
inline int isgraph (int __c)
{ return ::_C_legacy::_CPP_isgraph_capture (__c); } inline int
inline int islower (int __c) isprint(int __c) { return _C_legacy::_CPP_isprint_capture(__c); }
{ return ::_C_legacy::_CPP_islower_capture (__c); }
inline int isprint (int __c) inline int
{ return ::_C_legacy::_CPP_isprint_capture (__c); } ispunct(int __c) { return _C_legacy::_CPP_ispunct_capture(__c); }
inline int ispunct (int __c)
{ return ::_C_legacy::_CPP_ispunct_capture (__c); } inline int
inline int isspace (int __c) isspace(int __c) { return _C_legacy::_CPP_isspace_capture(__c); }
{ return ::_C_legacy::_CPP_isspace_capture (__c); }
inline int isupper (int __c)
{ return ::_C_legacy::_CPP_isupper_capture (__c); }
inline int isxdigit (int __c)
{ return ::_C_legacy::_CPP_isxdigit_capture (__c); }
inline int tolower (int __c)
{ return ::_C_legacy::_CPP_tolower_capture (__c); }
inline int toupper (int __c)
{ return ::_C_legacy::_CPP_toupper_capture (__c); }
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
using ::std::isalnum;
using ::std::isalpha;
using ::std::iscntrl;
using ::std::isdigit;
using ::std::isgraph;
using ::std::islower;
using ::std::isprint;
using ::std::ispunct;
using ::std::isspace;
using ::std::isupper;
using ::std::isxdigit;
using ::std::tolower;
using ::std::toupper;
}
}
inline int
isupper(int __c) { return _C_legacy::_CPP_isupper_capture(__c); }
inline int
isxdigit(int __c) { return _C_legacy::_CPP_isxdigit_capture(__c); }
inline int
tolower(int __c) { return _C_legacy::_CPP_tolower_capture(__c); }
inline int
toupper(int __c) { return _C_legacy::_CPP_toupper_capture(__c); }
} // namespace std
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
//// Copyright (C) 1997-1999 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,33 +33,24 @@ ...@@ -34,33 +33,24 @@
#ifndef _CPP_CERRNO #ifndef _CPP_CERRNO
#define _CPP_CERRNO 1 #define _CPP_CERRNO 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <errno.h> # include_next <errno.h>
} }
int& _CPP_errno_capture() { return errno; } // inline int&
// _CPP_errno_capture() { return errno; }
namespace _C_shadow { } } // namespace _C_legacy::
} // close namespace ::_C_legacy::
# undef errno # undef errno
# define errno ::_C_legacy::_CPP_errno_capture() //# define errno _C_legacy::_CPP_errno_capture()
// # undef EDOM
// # undef ERANGE
namespace _C_legacy { namespace std {
namespace _C_shadow { using _C_legacy::errno;
} }
}
namespace std {
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
}
}
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
......
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,152 +34,21 @@ ...@@ -34,152 +34,21 @@
#ifndef _CPP_CFLOAT #ifndef _CPP_CFLOAT
#define _CPP_CFLOAT 1 #define _CPP_CFLOAT 1
#if 0 /* 1998-09-29 */ namespace _C_legacy {
# ifdef __GLIBC__ extern "C" {
// For GNU libc we must also include this one:
# include <fenv.h>
# endif
#endif
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <float.h> # include_next <float.h>
}
inline int _CPP_FLT_ROUNDS_capture() { return FLT_ROUNDS; }
// FLT_RADIX is OK as-is.
// const int _CPP_FLT_RADIX_capture() { return FLT_RADIX; }
inline int _CPP_FLT_MANT_DIG_capture() { return FLT_MANT_DIG; }
inline int _CPP_DBL_MANT_DIG_capture() { return DBL_MANT_DIG; }
inline int _CPP_LDBL_MANT_DIG_capture() { return LDBL_MANT_DIG; }
inline int _CPP_FLT_DIG_capture() { return FLT_DIG; }
inline int _CPP_DBL_DIG_capture() { return DBL_DIG; }
inline int _CPP_LDBL_DIG_capture() { return LDBL_DIG; }
inline int _CPP_FLT_MIN_EXP_capture() { return FLT_MIN_EXP; }
inline int _CPP_DBL_MIN_EXP_capture() { return DBL_MIN_EXP; }
inline int _CPP_LDBL_MIN_EXP_capture() { return LDBL_MIN_EXP; }
inline int _CPP_FLT_MIN_10_EXP_capture() { return FLT_MIN_10_EXP; }
inline int _CPP_DBL_MIN_10_EXP_capture() { return DBL_MIN_10_EXP; }
inline int _CPP_LDBL_MIN_10_EXP_capture() { return LDBL_MIN_10_EXP; }
inline int _CPP_FLT_MAX_EXP_capture() { return FLT_MAX_EXP; }
inline int _CPP_DBL_MAX_EXP_capture() { return DBL_MAX_EXP; }
inline int _CPP_LDBL_MAX_EXP_capture() { return LDBL_MAX_EXP; }
inline int _CPP_FLT_MAX_10_EXP_capture() { return FLT_MAX_10_EXP; }
inline int _CPP_DBL_MAX_10_EXP_capture() { return DBL_MAX_10_EXP; }
inline int _CPP_LDBL_MAX_10_EXP_capture() { return LDBL_MAX_10_EXP; }
inline float _CPP_FLT_MAX_capture() { return FLT_MAX; }
inline double _CPP_DBL_MAX_capture() { return DBL_MAX; }
inline long double _CPP_LDBL_MAX_capture() { return LDBL_MAX; }
inline float _CPP_FLT_EPSILON_capture() { return FLT_EPSILON; }
inline double _CPP_DBL_EPSILON_capture() { return DBL_EPSILON; }
inline long double _CPP_LDBL_EPSILON_capture() { return LDBL_EPSILON; }
inline float _CPP_FLT_MIN_capture() { return FLT_MIN; }
inline double _CPP_DBL_MIN_capture() { return DBL_MIN; }
inline long double _CPP_LDBL_MIN_capture() { return LDBL_MIN; }
namespace _C_shadow { }
} // close namespace ::_C_legacy::
# undef FLT_ROUNDS
# define FLT_ROUNDS ::_C_legacy::_CPP_FLT_ROUNDS_capture()
// # undef FLT_RADIX // OK as-is.
# undef FLT_MANT_DIG
# define FLT_MANT_DIG ::_C_legacy::_CPP_FLT_MANT_DIG_capture()
# undef DBL_MANT_DIG
# define DBL_MANT_DIG ::_C_legacy::_CPP_DBL_MANT_DIG_capture()
# undef LDBL_MANT_DIG
# define LDBL_MANT_DIG ::_C_legacy::_CPP_LDBL_MANT_DIG_capture()
# undef FLT_DIG
# define FLT_DIG ::_C_legacy::_CPP_FLT_DIG_capture()
# undef DBL_DIG
# define DBL_DIG ::_C_legacy::_CPP_DBL_DIG_capture()
# undef LDBL_DIG
# define LDBL_DIG ::_C_legacy::_CPP_LDBL_DIG_capture()
# undef FLT_MIN_MIN_DIG
# define FLT_MIN_MIN_DIG ::_C_legacy::_CPP_FLT_MIN_MIN_DIG_capture()
# undef DBL_MIN_MIN_DIG
# define DBL_MIN_MIN_DIG ::_C_legacy::_CPP_DBL_MIN_MIN_DIG_capture()
# undef LDBL_MIN_MIN_DIG
# define LDBL_MIN_MIN_DIG ::_C_legacy::_CPP_LDBL_MIN_MIN_DIG_capture()
# undef FLT_MIN_EXP
# define FLT_MIN_EXP ::_C_legacy::_CPP_FLT_MIN_EXP_capture()
# undef DBL_MIN_EXP
# define DBL_MIN_EXP ::_C_legacy::_CPP_DBL_MIN_EXP_capture()
# undef LDBL_MIN_EXP
# define LDBL_MIN_EXP ::_C_legacy::_CPP_LDBL_MIN_EXP_capture()
# undef FLT_MIN_10_EXP
# define FLT_MIN_10_EXP ::_C_legacy::_CPP_FLT_MIN_10_EXP_capture()
# undef DBL_MIN_10_EXP
# define DBL_MIN_10_EXP _::_C_legacy::CPP_DBL_MIN_10_EXP_capture()
# undef LDBL_MIN_10_EXP
# define LDBL_MIN_10_EXP ::_C_legacy::_CPP_LDBL_MIN_10_EXP_capture()
# undef FLT_MAX_EXP
# define FLT_MAX_EXP ::_C_legacy::_CPP_FLT_MAX_EXP_capture()
# undef DBL_MAX_EXP
# define DBL_MAX_EXP ::_C_legacy::_CPP_DBL_MAX_EXP_capture()
# undef LDBL_MAX_EXP
# define LDBL_MAX_EXP ::_C_legacy::_CPP_LDBL_MAX_EXP_capture()
# undef FLT_MAX_10_EXP
# define FLT_MAX_10_EXP ::_C_legacy::_CPP_FLT_MAX_10_EXP_capture()
# undef DBL_MAX_10_EXP
# define DBL_MAX_10_EXP ::_C_legacy::_CPP_DBL_MAX_10_EXP_capture()
# undef LDBL_MAX_10_EXP
# define LDBL_MAX_10_EXP ::_C_legacy::_CPP_LDBL_MAX_10_EXP_capture()
# undef FLT_MAX
# define FLT_MAX ::_C_legacy::_CPP_FLT_MAX_capture()
# undef DBL_MAX
# define DBL_MAX ::_C_legacy::_CPP_DBL_MAX_capture()
# undef LDBL_MAX
# define LDBL_MAX ::_C_legacy::_CPP_LDBL_MAX_capture()
# undef FLT_EPSILON
# define FLT_EPSILON ::_C_legacy::_CPP_FLT_EPSILON_capture()
# undef DBL_EPSILON
# define DBL_EPSILON ::_C_legacy::_CPP_DBL_EPSILON_capture()
# undef LDBL_EPSILON
# define LDBL_EPSILON ::_C_legacy::_CPP_LDBL_EPSILON_capture()
# undef FLT_MIN
# define FLT_MIN ::_C_legacy::_CPP_FLT_MIN_capture()
# undef DBL_MIN
# define DBL_MIN ::_C_legacy::_CPP_DBL_MIN_capture()
# undef LDBL_MIN
# define LDBL_MIN ::_C_legacy::_CPP_LDBL_MIN_capture()
namespace _C_legacy {
namespace _C_shadow {
}
}
namespace std {
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
}
} }
} // namespace _C_legacy
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -32,33 +32,26 @@ ...@@ -32,33 +32,26 @@
// //
#ifndef _CPP_CLIMITS #ifndef _CPP_CLIMITS
#define _CPP_CLIMTIS 1 #define _CPP_CLIMTIS 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <limits.h> # include_next <limits.h>
}
namespace _C_shadow { }
} // close namespace ::_C_legacy::
// Note: there is not much for this wrapper to do besides hiding
// vendor-extension names and (perhaps) replacing one or other
// macro with a larger value.
// #undef MB_LEN_MAX
// #define MB_LEN_MAX 16 /* or something */
namespace std {
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
}
} }
} // namespace _C_legacy
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,76 +34,37 @@ ...@@ -34,76 +34,37 @@
#ifndef _CPP_CLOCALE #ifndef _CPP_CLOCALE
#define _CPP_CLOCALE 1 #define _CPP_CLOCALE 1
# include <bits/std_cstddef.h> /* pick up NULL */ # include <bits/std_cstddef.h>
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <locale.h> # include_next <locale.h>
} }
typedef struct lconv _CPP_lconv_capture; typedef lconv _CPP_lconv_capture;
const int _CPP_LC_ALL_capture = LC_ALL; } // namespace _C_legacy
const int _CPP_LC_COLLATE_capture = LC_COLLATE;
const int _CPP_LC_CTYPE_capture = LC_CTYPE;
const int _CPP_LC_MONETARY_capture = LC_MONETARY;
const int _CPP_LC_NUMERIC_capture = LC_NUMERIC;
const int _CPP_LC_TIME_capture = LC_TIME;
#if 0 /* XXX need proper macro guard for this common extension. */
const int _CPP_LC_MESSAGES_capture = LC_MESSAGES;
#endif
namespace _C_shadow { }
} // close namespace ::_C_legacy::
// # undef NULL
// # define NULL 0 /* handled in <cstddef> */
# undef LC_ALL
# define LC_ALL ::_C_legacy::_CPP_LC_ALL_capture
# undef LC_COLLATE
# define LC_COLLATE ::_C_legacy::_CPP_LC_COLLATE_capture
# undef LC_CTYPE
# define LC_CTYPE ::_C_legacy::_CPP_LC_CTYPE_capture
# undef LC_MONETARY
# define LC_MONETARY ::_C_legacy::_CPP_LC_MONETARY_capture
# undef LC_NUMERIC
# define LC_NUMERIC ::_C_legacy::_CPP_LC_NUMERIC_capture
# undef LC_TIME
# define LC_TIME ::_C_legacy::_CPP_LC_TIME_capture
#if 0 /* XXX need proper macro guard for this common extension. */
# undef LC_MESSAGES
# define LC_MESSAGES ::_C_legacy::_CPP_LC_MESSAGES_capture
#endif
# undef lconv # undef lconv
# undef setlocale # undef setlocale
# undef localeconv # undef localeconv
namespace _C_legacy { namespace std {
namespace _C_shadow { // Adopt C names into std::
} struct lconv : _C_legacy::_CPP_lconv_capture { };
}
namespace std {
// Adopt C names into std:: using _C_legacy::setlocale;
using ::_C_legacy::setlocale;
inline lconv*
localeconv() { return reinterpret_cast<lconv*>(_C_legacy::localeconv()); }
} // namespace std
# undef _IN_C_LEGACY_
#endif
// note: still a POD type:
struct lconv : ::_C_legacy::_CPP_lconv_capture { };
inline lconv* localeconv()
{ return reinterpret_cast<lconv*>(::_C_legacy::localeconv()); }
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
using ::std::lconv;
using ::std::localeconv;
}
}
# undef _IN_C_LEGACY_
#endif /* _CPP_CLOCALE */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,42 +34,30 @@ ...@@ -34,42 +34,30 @@
#ifndef _CPP_CSETJMP #ifndef _CPP_CSETJMP
#define _CPP_CSETJMP 1 #define _CPP_CSETJMP 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <setjmp.h> # include_next <setjmp.h>
} }
typedef jmp_buf _CPP_jmp_buf_capture; inline int
inline int _CPP_setjmp_capture(jmp_buf __jb) { return setjmp(__jb); } _CPP_setjmp_capture(jmp_buf __jb) { return setjmp(__jb); }
} // namespace _C_legacy
namespace _C_shadow { }
} // close namespace ::_C_legacy::
# undef jmp_buf # undef jmp_buf
# undef setjmp # undef setjmp
# define setjmp(__jb) ::_C_legacy::_CPP_setjmp_capture(__jb) # define setjmp(__jb) ::_C_legacy::_CPP_setjmp_capture(__jb)
# undef longjmp # undef longjmp
namespace _C_legacy { namespace std {
namespace _C_shadow { // Adopt C names into std::
typedef ::_C_legacy::_CPP_jmp_buf_capture jmp_buf; using _C_legacy::jmp_buf;
} using _C_legacy::longjmp;
} } // namespace std
namespace std {
// Adopt C names into std::
using ::_C_legacy::_C_shadow::jmp_buf;
using ::_C_legacy::longjmp;
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
}
}
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,78 +34,34 @@ ...@@ -34,78 +34,34 @@
#ifndef _CPP_CSIGNAL #ifndef _CPP_CSIGNAL
#define _CPP_CSIGNAL 1 #define _CPP_CSIGNAL 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
// XXX
# undef __need_sig_atomic_t
# undef __need_sigset_t
# pragma GCC system_header # pragma GCC system_header
# include_next <signal.h> # include_next <signal.h>
typedef void (*_CPP_CSIGFUN_capture)(int); // a C function pointer }
typedef sig_atomic_t _CPP_sig_atomic_t_capture; } // namespace _C_legacy
const _CPP_CSIGFUN_capture _CPP_SIG_DFL_capture = SIG_DFL;
const _CPP_CSIGFUN_capture _CPP_SIG_ERR_capture = SIG_ERR;
const _CPP_CSIGFUN_capture _CPP_SIG_IGN_capture = SIG_IGN;
}
const int _CPP_SIGABRT_capture = SIGABRT;
const int _CPP_SIGFPE_capture = SIGFPE;
const int _CPP_SIGILL_capture = SIGILL;
const int _CPP_SIGINT_capture = SIGINT;
const int _CPP_SIGSEGV_capture = SIGSEGV;
const int _CPP_SIGTERM_capture = SIGTERM;
namespace _C_shadow { }
} // close namespace ::_C_legacy::
# undef sig_atomic_t # undef sig_atomic_t
# undef raise # undef raise
# undef signal # undef signal
# undef SIG_DFL
# define SIG_DFL \
reinterpret_cast<void (*)(int)>(::_C_legacy::_CPP_SIG_DFL_capture)
# undef SIG_ERR
# define SIG_ERR \
reinterpret_cast<void (*)(int)>(::_C_legacy::_CPP_SIG_ERR_capture)
# undef SIG_IGN
# define SIG_IGN \
reinterpret_cast<void (*)(int)>(::_C_legacy::_CPP_SIG_IGN_capture)
# undef SIGABRT
# define SIGABRT ::_C_legacy::_CPP_SIGABRT_capture
# undef SIGFPE
# define SIGFPE ::_C_legacy::_CPP_SIGFPE_capture
# undef SIGILL
# define SIGILL ::_C_legacy::_CPP_SIGILL_capture
# undef SIGINT
# define SIGINT ::_C_legacy::_CPP_SIGINT_capture
# undef SIGSEGV
# define SIGSEGV ::_C_legacy::_CPP_SIGSEGV_capture
# undef SIGTERM
# define SIGTERM ::_C_legacy::_CPP_SIGTERM_capture
namespace _C_legacy {
namespace _C_shadow {
typedef ::_C_legacy::_CPP_sig_atomic_t_capture sig_atomic_t;
}
}
namespace std {
// Adopt C names into std:: namespace std {
using ::_C_legacy::_C_shadow::sig_atomic_t; // Adopt C names into std::
using ::_C_legacy::raise; using _C_legacy::sig_atomic_t;
using _C_legacy::raise;
inline void (*signal(int __sig, void (* __fun)(int)))(int) using _C_legacy::signal;
{ return reinterpret_cast<void (*)(int)>( } // namespace std
::_C_legacy::signal(__sig,
reinterpret_cast< ::_C_legacy::_CPP_CSIGFUN_capture>(__fun)));
}
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
using ::std::signal;
}
}
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,65 +34,19 @@ ...@@ -34,65 +34,19 @@
#ifndef _CPP_CSTDARG #ifndef _CPP_CSTDARG
#define _CPP_CSTDARG 1 #define _CPP_CSTDARG 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <stdarg.h> # include_next <stdarg.h>
} }
typedef va_list _CPP_va_list_capture; } // namespace _C_legacy
# ifdef __GNUC__
# elif
template <class T>
inline void _CPP_va_start_capture(va_list& __val, T& __v)
{ va_start(__val, __v); }
template <class T>
inline void _CPP_va_arg_capture(va_list& __val, T& __arg)
{ va_start(__val, __arg); }
template <class T>
inline T& _CPP_va_arg_capture(va_list& __val)
{ return va_arg(__val, T); }
template <class T>
inline void _CPP_va_end(va_list& __val)
{ va_end(__val); }
# endif
// typedef size_t _CPP_size_t_capture; // handled in <cstddef>
namespace _C_shadow { }
} // close namespace ::_C_legacy::
# ifdef __GNUC__
# undef va_list
using _C_legacy::__gnuc_va_list;
# elif /* probably must be tailored for each compiler, as above. */
# undef va_list
# undef va_start
# define va_start(a,b) ::_C_legacy::_CPP_va_start_capture(a,b)
# undef va_arg
# define va_arg(a,b) ::_C_legacy::_CPP_va_arg_capture<b>(a)
# undef va_end
# define va_end(a) ::_C_legacy::_CPP_va_end_capture(a)
# endif # undef va_list
namespace _C_legacy { namespace std {
namespace _C_shadow { using _C_legacy::va_list;
typedef ::_C_legacy::_CPP_va_list_capture va_list; } // namespace std
}
}
namespace std {
using ::_C_legacy::_C_shadow::va_list;
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
}
}
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
......
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,45 +34,27 @@ ...@@ -34,45 +34,27 @@
#ifndef _CPP_CSTDDEF #ifndef _CPP_CSTDDEF
#define _CPP_CSTDDEF 1 #define _CPP_CSTDDEF 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <stddef.h> # include_next <stddef.h>
} }
typedef ptrdiff_t _CPP_ptrdiff_t_capture; } // namespace _C_legacy
typedef size_t _CPP_size_t_capture;
namespace _C_shadow { }
} // close namespace ::_C_legacy::
# undef ptrdiff_t # undef ptrdiff_t
# undef size_t # undef size_t
# undef wchar_t
# undef NULL
# define NULL 0
// # undef offsetof
namespace _C_legacy {
namespace _C_shadow {
typedef ::_C_legacy::_CPP_ptrdiff_t_capture ptrdiff_t;
typedef ::_C_legacy::_CPP_size_t_capture size_t;
}
}
namespace std {
// Adopt C names into std::
using ::_C_legacy::_C_shadow::ptrdiff_t;
using ::_C_legacy::_C_shadow::size_t;
} // close namespace std:: namespace std {
using _C_legacy::ptrdiff_t;
using _C_legacy::size_t;
} // namespace std
namespace _C_legacy {
namespace _C_shadow {
}
}
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
#ifndef _CPP_CSTDLIB #ifndef _CPP_CSTDLIB
#define _CPP_CSTDLIB 1 #define _CPP_CSTDLIB 1
# include <bits/std_cstddef.h> /* pick up NULL, size_t */ # include <bits/c++config.h>
# include <bits/std_cstddef.h>
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
...@@ -47,36 +48,20 @@ namespace _C_legacy { ...@@ -47,36 +48,20 @@ namespace _C_legacy {
# include_next <stdlib.h> # include_next <stdlib.h>
typedef int (*_C_cmp_fun_ptr)(const void*, const void*); // C fn ptr typedef int (*_C_cmp_fun_ptr)(const void*, const void*); // C fn ptr
} }
const int _CPP_EXIT_SUCCESS_capture = int(EXIT_SUCCESS);
const int _CPP_EXIT_FAILURE_capture = int(EXIT_FAILURE);
const int _CPP_RAND_MAX_capture = int(RAND_MAX);
inline int _CPP_MB_CUR_MAX_capture() { return int(MB_CUR_MAX); }
// typedef size_t _CPP_size_t_capture;
// typedef wchar_t _CPP_wchar_t_capture;
typedef div_t _CPP_div_t_capture; typedef div_t _CPP_div_t_capture;
typedef ldiv_t _CPP_ldiv_t_capture; typedef ldiv_t _CPP_ldiv_t_capture;
namespace _C_shadow { # if _GLIBCPP_HAVE_LLDIV_T
} typedef lldiv_t _CPP_lldiv_t_capture;
} // namespace _C_legacy:: # endif
} // namespace _C_legacy
# undef size_t # undef size_t
# undef wchar_t # undef wchar_t
# undef div_t # undef div_t
# undef ldiv_t # undef ldiv_t
// <cstddef>
// # undef NULL
// # define NULL 0
# undef EXIT_SUCCESS
# define EXIT_SUCCESS (::_C_legacy::_CPP_EXIT_SUCCESS_capture)
# undef EXIT_FAILURE
# define EXIT_FAILURE (::_C_legacy::_CPP_EXIT_FAILURE_capture)
# undef RAND_MAX
# define RAND_MAX (::_C_legacy::_CPP_RAND_MAX_capture)
# undef MB_CUR_MAX
# define MB_CUR_MAX (::_C_legacy::_CPP_MB_CUR_MAX_capture())
# undef atof # undef atof
# undef atoi # undef atoi
# undef atol # undef atol
...@@ -110,134 +95,95 @@ namespace _C_legacy { ...@@ -110,134 +95,95 @@ namespace _C_legacy {
# undef mbstowcs # undef mbstowcs
# undef wcstombs # undef wcstombs
namespace _C_legacy { namespace std {
namespace _C_shadow { struct div_t : _C_legacy::_CPP_div_t_capture { };
// these come from <cstddef> struct ldiv_t : _C_legacy::_CPP_ldiv_t_capture { };
// typedef ::_C_legacy::_CPP_size_t_capture size_t;
// typedef ::_C_legacy::_CPP_wchar_t_capture wchar_t; #ifdef _GLIBCPP_USE_LONG_LONG
} # ifdef _GLIBCPP_HAVE_LLDIV_T
} struct lldiv_t : _C_legacy::_CPP_lldiv_t_captur { };
namespace std { # else
struct lldiv_t
// Adopt C names into std:: {
// using ::_C_legacy::_C_shadow::size_t; long long quot;
// using ::_C_legacy::_C_shadow::wchar_t; long long rem;
};
typedef ::_C_legacy::_CPP_div_t_capture _CPP_div_t; # endif
struct div_t : _CPP_div_t {};
typedef ::_C_legacy::_CPP_ldiv_t_capture _CPP_ldiv_t;
struct ldiv_t : _CPP_ldiv_t {};
// note: div_t and ldiv_t are still POD types
// EXIT_SUCCESS, EXIT_FAILURE, RAND_MAX, MB_CUR_MAX, NULL
using ::_C_legacy::atof;
using ::_C_legacy::atoi;
using ::_C_legacy::atol;
using ::_C_legacy::strtod;
using ::_C_legacy::strtol;
using ::_C_legacy::strtoul;
using ::_C_legacy::rand;
using ::_C_legacy::srand;
using ::_C_legacy::calloc;
using ::_C_legacy::free;
using ::_C_legacy::malloc;
using ::_C_legacy::realloc;
void abort(); // XXX must define this correctly for C++.
#define _FUN_OVERLOAD_BUG
// extern "C" funs declared void f(int (*)()) overload OK with C++ funs,
// but not if declared void f(int (*)(void)).
#if !defined(__GNUC__) || !defined(_FUN_OVERLOAD_BUG)
using ::_C_legacy::atexit; // XXX must redefine this one!
#endif #endif
int atexit(void (*)()); // XXX must define this.
// More precisely, we need an extern "C" atexit() that
// implements the correct semantics, but hides the link-name
// atexit found in the C library, and a C++ atexit too. If
// C and C++ calling conventions differ, each pointer must
// be marked to be called using the proper convention.
void exit(int __i) // XXX must define correctly for C++, like atexit(). using _C_legacy::atof;
{ ::_C_legacy::exit(__i); } using _C_legacy::atoi;
using _C_legacy::atol;
using _C_legacy::strtod;
using _C_legacy::strtol;
using _C_legacy::strtoul;
using _C_legacy::rand;
using _C_legacy::srand;
using _C_legacy::calloc;
using _C_legacy::free;
using _C_legacy::malloc;
using _C_legacy::realloc;
using _C_legacy::abort;
using _C_legacy::atexit;
using _C_legacy::exit;
using _C_legacy::bsearch;
using _C_legacy::qsort;
using _C_legacy::getenv;
using _C_legacy::system;
using _C_legacy::mbtowc;
using _C_legacy::wctomb;
using _C_legacy::mbstowcs;
using _C_legacy::wcstombs;
using ::_C_legacy::getenv; #ifdef _GLIBCPP_USE_LONG_LONG
using ::_C_legacy::system; using _C_legacy::strtoll;
using _C_legacy::strtoull;
using _C_legacy::strtof;
using _C_legacy::strtold;
#endif
// XXX note that the raw conversion between C and C++ function using _C_legacy::mblen;
// pointers may not be portable to some targets; those targets need
// a forwarding function.
#if !defined(__GNUC__) || !defined(_FUN_OVERLOAD_BUG) inline int
using ::_C_legacy::bsearch; // overload abs(int __x) { return __x >= 0 ? __x : -__x; }
#endif
inline void* bsearch(const void* __key, const void* __base, size_t __n,
size_t __size, int (*__cmp)(const void*, const void*))
{ return ::_C_legacy::bsearch(__key,__base,__n,__size,
reinterpret_cast< ::_C_legacy::_C_cmp_fun_ptr>(__cmp)); } // XXX
#if !defined(__GNUC__) || !defined(_FUN_OVERLOAD_BUG) inline div_t
using ::_C_legacy::qsort; // overload div(int __n, int __d)
#endif { div_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
inline void qsort(void* __base, size_t __n, size_t __size,
int (*__cmp)(const void*, const void*))
{ return ::_C_legacy::qsort(__base,__n,__size,
reinterpret_cast< ::_C_legacy::_C_cmp_fun_ptr>(__cmp)); } // XXX
inline int abs(int __x)
{ return __x >= 0 ? __x : -__x; }
inline div_t div(int __n, int __d)
{ div_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
inline long labs(long __x)
{ return __x >= 0 ? __x : -__x; }
inline long abs(long __x)
{ return __x >= 0 ? __x : -__x; }
inline ldiv_t ldiv(long __n, long __d)
{ ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
inline ldiv_t div(long __n, long __d)
{ ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
#ifdef _GLIBCPP_USE_LONG_LONG
inline long long llabs(long long __x)
{ return __x >= 0 ? __x : -__x; }
inline long long abs(long long __x)
{ return __x >= 0 ? __x : -__x; }
inline lldiv_t lldiv(long long __n, long long __d)
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
inline lldiv_t div(long long __n, long long __d)
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
#endif
using ::_C_legacy::mblen; inline long
using ::_C_legacy::mbtowc;; labs(long __x) { return __x >= 0 ? __x : -__x; }
using ::_C_legacy::wctomb;
using ::_C_legacy::mbstowcs; inline long
using ::_C_legacy::wcstombs; abs(long __x) { return __x >= 0 ? __x : -__x; }
inline ldiv_t
ldiv(long __n, long __d)
{ ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
inline ldiv_t
div(long __n, long __d)
{ ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
using ::std::div_t;
using ::std::ldiv_t;
using ::std::abort;
using ::std::atexit;
using ::std::exit;
using ::std::bsearch;
using ::std::qsort;
using ::std::abs;
using ::std::div;
using ::std::labs;
using ::std::ldiv;
#ifdef _GLIBCPP_USE_LONG_LONG #ifdef _GLIBCPP_USE_LONG_LONG
using ::std::llabs; inline long long
using ::std::lldiv; llabs(long long __x) { return __x >= 0 ? __x : -__x; }
#endif
} inline long long
} abs(long long __x) { return __x >= 0 ? __x : -__x; }
inline lldiv_t
lldiv(long long __n, long long __d)
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
inline lldiv_t
div(long long __n, long long __d)
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
#endif
} // namespace std
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
......
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,30 +34,28 @@ ...@@ -34,30 +34,28 @@
#ifndef _CPP_CTIME #ifndef _CPP_CTIME
#define _CPP_CTIME 1 #define _CPP_CTIME 1
# include <bits/std_cstddef.h> /* pick up size_t, NULL */ # include <bits/std_cstddef.h>
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
// XXX
// glibc 2.1.x time.h is on crack
# undef __need_time_t
# undef __need_clock_t
# undef __need_timespec
# include_next <time.h> # include_next <time.h>
} }
inline clock_t _CPP_CLOCKS_PER_SEC_capture()
{ return CLOCKS_PER_SEC; } typedef clock_t _CPP_clock_t_capture;
// typedef size_t _CPP_size_t_capture; // handled in <cstddef> typedef time_t _CPP_time_t_capture;
typedef clock_t _CPP_clock_t_capture; typedef tm _CPP_tm_capture;
typedef time_t _CPP_time_t_capture;
typedef struct tm _CPP_tm_capture; } // namespace _C_legacy
namespace _C_shadow { }
} // close namespace ::_C_legacy::
// # undef NULL
// # define NULL 0 /* handled in <cstddef> */
# undef CLOCKS_PER_SEC
# define CLOCKS_PER_SEC (::_C_legacy::_CPP_CLOCKS_PER_SEC_capture())
# undef size_t /* handled in <cstddef> */
# undef clock_t # undef clock_t
# undef time_t # undef time_t
# undef tm # undef tm
...@@ -71,57 +69,38 @@ ...@@ -71,57 +69,38 @@
# undef localtime # undef localtime
# undef strftime # undef strftime
namespace _C_legacy { namespace std {
namespace _C_shadow {
// typedef ::_C_legacy::_CPP_size_t_capture size_t; // Adopt C names into std::
typedef ::_C_legacy::_CPP_clock_t_capture clock_t; typedef _C_legacy::_CPP_clock_t_capture clock_t;
typedef ::_C_legacy::_CPP_time_t_capture time_t; typedef _C_legacy::_CPP_time_t_capture time_t;
} struct tm : _C_legacy::_CPP_tm_capture { };
}
namespace std { using _C_legacy::clock;
using _C_legacy::difftime;
// Adopt C names into std:: using _C_legacy::mktime;
// using ::_C_legacy::_C_shadow::size_t; using _C_legacy::time;
using ::_C_legacy::_C_shadow::clock_t; using _C_legacy::ctime;
using ::_C_legacy::_C_shadow::time_t;
inline char*
// note: still a POD type: asctime(const tm* __t)
struct tm : ::_C_legacy::_CPP_tm_capture { }; { return _C_legacy::asctime(static_cast<_C_legacy::_CPP_tm_capture const*>(__t)); }
using ::_C_legacy::clock; inline tm*
using ::_C_legacy::difftime; gmtime(time_t const* __tp)
using ::_C_legacy::mktime; { return reinterpret_cast<tm*>(_C_legacy::gmtime(__tp)); }
using ::_C_legacy::time;
inline tm*
inline char* asctime(const tm* __tp) localtime(const time_t* __tp)
{ return ::_C_legacy::asctime( { return reinterpret_cast<tm*>(_C_legacy::localtime(__tp)); }
static_cast< ::_C_legacy::_CPP_tm_capture const*>(__tp)); }
inline size_t
using ::_C_legacy::ctime; strftime(char* __buf, size_t __maxsz, char const* __fmt, tm const* __tp)
{ return _C_legacy::strftime(__buf, __maxsz, __fmt,
inline tm* gmtime(time_t const* __tp) static_cast<_C_legacy::_CPP_tm_capture const*>(__tp)); }
{ return reinterpret_cast<tm*>(::_C_legacy::gmtime(__tp)); }
} // namespace std
inline tm* localtime(const time_t* __tp)
{ return reinterpret_cast<tm*>(::_C_legacy::localtime(__tp)); }
inline size_t strftime(char* __buf, size_t __maxsz,
char const* __fmt, tm const* __tp)
{ return ::_C_legacy::strftime(__buf, __maxsz, __fmt,
static_cast< ::_C_legacy::_CPP_tm_capture const*>(__tp)); }
} // close namespace std::
namespace _C_legacy {
namespace _C_shadow {
using ::std::tm;
using ::std::asctime;
using ::std::gmtime;
using ::std::localtime;
using ::std::strftime;
}
}
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
......
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,36 +28,25 @@ ...@@ -28,36 +28,25 @@
// the GNU General Public License. // the GNU General Public License.
// //
// ISO C++ 14882: ??? // ISO C++ 14882:
// //
// XXX this is not complete
#ifndef _CPP_CWCTYPE #ifndef _CPP_CWCTYPE
#define _CPP_CWCTYPE 1 #define _CPP_CWCTYPE 1
# include <bits/std_cwchar.h> /* pick up wint_t, WEOF */ # include <bits/std_cwchar.h>
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <wctype.h> # include_next <wctype.h>
} }
typedef wctype_t _CPP_wctype_t_capture; } // namespace _C_legacy
typedef wctrans_t _CPP_wctrans_t_capture;
// XXX probably should capture defs of the "is" functions.
namespace _C_shadow { }
} // close namespace ::_C_legacy::
# undef size_t /* handled in <cstddef> */
# undef wchar_t
# undef wint_t
# undef wctype_t # undef wctype_t
# undef wctrans_t # undef wctrans_t
// # undef WEOF
# undef iswalpha # undef iswalpha
# undef iswupper # undef iswupper
# undef iswlower # undef iswlower
...@@ -70,49 +59,71 @@ ...@@ -70,49 +59,71 @@
# undef iswgraph # undef iswgraph
# undef iswcntrl # undef iswcntrl
# undef iswctype # undef iswctype
# undef towctrans
# undef towlower # undef towlower
# undef towupper # undef towupper
# undef wctrans
# undef wctype
// SunOS macros namespace std {
# undef iswascii using _C_legacy::wctype_t;
# undef iscodeset0 using _C_legacy::wctrans_t;
# undef iscodeset1
# undef iscodeset2 inline int
# undef iscodeset3 iswalpha(wint_t __wc) { return _C_legacy::iswalpha(__wc); }
namespace _C_legacy { inline int
namespace _C_shadow { iswupper(wint_t __wc) { return _C_legacy::iswupper(__wc); }
typedef ::_C_legacy::_CPP_wctype_t_capture wctype_t;
typedef ::_C_legacy::_CPP_wctrans_t_capture wctrans_t; inline int
} iswlower(wint_t __wc) { return _C_legacy::iswlower(__wc); }
}
namespace std { inline int
using ::_C_legacy::_C_shadow::wctype_t; iswdigit(wint_t __wc) { return _C_legacy::iswdigit(__wc); }
using ::_C_legacy::_C_shadow::wctrans_t;
inline int
// XXX probably should capture these to inlines. iswxdigit(wint_t __wc) { return _C_legacy::iswxdigit(__wc); }
using ::_C_legacy::iswalpha;
using ::_C_legacy::iswupper; inline int
using ::_C_legacy::iswlower; iswalnum(wint_t __wc) { return _C_legacy::iswalnum(__wc); }
using ::_C_legacy::iswdigit;
using ::_C_legacy::iswxdigit; inline int
using ::_C_legacy::iswalnum; iswspace(wint_t __wc) { return _C_legacy::iswspace(__wc); }
using ::_C_legacy::iswspace;
using ::_C_legacy::iswpunct; inline int
using ::_C_legacy::iswprint; iswpunct(wint_t __wc) { return _C_legacy::iswpunct(__wc); }
using ::_C_legacy::iswgraph;
using ::_C_legacy::iswcntrl; inline int
using ::_C_legacy::iswctype; iswprint(wint_t __wc) { return _C_legacy::iswprint(__wc); }
using ::_C_legacy::towlower;
using ::_C_legacy::towupper; inline int
iswgraph(wint_t __wc) { return _C_legacy::iswgraph(__wc); }
} // close namespace std::
inline int
iswcntrl(wint_t __wc) { return _C_legacy::iswcntrl(__wc); }
inline int
towlower(wint_t __wc) { return _C_legacy::towlower(__wc); }
inline int
towupper(wint_t __wc) { return _C_legacy::towupper(__wc); }
inline int
iswctype(wint_t __wc, wctype_t __desc)
{ return _C_legacy::iswctype(__wc, __desc); }
inline wint_t
towctrans(wint_t __wc, wctrans_t __desc)
{ return _C_legacy::towctrans (__wc, __desc); }
namespace _C_legacy { inline wctrans_t
namespace _C_shadow { wctrans(const char *__property) { return _C_legacy::wctrans(__property); }
}
} inline wctype_t
wctype(char const* __property) { return _C_legacy::wctype(__property); }
} // namespace std
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
#endif #endif
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,42 +28,21 @@ ...@@ -28,42 +28,21 @@
// the GNU General Public License. // the GNU General Public License.
// //
// ISO C++ 14882: 20.5 Date and time // ISO C++ 14882: 20.5 Extensions
// //
// XXX incomplete
#ifndef _CPP_WRAP_LIBIO_H #ifndef _CPP_WRAP_LIBIO_H
#define _CPP_WRAP_LIBIO_H 1 #define _CPP_WRAP_LIBIO_H 1
namespace _C_legacy { namespace _C_legacy {
extern "C" { extern "C" {
# define _IN_C_LEGACY_ # define _IN_C_LEGACY_
# pragma GCC system_header # pragma GCC system_header
# include_next <libio.h> # include_next <libio.h>
}
namespace _C_shadow { }
} // close namespace ::_C_legacy::
// # undef that
namespace _C_legacy {
namespace _C_shadow {
// typedef stuff
}
} }
namespace std { } // namespace _C_legacy
// using ::_C_legacy::stuff
} // close namespace std:: // NB: Don't bring elements from this non-standard header into namespace std.
namespace _C_legacy {
namespace _C_shadow {
// using ::std::stuff
}
}
# undef _IN_C_LEGACY_ # undef _IN_C_LEGACY_
......
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,28 +28,41 @@ ...@@ -28,28 +28,41 @@
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_CTYPE_H_ #ifndef _INCLUDED_CPP_CTYPE_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cctype>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::isalnum;
using ::std::isalpha;
using ::std::iscntrl;
using ::std::isdigit;
using ::std::isgraph;
using ::std::islower;
using ::std::isprint;
using ::std::ispunct;
using ::std::isspace;
using ::std::isupper;
using ::std::isxdigit;
using ::std::tolower;
using ::std::toupper;
# define _INCLUDED_CPP_CTYPE_H_ 1 # define _INCLUDED_CPP_CTYPE_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
#error ctype.h
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _CTYPE_NEED_C_LEGACY_
# endif # endif
# include <cctype>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::isalnum;
using std::isalpha;
using std::iscntrl;
using std::isdigit;
using std::isgraph;
using std::islower;
using std::isprint;
using std::ispunct;
using std::isspace;
using std::isupper;
using std::isxdigit;
using std::tolower;
using std::toupper;
# ifdef _CTYPE_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _CTYPE_NEED_C_LEGACY_
# endif /* _CTYPE_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_CTYPE_H_ */ #endif /* _INCLUDED_CPP_CTYPE_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -30,8 +30,26 @@ ...@@ -30,8 +30,26 @@
#ifndef _INCLUDED_CPP_ERRNO_H_ #ifndef _INCLUDED_CPP_ERRNO_H_
# define _INCLUDED_CPP_ERRNO_H_ 1 # define _INCLUDED_CPP_ERRNO_H_ 1
# undef _SHADOW_NAME
# define _SHADOW_NAME <cerrno> # ifdef _IN_C_LEGACY_ /* sub-included by a C header */
# include <bits/generic_shadow.h> // get out of the "legacy"
# undef _SHADOW_NAME } // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _ERRNO_NEED_C_LEGACY_
# endif
# include <cerrno>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::errno;
# ifdef _ERRNO_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _ERRNO_NEED_C_LEGACY_
# endif /* _ERRNO_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_ERRNO_H_ */ #endif /* _INCLUDED_CPP_ERRNO_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,11 +28,27 @@ ...@@ -28,11 +28,27 @@
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_FLOAT_H_ #ifndef _INCLUDED_CPP_FLOAT_H_
# define _INCLUDED_CPP_FLOAT_H_ 1 # define _INCLUDED_CPP_FLOAT_H_ 1
# undef _SHADOW_NAME
# define _SHADOW_NAME <cfloat> # ifdef _IN_C_LEGACY_ /* sub-included by a C header */
# include <bits/generic_shadow.h> // get out of the "legacy"
# undef _SHADOW_NAME } // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _FLOAT_NEED_C_LEGACY_
# endif
# include <cfloat>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
# ifdef _FLOAT_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _FLOAT_NEED_C_LEGACY_
# endif /* _FLOAT_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_FLOAT_H_ */ #endif /* _INCLUDED_CPP_FLOAT_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,16 +29,53 @@ ...@@ -29,16 +29,53 @@
#ifndef _INCLUDED_CPP_LIBIO_H_ #ifndef _INCLUDED_CPP_LIBIO_H_
# define _INCLUDED_CPP_LIBIO_H_ 1
# undef _SHADOW_NAME # ifdef _IN_C_LEGACY_ /* sub-included by a C header */
# define _SHADOW_NAME <bits/wrap_libio.h> // get out of the "legacy"
# include <bits/generic_shadow.h> } // close extern "C"
# undef _SHADOW_NAME } // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _LIBIO_NEED_C_LEGACY_
# endif
# ifndef _IN_C_LEGACY_ # include <bits/wrap_libio.h>
// using ::std::stuff
# define _INCLUDED_CPP_LIBIO_H_ 1 // Expose global C names, including non-standard ones, but shadow
# endif // some names and types with the std:: C++ version.
// NB: Cannot use typedefs here to inject the names as the "C" headers
// often include typedefs that include the keyword 'struct'
using _C_legacy::_IO_pos_t;
using _C_legacy::_IO_fpos_t;
using _C_legacy::_IO_fpos64_t;
using _C_legacy::_IO_size_t;
using _C_legacy::_IO_ssize_t;
using _C_legacy::_IO_off_t;
using _C_legacy::_IO_off64_t;
using _C_legacy::_IO_pid_t;
using _C_legacy::_IO_uid_t;
using _C_legacy::_IO_iconv_t;
using _C_legacy::_IO_va_list;
using _C_legacy::_IO_wint_t;
using _C_legacy::_IO_lock_t;
using _C_legacy::_IO_marker;
using _C_legacy::_IO_codecvt;
using _C_legacy::_IO_wide_data;
using _C_legacy::_IO_FILE;
using _C_legacy::_IO_cookie_io_functions_t;
using _C_legacy::_IO_cookie_file;
# ifdef _LIBIO_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _LIBIO_NEED_C_LEGACY_
# endif /* _LIBIO_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_LIBIO_H_ */ #endif /* _INCLUDED_CPP_LIBIO_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,11 +28,27 @@ ...@@ -28,11 +28,27 @@
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_LIMITS_H_ #ifndef _INCLUDED_CPP_LIMITS_H_
# define _INCLUDED_CPP_LIMITS_H_ 1 # define _INCLUDED_CPP_LIMITS_H_ 1
# undef _SHADOW_NAME
# define _SHADOW_NAME <climits> # ifdef _IN_C_LEGACY_ /* sub-included by a C header */
# include <bits/generic_shadow.h> // get out of the "legacy"
# undef _SHADOW_NAME } // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _LIMITS_NEED_C_LEGACY_
# endif
# include <climits>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
# ifdef _LIMITS_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _LIMITS_NEED_C_LEGACY_
# endif /* _LIMITS_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_LIMITS_H_ */ #endif /* _INCLUDED_CPP_LIMITS_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,18 +28,30 @@ ...@@ -28,18 +28,30 @@
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_LOCALE_H_ #ifndef _INCLUDED_CPP_LOCALE_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <clocale>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::lconv;
using ::std::setlocale;
using ::std::localeconv;
# define _INCLUDED_CPP_LOCALE_H_ 1 # define _INCLUDED_CPP_LOCALE_H_ 1
# endif
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _LOCALE_NEED_C_LEGACY_
#endif
# include <clocale>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::lconv;
using std::setlocale;
using std::localeconv;
# ifdef _LOCALE_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _LOCALE_NEED_C_LEGACY_
# endif /* _LOCALE_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_LOCALE_H_ */ #endif /* _INCLUDED_CPP_LOCALE_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,35 +29,103 @@ ...@@ -29,35 +29,103 @@
#ifndef _INCLUDED_CPP_MATH_H_ #ifndef _INCLUDED_CPP_MATH_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cmath>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::acos;
using ::std::asin;
using ::std::atan;
using ::std::atan2;
using ::std::cos;
using ::std::sin;
using ::std::tan;
using ::std::cosh;
using ::std::sinh;
using ::std::tanh;
using ::std::exp;
using ::std::frexp;
using ::std::ldexp;
using ::std::log;
using ::std::log10;
using ::std::modf;
using ::std::pow;
using ::std::sqrt;
using ::std::ceil;
using ::std::fabs;
using ::std::floor;
using ::std::fmod;
# define _INCLUDED_CPP_MATH_H_ 1 # define _INCLUDED_CPP_MATH_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _MATH_NEED_C_LEGACY_
# endif # endif
# include <cmath>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::abs;
using std::acos;
using std::asin;
using std::atan;
using std::atan2;
using std::cos;
using std::sin;
using std::tan;
using std::cosh;
using std::sinh;
using std::tanh;
using std::exp;
using std::frexp;
using std::ldexp;
using std::log;
using std::log10;
using std::modf;
using std::pow;
using std::sqrt;
using std::ceil;
using std::fabs;
using std::floor;
using std::fmod;
// From ISO/IEC 9899:1999
using std::absf;
using std::acosf;
using std::asinf;
using std::atanf;
using std::atan2f;
using std::cosf;
using std::sinf;
using std::tanf;
using std::coshf;
using std::sinhf;
using std::tanhf;
using std::expf;
using std::frexpf;
using std::ldexpf;
using std::logf;
using std::log10f;
using std::modff;
using std::powf;
using std::sqrtf;
using std::ceilf;
using std::fabsf;
using std::floorf;
using std::fmodf;
// From ISO/IEC 9899:1999
using std::absl;
using std::acosl;
using std::asinl;
using std::atanl;
using std::atan2l;
using std::cosl;
using std::sinl;
using std::tanl;
using std::coshl;
using std::sinhl;
using std::tanhl;
using std::expl;
using std::frexpl;
using std::ldexpl;
using std::logl;
using std::log10l;
using std::modfl;
using std::powl;
using std::sqrtl;
using std::ceill;
using std::fabsl;
using std::floorl;
using std::fmodl;
# ifdef _MATH_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _MATH_NEED_C_LEGACY_
# endif /* _MATH_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_MATH_H_ */ #endif /* _INCLUDED_CPP_MATH_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,17 +28,29 @@ ...@@ -28,17 +28,29 @@
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_SETJMP_H_ #ifndef _INCLUDED_CPP_SETJMP_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <csetjmp>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::jmp_buf;
using ::std::longjmp;
# define _INCLUDED_CPP_SETJMP_H_ 1 # define _INCLUDED_CPP_SETJMP_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _SETJMP_NEED_C_LEGACY_
# endif # endif
# include <csetjmp>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::jmp_buf;
using std::longjmp;
# ifdef _SETJMP_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _SETJMP_NEED_C_LEGACY_
# endif /* _SETJMP_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_SETJMP_H_ */ #endif /* _INCLUDED_CPP_SETJMP_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,18 +28,31 @@ ...@@ -28,18 +28,31 @@
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_SIGNAL_H_ #ifndef _INCLUDED_CPP_SIGNAL_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <csignal>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::sig_atomic_t;
using ::std::raise;
using ::std::signal;
# define _INCLUDED_CPP_SIGNAL_H_ 1 # define _INCLUDED_CPP_SIGNAL_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _SIGNAL_NEED_C_LEGACY_
# endif # endif
# include <csignal>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::sig_atomic_t;
using std::raise;
using std::signal;
# ifdef _SIGNAL_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _SIGNAL_NEED_C_LEGACY_
# endif /* _SIGNAL_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_SIGNAL_H_ */ #endif /* _INCLUDED_CPP_SIGNAL_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,14 +29,27 @@ ...@@ -29,14 +29,27 @@
#ifndef _INCLUDED_CPP_STDARG_H_ #ifndef _INCLUDED_CPP_STDARG_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cstdarg>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::va_list;
# define _INCLUDED_CPP_STDARG_H_ 1 # define _INCLUDED_CPP_STDARG_H_ 1
#ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _STDARG_NEED_C_LEGACY_
# endif # endif
# include <cstdarg>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::va_list;
# ifdef _STDARG_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _STDARG_NEED_C_LEGACY_
# endif /* _STDARG_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_STDARG_H_ */ #endif /* _INCLUDED_CPP_STDARG_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,23 +29,32 @@ ...@@ -29,23 +29,32 @@
#ifndef _INCLUDED_CPP_STDDEF_H_ #ifndef _INCLUDED_CPP_STDDEF_H_
// turn off glibc weirdness. other libs have similar foolishness.
#undef __need_wchar_t
#undef __need_size_t
#undef __need_ptrdiff_t
#undef __need_NULL
#undef __need_wint_t
# undef _SHADOW_NAME
# define _SHADOW_NAME <cstddef>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::ptrdiff_t;
using ::std::size_t;
# define _INCLUDED_CPP_STDDEF_H_ 1 # define _INCLUDED_CPP_STDDEF_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _STDDEF_NEED_C_LEGACY_
# endif # endif
# include <cstddef>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::ptrdiff_t;
using std::size_t;
# ifdef _STDDEF_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _STDDEF_NEED_C_LEGACY_
# endif /* _STDDEF_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_STDDEF_H_ */ #endif /* _INCLUDED_CPP_STDDEF_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -27,58 +27,71 @@ ...@@ -27,58 +27,71 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_STDIO_H_ #ifndef _INCLUDED_CPP_STDIO_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cstdio>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::size_t;
using ::std::fpos_t;
using ::std::remove;
using ::std::rename;
using ::std::tmpfile;
using ::std::tmpnam;
using ::std::fclose;
using ::std::fflush;
using ::std::fopen;
using ::std::freopen;
using ::std::setbuf;
using ::std::setvbuf;
using ::std::fprintf;
using ::std::fscanf;
using ::std::printf;
using ::std::scanf;
using ::std::sprintf;
using ::std::sscanf;
using ::std::vfprintf;
using ::std::vprintf;
using ::std::vsprintf;
using ::std::fgetc;
using ::std::fgets;
using ::std::fputc;
using ::std::fputs;
using ::std::getc;
using ::std::getchar;
using ::std::gets;
using ::std::putc;
using ::std::putchar;
using ::std::puts;
using ::std::ungetc;
using ::std::fread;
using ::std::fwrite;
using ::std::fgetpos;
using ::std::fseek;
using ::std::fsetpos;
using ::std::ftell;
using ::std::rewind;
using ::std::clearerr;
using ::std::feof;
using ::std::ferror;
using ::std::perror;
# define _INCLUDED_CPP_STDIO_H_ 1 # define _INCLUDED_CPP_STDIO_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _STDIO_NEED_C_LEGACY_
# endif # endif
# include <cstdio>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::FILE;
using std::fpos_t;
using std::remove;
using std::rename;
using std::tmpfile;
using std::tmpnam;
using std::fclose;
using std::fflush;
using std::fopen;
using std::freopen;
using std::setbuf;
using std::setvbuf;
using std::fprintf;
using std::fscanf;
using std::printf;
using std::scanf;
using std::sprintf;
using std::sscanf;
using std::vfprintf;
using std::vprintf;
using std::vsprintf;
using std::fgetc;
using std::fgets;
using std::fputc;
using std::fputs;
using std::getc;
using std::getchar;
using std::gets;
using std::putc;
using std::putchar;
using std::puts;
using std::ungetc;
using std::fread;
using std::fwrite;
using std::fgetpos;
using std::fseek;
using std::fsetpos;
using std::ftell;
using std::rewind;
using std::clearerr;
using std::feof;
using std::ferror;
using std::perror;
# ifdef _STDIO_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _STDIO_NEED_C_LEGACY_
# endif /* _STDIO_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_STDIO_H_ */ #endif /* _INCLUDED_CPP_STDIO_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,44 +29,67 @@ ...@@ -29,44 +29,67 @@
#ifndef _INCLUDED_CPP_STDLIB_H_ #ifndef _INCLUDED_CPP_STDLIB_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cstdlib>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::size_t;
using ::std::div_t;
using ::std::ldiv_t;
using ::std::atof;
using ::std::atoi;
using ::std::atol;
using ::std::strtod;
using ::std::strtol;
using ::std::strtoul;
using ::std::rand;
using ::std::srand;
using ::std::calloc;
using ::std::free;
using ::std::malloc;
using ::std::realloc;
using ::std::abort;
using ::std::atexit;
using ::std::exit;
using ::std::getenv;
using ::std::system;
using ::std::bsearch;
using ::std::qsort;
using ::std::abs;
using ::std::div;
using ::std::labs;
using ::std::ldiv;
using ::std::mblen;
using ::std::mbtowc;
using ::std::wctomb;
using ::std::mbstowcs;
using ::std::wcstombs;
# define _INCLUDED_CPP_STDLIB_H_ 1 # define _INCLUDED_CPP_STDLIB_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _STDLIB_NEED_C_LEGACY_
# endif # endif
# include <cstdlib>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::div_t;
using std::ldiv_t;
#ifdef _GLIBCPP_USE_LONG_LONG
using std::lldiv_t;
#endif
using std::abort;
using std::abs;
using std::atexit;
using std::atof;
using std::atoi;
using std::atol;
using std::bsearch;
using std::calloc;
using std::div;
using std::exit;
using std::free;
using std::getenv;
using std::labs;
using std::ldiv;
using std::malloc;
using std::mblen;
using std::mbstowcs;
using std::mbtowc;
using std::qsort;
using std::rand;
using std::realloc;
using std::srand;
using std::strtod;
using std::strtol;
using std::strtoul;
using std::system;
using std::wcstombs;
using std::wctomb;
#ifdef _GLIBCPP_USE_LONG_LONG
using std::strtoll;
using std::strtoull;
using std::strtof;
using std::strtold;
#endif
# ifdef _STDLIB_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _STDLIB_NEED_C_LEGACY_
# endif /* _STDLIB_NEED_C__LEGACY_ */
#endif /* _INCLUDED_CPP_STDLIB_H_ */ #endif /* _INCLUDED_CPP_STDLIB_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,35 +29,48 @@ ...@@ -29,35 +29,48 @@
#ifndef _INCLUDED_CPP_STRING_H_ #ifndef _INCLUDED_CPP_STRING_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cstring>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::memcpy;
using ::std::memmove;
using ::std::strcpy;
using ::std::strncpy;
using ::std::strcat;
using ::std::strncat;
using ::std::memcmp;
using ::std::strcmp;
using ::std::strcoll;
using ::std::strncmp;
using ::std::strxfrm;
using ::std::memchr;
using ::std::strchr;
using ::std::strcspn;
using ::std::strpbrk;
using ::std::strrchr;
using ::std::strspn;
using ::std::strstr;
using ::std::strtok;
using ::std::memset;
using ::std::strerror;
using ::std::strlen;
# define _INCLUDED_CPP_STRING_H_ 1 # define _INCLUDED_CPP_STRING_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _STRING_NEED_C_LEGACY_
# endif # endif
# include <cstring>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::memcpy;
using std::memmove;
using std::strcpy;
using std::strncpy;
using std::strcat;
using std::strncat;
using std::memcmp;
using std::strcmp;
using std::strcoll;
using std::strncmp;
using std::strxfrm;
using std::memchr;
using std::strchr;
using std::strcspn;
using std::strpbrk;
using std::strrchr;
using std::strspn;
using std::strstr;
using std::strtok;
using std::memset;
using std::strerror;
using std::strlen;
# ifdef _STRING_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _STRING_NEED_C_LEGACY_
# endif /* _STRING_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_STRING_H_ */ #endif /* _INCLUDED_CPP_STRING_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,32 +29,39 @@ ...@@ -29,32 +29,39 @@
#ifndef _INCLUDED_CPP_TIME_H_ #ifndef _INCLUDED_CPP_TIME_H_
// turn off glibc-2.0 weirdness. Other systems define similar foolishness
#undef __need_time_t
#undef __need_clock_t
#undef __need_timespec
# undef _SHADOW_NAME
# define _SHADOW_NAME <ctime>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::size_t; /* handled in <cstddef> */
using ::std::clock_t;
using ::std::time_t;
using ::std::tm;
using ::std::clock;
using ::std::difftime;
using ::std::mktime;
using ::std::time;
using ::std::asctime;
using ::std::ctime;
using ::std::gmtime;
using ::std::localtime;
using ::std::strftime;
# define _INCLUDED_CPP_TIME_H_ 1 # define _INCLUDED_CPP_TIME_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _TIME_NEED_C_LEGACY_
# endif # endif
# include <ctime>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::clock_t;
using std::time_t;
using std::tm;
using std::clock;
using std::difftime;
using std::mktime;
using std::time;
using std::asctime;
using std::ctime;
using std::gmtime;
using std::localtime;
using std::strftime;
# ifdef _TIME_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _TIME_NEED_C_LEGACY_
# endif /* _TIME_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_TIME_H_ */ #endif /* _INCLUDED_CPP_TIME_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999 Free Software Foundation, Inc. // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -29,83 +29,103 @@ ...@@ -29,83 +29,103 @@
#ifndef _INCLUDED_CPP_WCHAR_H_ #ifndef _INCLUDED_CPP_WCHAR_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cwchar>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::size_t; /* handled in <cstddef> */
using ::std::wint_t;
using ::std::mbstate_t;
# if 0 /* glibc-2.0 doesn't define these */
using ::std::fgetwc;
using ::std::fgetws;
using ::std::fputwc;
using ::std::fputws;
using ::std::ungetwc;
using ::std::getwc;
using ::std::getwchar;
using ::std::putwc;
using ::std::putwchar;
using ::std::wprintf;
using ::std::wsprintf;
using ::std::wvsprintf;
using ::std::wfsprintf;
using ::std::wscanf;
using ::std::wsscanf;
using ::std::wvsscanf;
using ::std::wfscanf;
// XXX etc.
using ::std::wcsftime;
# endif
using ::std::wcscpy;
using ::std::wcscat;
using ::std::wcscmp;
using ::std::wcscoll;
using ::std::wcsxfrm;
# ifdef __USE_GNU
using ::std::wcsdup;
# endif
using ::std::wcschr;
using ::std::wcscspn;
using ::std::wcspbrk;
using ::std::wcsstr;
using ::std::wcstok;
using ::std::wcslen;
# ifndef __sun
using ::std::wmemchr;
using ::std::wmemcmp;
using ::std::wmemcpy;
using ::std::wmemmove;
using ::std::wmemset;
using ::std::btowc;
using ::std::wctob;
using ::std::mbsinit;
using ::std::mbrtowc;
using ::std::wcrtomb;
using ::std::mbrlen;
# endif
# ifdef __USE_GNU
using ::std::mbsrtowcs;
using ::std::wcsrtombs;
using ::std::mbsnrtowcs;
using ::std::mbsnrtombs;
using ::std::wcwidth;
using ::std::wcswidth;
using ::std::wcscmpy;
# endif
using ::std::wcstod;
using ::std::wcstol;
using ::std::wcstoul;
using ::std::wcsncat;
using ::std::wcsncmp;
using ::std::wcsncpy;
using ::std::wcsrchr;
using ::std::wcsspn;
# define _INCLUDED_CPP_WCHAR_H_ 1 # define _INCLUDED_CPP_WCHAR_H_ 1
# endif /* _IN_C_LEGACY_ */
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_ /* sub-included by a C header */
# define _WCHAR_NEED_C_LEGACY_
# endif
# include <cwchar>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::wchar_t;
using std::wint_t;
using std::mbstate_t;
#if 0
using std::fwprintf;
using std::fwscanf;
using std::swprintf;
using std::swscanf;
using std::vfwprintf;
using std::vfwscanf;
using std::vswprintf;
using std::vswscanf;
using std::vwprintf;
using std::vwscanf;
using std::wprintf;
using std::wscanf;
using std::fgetwc;
using std::fgetws;
using std::fputwc;
using std::fputws;
using std::fwide;
using std::getwc;
using std::getwchar;
using std::putwc;
using std::putwchar;
using std::ungetwc;
#endif
using std::wcstod;
using std::wcstof;
using std::wcstold;
using std::wcstol;
using std::wcstoll;
using std::wcstoul;
using std::wcstoull;
using std::wcscpy;
using std::wcsncpy;
using std::wcscat;
using std::wcsncat;
#if 0
using std::wcsmp;
#endif
using std::wcscoll;
using std::wcsncmp;
using std::wcsxfrm;
using std::wcschr;
using std::wcscspn;
using std::wcslen;
using std::wcspbrk;
using std::wcsrchr;
using std::wcsspn;
using std::wcsstr;
using std::wcstok;
using std::wmemchr;
using std::wmemcmp;
using std::wmemcpy;
using std::wmemmove;
using std::wmemset;
#if 0
using std::wcsftime;
#endif
using std::btowc;
using std::wctob;
using std::mbsinit;
using std::mbrlen;
using std::mbrtowc;
using std::wcrtomb;
using std::mbsrtowcs;
using std::wcsrtombs;
# ifdef _WCHAR_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _WCHAR_NEED_C_LEGACY_
# endif /* _WCHAR_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_WCHAR_H_ */ #endif /* _INCLUDED_CPP_WCHAR_H_ */
// -*- C++ -*- header wrapper. // -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,32 +27,48 @@ ...@@ -28,32 +27,48 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _INCLUDED_CPP_CWCTYPE_H_ #ifndef _INCLUDED_CPP_CWCTYPE_H_
# undef _SHADOW_NAME
# define _SHADOW_NAME <cwctype>
# include <bits/generic_shadow.h>
# undef _SHADOW_NAME
# ifndef _IN_C_LEGACY_
using ::std::size_t;
using ::std::wint_t;
using ::std::wctype_t;
using ::std::wctrans_t;
using ::std::iswalpha;
using ::std::iswupper;
using ::std::iswlower;
using ::std::iswdigit;
using ::std::iswxdigit;
using ::std::iswalnum;
using ::std::iswspace;
using ::std::iswpunct;
using ::std::iswprint;
using ::std::iswgraph;
using ::std::iswcntrl;
using ::std::iswctype;
using ::std::towlower;
using ::std::towupper;
# define _INCLUDED_CPP_CWCTYPE_H_ 1 # define _INCLUDED_CPP_CWCTYPE_H_ 1
# ifdef _IN_C_LEGACY_ /* sub-included by a C header */
// get out of the "legacy"
} // close extern "C"
} // close namespace _C_legacy::
# undef _IN_C_LEGACY_
# define _CWCHAR_NEED_C_LEGACY_
# endif # endif
# include <cwctype>
// Expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using std::wint_t;
using std::wctype_t;
using std::wctrans_t;
using std::iswalpha;
using std::iswupper;
using std::iswlower;
using std::iswdigit;
using std::iswxdigit;
using std::iswalnum;
using std::iswspace;
using std::iswpunct;
using std::iswprint;
using std::iswgraph;
using std::iswcntrl;
using std::iswctype;
using std::towctrans;
using std::towlower;
using std::towupper;
using std::wctrans;
using std::wctype;
# ifdef _CWCHAR_NEED_C_LEGACY_
// dive back into the "swamp"
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef _CWCHAR_NEED_C_LEGACY_
# endif /* _CWCHAR_NEED_C_LEGACY_ */
#endif /* _INCLUDED_CPP_CWCTYPE_H_ */ #endif /* _INCLUDED_CPP_CWCTYPE_H_ */
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA. ## USA.
## $Id: Makefile.am,v 1.29 2000/08/22 17:22:38 bkoz Exp $ ## $Id: Makefile.am,v 1.30 2000/09/14 19:44:03 bkoz Exp $
AUTOMAKE_OPTIONS = 1.3 gnits AUTOMAKE_OPTIONS = 1.3 gnits
MAINT_CHARSET = latin1 MAINT_CHARSET = latin1
...@@ -48,7 +48,7 @@ EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la ...@@ -48,7 +48,7 @@ EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la
# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
AC_CXXFLAGS = \ AC_CXXFLAGS = \
$(WERROR) @WFMT_FLAGS@ @CPU_FLAGS@ @EXTRA_CXX_FLAGS@ \ $(WERROR) @WFMT_FLAGS@ @CPU_FLAGS@ @EXTRA_CXX_FLAGS@ \
@SECTION_FLAGS@ @DEBUG_FLAGS@ @SECTION_FLAGS@ @CSHADOWFLAGS@ @DEBUG_FLAGS@
# Need to manually set this option because AC_CXXFLAGS has to be at # Need to manually set this option because AC_CXXFLAGS has to be at
# the end of the compile line so that -O2 can be overridden as the # the end of the compile line so that -O2 can be overridden as the
...@@ -70,9 +70,10 @@ LIBIO_INCLUDES = -I$(top_srcdir)/libio ...@@ -70,9 +70,10 @@ LIBIO_INCLUDES = -I$(top_srcdir)/libio
endif endif
if GLIBCPP_USE_CSHADOW if GLIBCPP_USE_CSHADOW
CSHADOW_INCLUDES =
#CSHADOW_INCLUDES = \ #CSHADOW_INCLUDES = \
# @CSHADOWFLAGS@ -I$(top_srcdir)/shadow -I$(top_builddir)/cshadow # -I$(top_srcdir)/std -I$(top_srcdir)/shadow -I$(top_builddir)/cshadow
CSHADOW_INCLUDES = \
-I$(top_srcdir)/std -I$(top_srcdir)/shadow
else else
CSHADOW_INCLUDES = CSHADOW_INCLUDES =
endif endif
...@@ -82,17 +83,20 @@ CONFIG_INCLUDES = \ ...@@ -82,17 +83,20 @@ CONFIG_INCLUDES = \
-I$(top_srcdir)/@ctype_include_dir@ -I$(top_srcdir)/@ctype_include_dir@
INCLUDES = \ INCLUDES = \
-D_GNU_SOURCE -nostdinc++ $(CSHADOW_INCLUDES) -I$(top_srcdir) \ -D_GNU_SOURCE -D_ISOC99_SOURCE -nostdinc++ $(CSHADOW_INCLUDES) \
$(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES) -I$(top_builddir) -I$(top_srcdir) \
$(CONFIG_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
# Need to explicitly set this so that AM_CXXFLAGS is last. (That way, # Need to explicitly set this so that AM_CXXFLAGS is last. In
# addition, we don't use $(DEFS), which tries to set $(top_srcdir) as
# an include diretory, which screws up shadow headers. (That way,
# things like -O2 passed down from the toplevel can be overridden by # things like -O2 passed down from the toplevel can be overridden by
# --enable-debug.) # --enable-debug.)
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ CXXCOMPILE = $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(CXXFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) \ LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
# We have a problem when building the shared libstdc++ object if the # We have a problem when building the shared libstdc++ object if the
...@@ -246,7 +250,7 @@ $(libstdc___la_OBJECTS): $(CSHADOW_H) ...@@ -246,7 +250,7 @@ $(libstdc___la_OBJECTS): $(CSHADOW_H)
$(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \ $(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \
$(top_srcdir)/mkcshadow $(top_srcdir)/mkcshadow
$(top_srcdir)/mkinclosure \ $(top_srcdir)/mkinclosure \
"-I $(top_builddir)/../../gcc/include -I /usr/include -G machine/ansi.h" | $(top_srcdir)/mkcshadow; "-I $(top_builddir)/../../gcc/include -I /usr/include -G fcntl.h unistd.h" | $(top_srcdir)/mkcshadow;
rm -f $(top_builddir)/stamp-cshadow rm -f $(top_builddir)/stamp-cshadow
echo "done" > $(top_builddir)/stamp-cshadow echo "done" > $(top_builddir)/stamp-cshadow
......
...@@ -124,7 +124,7 @@ EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la ...@@ -124,7 +124,7 @@ EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la
# These bits are all figured out from configure. Look in acinclude.m4 # These bits are all figured out from configure. Look in acinclude.m4
# or configure.in to see how they are set. # or configure.in to see how they are set.
# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
AC_CXXFLAGS = $(WERROR) @WFMT_FLAGS@ @CPU_FLAGS@ @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @DEBUG_FLAGS@ AC_CXXFLAGS = $(WERROR) @WFMT_FLAGS@ @CPU_FLAGS@ @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOWFLAGS@ @DEBUG_FLAGS@
# Need to manually set this option because AC_CXXFLAGS has to be at # Need to manually set this option because AC_CXXFLAGS has to be at
...@@ -137,24 +137,24 @@ AM_CXXFLAGS = -fno-implicit-templates $(OPTIMIZE_CXXFLAGS) -Wall -Wno-format ...@@ -137,24 +137,24 @@ AM_CXXFLAGS = -fno-implicit-templates $(OPTIMIZE_CXXFLAGS) -Wall -Wno-format
TOPLEVEL_INCLUDES = -I$(includedir) TOPLEVEL_INCLUDES = -I$(includedir)
@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_INCLUDES = -I$(top_builddir)/libio -I$(top_srcdir)/libio @GLIBCPP_NEED_LIBIO_TRUE@LIBIO_INCLUDES = -I$(top_builddir)/libio -I$(top_srcdir)/libio
@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_INCLUDES = -I$(top_srcdir)/libio @GLIBCPP_NEED_LIBIO_FALSE@LIBIO_INCLUDES = -I$(top_srcdir)/libio
#CSHADOW_INCLUDES = \ @GLIBCPP_USE_CSHADOW_TRUE@CSHADOW_INCLUDES = -I$(top_srcdir)/std -I$(top_srcdir)/shadow
# @CSHADOWFLAGS@ -I$(top_srcdir)/shadow -I$(top_builddir)/cshadow
@GLIBCPP_USE_CSHADOW_TRUE@CSHADOW_INCLUDES =
@GLIBCPP_USE_CSHADOW_FALSE@CSHADOW_INCLUDES = @GLIBCPP_USE_CSHADOW_FALSE@CSHADOW_INCLUDES =
CONFIG_INCLUDES = -I$(top_srcdir)/@cpu_include_dir@ -I$(top_srcdir)/@ctype_include_dir@ CONFIG_INCLUDES = -I$(top_srcdir)/@cpu_include_dir@ -I$(top_srcdir)/@ctype_include_dir@
INCLUDES = -D_GNU_SOURCE -nostdinc++ $(CSHADOW_INCLUDES) -I$(top_srcdir) $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES) INCLUDES = -D_GNU_SOURCE -D_ISOC99_SOURCE -nostdinc++ $(CSHADOW_INCLUDES) -I$(top_builddir) -I$(top_srcdir) $(CONFIG_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
# Need to explicitly set this so that AM_CXXFLAGS is last. (That way, # Need to explicitly set this so that AM_CXXFLAGS is last. In
# addition, we don't use $(DEFS), which tries to set $(top_srcdir) as
# an include diretory, which screws up shadow headers. (That way,
# things like -O2 passed down from the toplevel can be overridden by # things like -O2 passed down from the toplevel can be overridden by
# --enable-debug.) # --enable-debug.)
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) CXXCOMPILE = $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
# We have a problem when building the shared libstdc++ object if the # We have a problem when building the shared libstdc++ object if the
...@@ -457,7 +457,7 @@ $(libstdc___la_OBJECTS): $(CSHADOW_H) ...@@ -457,7 +457,7 @@ $(libstdc___la_OBJECTS): $(CSHADOW_H)
$(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \ $(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \
$(top_srcdir)/mkcshadow $(top_srcdir)/mkcshadow
$(top_srcdir)/mkinclosure \ $(top_srcdir)/mkinclosure \
"-I $(top_builddir)/../../gcc/include -I /usr/include -G machine/ansi.h" | $(top_srcdir)/mkcshadow; "-I $(top_builddir)/../../gcc/include -I /usr/include -G fcntl.h unistd.h" | $(top_srcdir)/mkcshadow;
rm -f $(top_builddir)/stamp-cshadow rm -f $(top_builddir)/stamp-cshadow
echo "done" > $(top_builddir)/stamp-cshadow echo "done" > $(top_builddir)/stamp-cshadow
......
...@@ -36,239 +36,115 @@ ...@@ -36,239 +36,115 @@
#ifndef FLT #ifndef FLT
# define FLT double # define FLT double
# define FCT(name) ::name
#endif #endif
// This file often breaks due to compiler bugs. May need to put in guards, ie:
// #if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
// and
// #if defined(_GLIBCPP_FLOAT_SPECIALIZATION)
namespace std namespace std
{ {
template<>
template<> FLT
FLT abs(const complex<FLT>& __x)
abs(const complex<FLT>& __x) { return cabs(__x._M_value); }
{ return FCT(cabs)(__x._M_value); }
template<>
template<> FLT
FLT arg(const complex<FLT>& __x)
arg(const complex<FLT>& __x) { return carg(__x._M_value); }
{ return FCT(carg)(__x._M_value); }
template<>
template<> complex<FLT>
complex<FLT> polar(const FLT& __rho, const FLT& __theta)
polar(const FLT& __rho, const FLT& __theta) {
{ #if 0
#if defined _G_HAVE_SINCOS && !defined __osf__ // XXX
// Although sincos does exist on OSF3.2 and OSF4.0 we cannot use it // defined(_GLIBCPP_HAVE_SINCOS) && !defined(__osf__)
// since the necessary types are not defined in the headers. // Although sincos does exist on OSF3.2 and OSF4.0 we cannot use it
FLT __sinx, __cosx; // since the necessary types are not defined in the headers.
FCT(sincos)(__theta, &__sinx, &__cosx); FLT __sinx, __cosx;
return complex<FLT>(__rho * __cosx, __rho * __sinx); sincos(__theta, &__sinx, &__cosx);
#else return complex<FLT>(__rho * __cosx, __rho * __sinx);
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ #else
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION) return complex<FLT>(__rho * cos(__theta), __rho * sin(__theta));
complex<FLT> __tmpf(__rho * FCT(cos)(__theta), #endif
__rho * FCT(sin)(__theta)); }
return __tmpf;
#else template<>
return complex<FLT>(__rho * FCT(cos)(__theta), complex<FLT>
__rho * FCT(sin)(__theta)); cos(const complex<FLT>& __x)
#endif { return complex<FLT>(ccos(__x._M_value)); }
#endif
} template<>
complex<FLT>
template<> cosh(const complex<FLT>& __x)
complex<FLT> { return complex<FLT>(ccosh(__x._M_value)); }
cos(const complex<FLT>& __x)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ template<>
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION) complex<FLT>
{ exp(const complex<FLT>& __x)
complex<FLT> __tmpf(FCT(ccos)(__x._M_value)); { return complex<FLT>(cexp(__x._M_value)); }
return __tmpf;
} template<>
#else complex<FLT>
{ return complex<FLT>(FCT(ccos)(__x._M_value)); } log(const complex<FLT>& __x)
#endif { return complex<FLT>(c_log(__x._M_value)); }
template<> template<>
complex<FLT> complex<FLT>
cosh(const complex<FLT>& __x) log10(const complex<FLT>& __x)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ { return complex<FLT>(clog10(__x._M_value)); }
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{ template<>
complex<FLT> __tmpf(FCT(ccosh)(__x._M_value)); complex<FLT>
return __tmpf; pow(const complex<FLT>& __x, int __n)
} { return complex<FLT>(cexp(__n * c_log(__x._M_value))); }
#else
{ return complex<FLT>(FCT(ccosh)(__x._M_value)); } template<>
#endif complex<FLT>
pow(const complex<FLT>& __x, const FLT& __y)
template<> { return complex<FLT>(cexp(__y * c_log(__x._M_value))); }
complex<FLT>
exp(const complex<FLT>& __x) template<>
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ complex<FLT>
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION) pow(const complex<FLT>& __x, const complex<FLT>& __y)
{ { return complex<FLT>(cpow(__x._M_value, __y._M_value)); }
complex<FLT> __tmpf(FCT(cexp)(__x._M_value));
return __tmpf; template<>
} complex<FLT>
#else pow(const FLT& __x, const complex<FLT>& __y)
{ return complex<FLT>(FCT(cexp)(__x._M_value)); } { return complex<FLT>(cexp(__y._M_value * log(__x))); }
#endif
template<>
template<> complex<FLT>
complex<FLT> sin(const complex<FLT>& __x)
log(const complex<FLT>& __x) { return complex<FLT>(csin(__x._M_value)); }
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION) template<>
{ complex<FLT>
complex<FLT> __tmpf(FCT(c_log)(__x._M_value)); sinh(const complex<FLT>& __x)
return __tmpf; { return complex<FLT>(csinh(__x._M_value)); }
}
#else template<>
{ return complex<FLT>(FCT(c_log)(__x._M_value)); } complex<FLT>
#endif sqrt(const complex<FLT>& __x)
{ return complex<FLT>(csqrt(__x._M_value)); }
template<>
complex<FLT> template<>
log10(const complex<FLT>& __x) complex<FLT>
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ tan(const complex<FLT>& __x)
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION) { return complex<FLT>(ctan(__x._M_value)); }
{
complex<FLT> __tmpf(FCT(clog10)(__x._M_value)); template<>
return __tmpf; complex<FLT>
} tanh(const complex<FLT>& __x)
#else { return complex<FLT>(ctanh(__x._M_value)); }
{ return complex<FLT>(FCT(clog10)(__x._M_value)); }
#endif
template<>
complex<FLT>
pow(const complex<FLT>& __x, int __n)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(cexp) (__n * FCT(c_log)(__x._M_value)));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(cexp) (__n * FCT(c_log)(__x._M_value))); }
#endif
template<>
complex<FLT>
pow(const complex<FLT>& __x, const FLT& __y)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(cexp) (__y * FCT(c_log)(__x._M_value)));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(cexp) (__y * FCT(c_log)(__x._M_value))); }
#endif
template<>
complex<FLT>
pow(const complex<FLT>& __x, const complex<FLT>& __y)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(cpow)(__x._M_value, __y._M_value));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(cpow)(__x._M_value, __y._M_value)); }
#endif
template<>
complex<FLT>
pow(const FLT& __x, const complex<FLT>& __y)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(cexp)(__y._M_value * FCT(log)(__x)));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(cexp)(__y._M_value * FCT(log)(__x))); }
#endif
template<>
complex<FLT>
sin(const complex<FLT>& __x)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(csin)(__x._M_value));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(csin)(__x._M_value)); }
#endif
template<>
complex<FLT>
sinh(const complex<FLT>& __x)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(csinh)(__x._M_value));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(csinh)(__x._M_value)); }
#endif
template<>
complex<FLT>
sqrt(const complex<FLT>& __x)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(csqrt)(__x._M_value));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(csqrt)(__x._M_value)); }
#endif
template<>
complex<FLT>
tan(const complex<FLT>& __x)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(ctan)(__x._M_value));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(ctan)(__x._M_value)); }
#endif
template<>
complex<FLT>
tanh(const complex<FLT>& __x)
#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \
&& defined(_GLIBCPP_FLOAT_SPECIALIZATION)
{
complex<FLT> __tmpf(FCT(ctanh)(__x._M_value));
return __tmpf;
}
#else
{ return complex<FLT>(FCT(ctanh)(__x._M_value)); }
#endif
} // namespace std } // namespace std
#define FLT float #define FLT float
#define FCT(name) ::name##f
// Used in complex.cc to work around GCC's buggy __complex__ float support. // Used in complex.cc to work around GCC's buggy __complex__ float support.
#define _GLIBCPP_FLOAT_SPECIALIZATION 1 #define _GLIBCPP_FLOAT_SPECIALIZATION 1
#include "complex.cc" #include "complex.cc"
#include <bits/c++config.h> #include <bits/c++config.h>
#ifdef _GLIBCPP_HAVE_SINL #ifdef _GLIBCPP_USE_LONG_LONG
/* We compile these functions only when we have the long double functions /* We compile these functions only when we have the long double functions
available. */ available. */
#define FLT long double #define FLT long double
#define FCT(name) ::name##l
#include "complex.cc" #include "complex.cc"
#endif #endif
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <bits/std_vector.h> #include <bits/std_vector.h>
#include <bits/std_memory.h> // for auto_ptr #include <bits/std_memory.h> // for auto_ptr
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
#include <bits/std_cwctype.h> // for towupper, etc. # include <bits/std_cwctype.h> // for towupper, etc.
#endif #endif
namespace std { namespace std {
...@@ -952,7 +952,7 @@ namespace std { ...@@ -952,7 +952,7 @@ namespace std {
do_widen(const char* __low, const char* __high, wchar_t* __dest) const do_widen(const char* __low, const char* __high, wchar_t* __dest) const
{ {
mbstate_t __state; mbstate_t __state;
memset(&__state, 0, sizeof(mbstate_t)); memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
mbsrtowcs(__dest, &__low, __high - __low, &__state); mbsrtowcs(__dest, &__low, __high - __low, &__state);
return __high; return __high;
} }
...@@ -971,7 +971,7 @@ namespace std { ...@@ -971,7 +971,7 @@ namespace std {
char* __dest) const char* __dest) const
{ {
mbstate_t __state; mbstate_t __state;
memset(&__state, 0, sizeof(mbstate_t)); memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
size_t __len = __high - __low; size_t __len = __high - __low;
size_t __conv = wcsrtombs(__dest, &__low, __len, &__state); size_t __conv = wcsrtombs(__dest, &__low, __len, &__state);
if (__conv == __len) if (__conv == __len)
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <bits/std_clocale.h> #include <bits/std_clocale.h>
#include <bits/std_locale.h> #include <bits/std_locale.h>
#include <bits/std_cstring.h> #include <bits/std_cstring.h>
#include <bits/std_cassert.h>
#include <bits/std_vector.h> #include <bits/std_vector.h>
#include <bits/std_stdexcept.h> #include <bits/std_stdexcept.h>
...@@ -167,8 +166,6 @@ namespace std { ...@@ -167,8 +166,6 @@ namespace std {
locale::_Impl:: locale::_Impl::
_M_replace_categories(const _Impl* __other, category __cat) _M_replace_categories(const _Impl* __other, category __cat)
{ {
assert((__cat & locale::all) && !(__cat & ~locale::all));
unsigned int __mask = locale::all & -static_cast<unsigned int>(locale::all); unsigned int __mask = locale::all & -static_cast<unsigned int>(locale::all);
for (unsigned int __ix = 0; (-__mask & __cat) != 0; ++__ix, (__mask <<= 1)) for (unsigned int __ix = 0; (-__mask & __cat) != 0; ++__ix, (__mask <<= 1))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment