diff options
author | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-12 23:09:09 +0000 |
---|---|---|
committer | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-12 23:09:09 +0000 |
commit | 2a793f18526a05291129d30cab5a446d4d4c0946 (patch) | |
tree | c1c7768a7c3fa4e6421e9078340dd04bd57fa444 /libstdc++-v3/config | |
parent | c2f3d0d8d9835425bc5754dadde13eb03a6cf655 (diff) | |
download | gcc-2a793f18526a05291129d30cab5a446d4d4c0946.tar.gz |
libstdc++/2071
* porting.texi: Add documentation about libstdc++-v3-specific
macros that are currently included in os_defines.h files.
* config/basic_file_stdio.h (sys_getc): New method.
(sys_ungetc): New method.
* include/bits/basic_file.h: (sys_getc): New method signature.
(sys_ungetc): New method signature.
* include/bits/fstream.tcc (underflow): Add conditional code
paths which avoid using short seeks on streams (especially
useful when the stream might be interactive or a pipe). At
the moment, this alternate path only avoids seeking when the
``buffer size'' of underflow() is 1 since the C standard only
guarantees buffer space for one ungetc (this technique could
be extended since *-*-solaris* supports buffering for 4 calls
to ungetc and *-*-*bsd* supports buffering limited only by
memory resources). Also, _GLIBCPP_AVOID_FSEEK must be defined
in a port's os_defines.h file for this alternate path to even
be considered. As a bonus, the idiom of using getc/ungetc
requires no system calls whereas fseek maps to one or two
system call(s) on many platforms.
* config/os/bsd/freebsd/bits/os_defines.h (_GLIBCPP_AVOID_FSEEK):
Define it.
* config/os/solaris/solaris2.5/bits/os_defines.h
(_GLIBCPP_AVOID_FSEEK): Likewise.
* config/os/solaris/solaris2.6/bits/os_defines.h
(_GLIBCPP_AVOID_FSEEK): Likewise.
* config/os/solaris/solaris2.7/bits/os_defines.h
(_GLIBCPP_AVOID_FSEEK): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43278 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/config')
5 files changed, 27 insertions, 7 deletions
diff --git a/libstdc++-v3/config/basic_file_stdio.h b/libstdc++-v3/config/basic_file_stdio.h index 565bfea4d40..edf4d98baa9 100644 --- a/libstdc++-v3/config/basic_file_stdio.h +++ b/libstdc++-v3/config/basic_file_stdio.h @@ -91,6 +91,20 @@ namespace std return __ret; } + + template<typename _CharT> + _CharT + __basic_file<_CharT>::sys_getc() + { + return getc (_M_cfile); + } + + template<typename _CharT> + _CharT + __basic_file<_CharT>::sys_ungetc(_CharT __s) + { + return ungetc (__s, _M_cfile); + } template<typename _CharT> __basic_file<_CharT>* diff --git a/libstdc++-v3/config/os/bsd/freebsd/bits/os_defines.h b/libstdc++-v3/config/os/bsd/freebsd/bits/os_defines.h index 1cb71d149ec..3a6803f8f3d 100644 --- a/libstdc++-v3/config/os/bsd/freebsd/bits/os_defines.h +++ b/libstdc++-v3/config/os/bsd/freebsd/bits/os_defines.h @@ -35,6 +35,7 @@ /* System-specific #define, typedefs, corrections, etc, go here. This file will come before all others. */ +#define _GLIBCPP_AVOID_FSEEK 1 #endif diff --git a/libstdc++-v3/config/os/solaris/solaris2.5/bits/os_defines.h b/libstdc++-v3/config/os/solaris/solaris2.5/bits/os_defines.h index 4dd1fa21c46..5a756b4210d 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.5/bits/os_defines.h +++ b/libstdc++-v3/config/os/solaris/solaris2.5/bits/os_defines.h @@ -1,4 +1,4 @@ -// Specific definitions for Solaris 2.6 -*- C++ -*- +// Specific definitions for Solaris 2.5 -*- C++ -*- // Copyright (C) 2000 Free Software Foundation, Inc. // @@ -33,6 +33,9 @@ /* System-specific #define, typedefs, corrections, etc, go here. This file will come before all others. */ + +#define _GLIBCPP_AVOID_FSEEK 1 + // These are typedefs which libio assumes are already in place (because // they really are, under Linux). #define __off_t off_t @@ -43,5 +46,3 @@ #define _G_USING_THUNKS 0 #endif - - diff --git a/libstdc++-v3/config/os/solaris/solaris2.6/bits/os_defines.h b/libstdc++-v3/config/os/solaris/solaris2.6/bits/os_defines.h index 4dd1fa21c46..961e29d55d0 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.6/bits/os_defines.h +++ b/libstdc++-v3/config/os/solaris/solaris2.6/bits/os_defines.h @@ -33,6 +33,9 @@ /* System-specific #define, typedefs, corrections, etc, go here. This file will come before all others. */ + +#define _GLIBCPP_AVOID_FSEEK 1 + // These are typedefs which libio assumes are already in place (because // they really are, under Linux). #define __off_t off_t @@ -43,5 +46,3 @@ #define _G_USING_THUNKS 0 #endif - - diff --git a/libstdc++-v3/config/os/solaris/solaris2.7/bits/os_defines.h b/libstdc++-v3/config/os/solaris/solaris2.7/bits/os_defines.h index cb0afed3259..8ed386765f6 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.7/bits/os_defines.h +++ b/libstdc++-v3/config/os/solaris/solaris2.7/bits/os_defines.h @@ -31,6 +31,11 @@ #ifndef _GLIBCPP_OS_DEFINES # define _GLIBCPP_OS_DEFINES +/* System-specific #define, typedefs, corrections, etc, go here. This + file will come before all others. */ + +#define _GLIBCPP_AVOID_FSEEK 1 + // These are typedefs which libio assumes are already in place (because // they really are, under Linux). #define __off_t off_t @@ -40,6 +45,4 @@ // Without this all the libio vtbls are offset wrongly. #define _G_USING_THUNKS 0 - #endif - |