gcc/libstdc++-v3/shadow/bits/std_cstdio.h
Benjamin Kosnik 0517cb9903 [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
2000-10-04 05:06:32 +00:00

284 lines
6.9 KiB
C++

// -*- C++ -*- header wrapper.
// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
//
// 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.8.2 C Library files
//
#ifndef _CPP_CSTDIO
#define _CPP_CSTDIO 1
# include <bits/std_cstddef.h>
# include <bits/std_cstdarg.h>
namespace _C_legacy {
extern "C" {
# define _IN_C_LEGACY_
# undef __need_FILE
# pragma GCC system_header
# include_next <stdio.h>
}
typedef FILE _CPP_FILE_capture;
typedef fpos_t _CPP_fpos_t_capture;
inline FILE*
_CPP_stderr_capture() { return stderr; }
inline FILE*
_CPP_stdin_capture() { return stdin; }
inline FILE*
_CPP_stdout_capture() { return stdout; }
inline int
_CPP_getc_capture(FILE* __f) { return getc(__f); }
inline int
_CPP_getchar_capture() { return getchar(); }
inline int
_CPP_putc_capture(int __c, FILE* __f) { return putc(__c, __f); }
inline int
_CPP_putchar_capture(int __c) { return putchar(__c); }
inline int
_CPP_feof_capture(FILE* __f) { return feof(__f); }
} // namespace _C_legacy
# undef FILE
# undef fpos_t
# undef remove
# undef rename
# undef tmpfile
# undef tmpnam
# undef fclose
# undef fflush
# undef fopen
# undef freopen
# undef setbuf
# undef setvbuf
# undef fprintf
# undef fscanf
# undef printf
# undef scanf
# undef sprintf
# undef sscanf
# undef vfprintf
# undef vprintf
# undef vsprintf
# undef fgetc
# undef fgets
# undef fputc
# undef fputs
# undef getc
# undef getchar
# undef gets
# undef putc
# undef putchar
# undef puts
# undef ungetc
# undef fread
# undef fwrite
# undef fgetpos
# undef fseek
# undef fsetpos
# undef ftell
# undef rewind
# undef clearerr
# undef feof
# undef ferror
# undef perror
# undef stderr
# define stderr std::_CPP_stderr()
# undef stdin
# define stdin std::_CPP_stdin()
# undef stdout
# define stdout std::_CPP_stdout()
namespace std {
struct FILE : _C_legacy::_CPP_FILE_capture { };
struct fpos_t { _C_legacy::_CPP_fpos_t_capture _M_dummy; };
using _C_legacy::remove;
using _C_legacy::rename;
using _C_legacy::tmpnam;
using _C_legacy::printf;
using _C_legacy::scanf;
using _C_legacy::sprintf;
using _C_legacy::sscanf;
using _C_legacy::gets;
using _C_legacy::perror;
inline FILE*
_CPP_stderr()
{ return reinterpret_cast<FILE*>(_C_legacy::_CPP_stderr_capture() ); }
inline FILE*
_CPP_stdin()
{ return reinterpret_cast<FILE*>(_C_legacy::_CPP_stdin_capture() ); }
inline FILE*
_CPP_stdout()
{ return reinterpret_cast<FILE*>(_C_legacy::_CPP_stdout_capture() ); }
inline FILE*
tmpfile() { return reinterpret_cast<FILE*>(_C_legacy::tmpfile()); }
inline int
fclose(FILE* __f) { return _C_legacy::fclose(__f); }
inline int
fflush(FILE* __f) { return _C_legacy::fflush(__f); }
inline FILE*
fopen(char const* __name, char const* __mode)
{ return reinterpret_cast<FILE*>(_C_legacy::fopen(__name,__mode)); }
inline FILE*
freopen(char const* __name, char const* __mode, FILE* __f)
{ return reinterpret_cast<FILE*>(_C_legacy::freopen(__name,__mode,__f)); }
inline void
setbuf(FILE* __f, char* __buf)
{ return _C_legacy::setbuf(__f, __buf); }
inline int
setvbuf(FILE* __f, char* __buf, int __mode, size_t __size)
{ return _C_legacy::setvbuf(__f, __buf, __mode, __size); }
inline int
fprintf(FILE* __f, char const* __fmt, ...)
{
va_list __v;
va_start(__v,__fmt);
int __i = _C_legacy::vfprintf(__f, __fmt, __v);
va_end(__v);
return __i;
}
inline int
fscanf(FILE* __f, char const* __fmt, ...)
{
va_list __v;
va_start(__v,__fmt);
int __i = _C_legacy::vfscanf(__f, __fmt, __v);
va_end(__v);
return __i;
}
inline int
vfprintf(FILE* __f, char const* __fmt, va_list __v)
{ return _C_legacy::vfprintf(__f, __fmt, __v); }
inline int
vprintf(char const* __fmt, va_list __v)
{ return _C_legacy::vprintf(__fmt, __v); }
inline int
vsprintf(char* __buf, char const* __fmt, va_list __v)
{ return _C_legacy::vsprintf(__buf, __fmt, __v); }
inline int
fgetc(FILE* __f) { return _C_legacy::fgetc(__f); }
inline char*
fgets(char* __buf, int __n, FILE* __f)
{ return _C_legacy::fgets(__buf, __n, __f); }
inline int
fputc(int __c, FILE* __f) { return _C_legacy::fputc(__c, __f); }
inline int
fputs(char const* __s, FILE* __f)
{ return _C_legacy::fputs(__s, __f); }
inline int
getc(FILE* __f) { return _C_legacy::_CPP_getc_capture(__f); }
inline int
getchar() { return _C_legacy::_CPP_getchar_capture(); }
inline int
putc(int __c, FILE* __f)
{ return _C_legacy::_CPP_putc_capture(__c, __f); }
inline int
putchar(int __c) { return _C_legacy::_CPP_putchar_capture(__c); }
using _C_legacy::puts;
inline int
ungetc(int __c, FILE* __f) { return _C_legacy::ungetc(__c, __f); }
inline size_t
fread(void* __p, size_t __z, size_t __n, FILE* __f)
{ return _C_legacy::fread(__p,__z,__n,__f); }
inline size_t
fwrite(void const* __p, size_t __z, size_t __n, FILE* __f)
{ return _C_legacy::fwrite(__p,__z,__n,__f); }
inline int
fgetpos(FILE* __f, fpos_t* __pos)
{ return _C_legacy::fgetpos(__f,&__pos->_M_dummy); }
inline int
fseek(FILE* __f, long __off, int __how)
{ return _C_legacy::fseek(__f,__off,__how); }
inline int
fsetpos(FILE* __f, fpos_t const* __pos)
{ return _C_legacy::fsetpos(__f,&__pos->_M_dummy); }
inline long
ftell(FILE* __f) { return _C_legacy::ftell(__f); }
inline void
rewind(FILE* __f) { return _C_legacy::rewind(__f); }
inline void
clearerr(FILE* __f) { return _C_legacy::clearerr(__f); }
inline int
feof(FILE* __f) { return _C_legacy::_CPP_feof_capture(__f); }
inline int
ferror(FILE* __f) { return _C_legacy::ferror(__f); }
} // namespace std
# undef _IN_C_LEGACY_
#endif