diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1fc5171fd3f..fc990c932ea 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -16,6 +16,11 @@ c++threads.h instead of copying. * acinclude.m4 (GLIBCPP_ENABLE_THREADS): Do link here. + * config/c_io_libio.cc (__basic_file::_M_open_mode): Consolidate. + * bits/basic_file.h: Declare. + + * mkcheck.in (TESTS_FILE): Use -v instead of --version. + 2000-07-07 brent verner * testsuite/27_io/istream_unformatted.cc (test05): New test. diff --git a/libstdc++-v3/bits/basic_file.h b/libstdc++-v3/bits/basic_file.h index 6037c2f50e0..bffd4efdf8b 100644 --- a/libstdc++-v3/bits/basic_file.h +++ b/libstdc++-v3/bits/basic_file.h @@ -56,6 +56,10 @@ namespace std { public: __basic_file(__c_lock* __lock = 0); + void + __basic_file::_M_open_mode(ios_base::openmode __mode, int& __p_mode, + int& __rw_mode); + // Eqivalent to the normal fopen function. __basic_file* open(const char* __name, ios_base::openmode __mode, int __prot = 0664); diff --git a/libstdc++-v3/config/c_io_libio.cc b/libstdc++-v3/config/c_io_libio.cc index ebb696ed1df..f9a33bb8dfd 100644 --- a/libstdc++-v3/config/c_io_libio.cc +++ b/libstdc++-v3/config/c_io_libio.cc @@ -60,49 +60,10 @@ namespace std { _IO_default_finish(this, 0); } - __basic_file* - __basic_file::sys_open(int __fd, ios_base::openmode __mode) + void + __basic_file::_M_open_mode(ios_base::openmode __mode, int& __p_mode, + int& __rw_mode) { - __basic_file* __retval = NULL; - bool __testi = __mode & ios_base::in; - bool __testo = __mode & ios_base::out; -#ifdef O_BINARY - bool __testb = __mode & ios_base::binary; -#endif - int __p_mode = 0; - int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; - - if (__testi) - { - __p_mode = O_RDONLY; - __rw_mode = _IO_NO_WRITES; - } - if (__testo) - { - __p_mode = O_WRONLY | O_TRUNC; - __rw_mode = _IO_NO_READS; - } -#ifdef O_BINARY - if (__testb) - __p_mode |= O_BINARY; -#endif - - if (__fd >= 0) - { - _fileno = __fd; - int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING; - _flags = (_flags & ~__mask) | (__rw_mode & __mask); - _IO_link_in((_IO_FILE_plus*) this); - __retval = this; - } - return __retval; - } - - __basic_file* - __basic_file::open(const char* __name, ios_base::openmode __mode, - int __prot = 0664) - { - __basic_file* __retval = NULL; #ifdef O_BINARY bool __testb = __mode & ios_base::binary; #endif @@ -110,8 +71,6 @@ namespace std { bool __testo = __mode & ios_base::out; bool __testt = __mode & ios_base::trunc; bool __testa = __mode & ios_base::app; - int __p_mode = 0; - int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; if (!__testi && __testo && !__testt && !__testa) { @@ -147,6 +106,36 @@ namespace std { if (__testb) __p_mode |= O_BINARY; #endif + } + + __basic_file* + __basic_file::sys_open(int __fd, ios_base::openmode __mode) + { + __basic_file* __retval = NULL; + int __p_mode = 0; + int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; + + _M_open_mode(__mode, __p_mode, __rw_mode); + if (__fd >= 0) + { + _fileno = __fd; + int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING; + _flags = (_flags & ~__mask) | (__rw_mode & __mask); + _IO_link_in((_IO_FILE_plus*) this); + __retval = this; + } + return __retval; + } + + __basic_file* + __basic_file::open(const char* __name, ios_base::openmode __mode, + int __prot = 0664) + { + __basic_file* __retval = NULL; + int __p_mode = 0; + int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; + + _M_open_mode(__mode, __p_mode, __rw_mode); if (!_IO_file_is_open(this)) { #if _G_HAVE_IO_FILE_OPEN diff --git a/libstdc++-v3/mkcheck.in b/libstdc++-v3/mkcheck.in index 298fbae33e4..b716a14b5b7 100755 --- a/libstdc++-v3/mkcheck.in +++ b/libstdc++-v3/mkcheck.in @@ -68,16 +68,18 @@ fi #LIB_PATH == where to find the build library binaries. if [ $WHICH != "1" ]; then LIB_PATH="$BUILD_DIR/src/.libs" - CXX="../../gcc/g++ -B../../gcc/" + CXX="../../gcc/g++" + CXX_BASE="-B../../gcc/" elif [ $WHICH -eq 1 ]; then LIB_PATH="$PREFIX_DIR/lib" CXX="$PREFIX_DIR/bin/g++" + CXX_BASE="" fi # gcc compiler flags #CXX_FLAG="-fsquangle -fhonor-std -fnew-exceptions -g -O2 -DDEBUG_ASSERT " #CXX_FLAG="-g -O2 -DDEBUG_ASSERT " -CXX_FLAG="-g -DDEBUG_ASSERT @SECTION_FLAGS@ @SECTION_LDFLAGS@" +CXX_FLAG="-g $CXX_BASE -DDEBUG_ASSERT @SECTION_FLAGS@ @SECTION_LDFLAGS@" # a specific flag(s) to force the use of shared libraries, if any SH_FLAG="" @@ -146,7 +148,7 @@ chmod u+w $TEST_DIR/*.tst # Emit useful info about compiler and platform echo "host: $(uname -mrsv)" >> $RESULTS_FILE -echo "compiler: $($CXX --version)" >> $RESULTS_FILE +echo "compiler: $($CXX -v 2>&1 | tail -1)" >> $RESULTS_FILE echo "compiler flags: $CXX_FLAG" >> $RESULTS_FILE echo "date: $(date +%Y%m%d)" >> $RESULTS_FILE echo "" >> $RESULTS_FILE