public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf.
@ 2004-02-10 15:51 Richard dot Kreckel at Framatome-ANP dot com
  2004-02-10 16:01 ` [Bug libstdc++/14097] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Richard dot Kreckel at Framatome-ANP dot com @ 2004-02-10 15:51 UTC (permalink / raw)
  To: gcc-bugs

Consider a piece code which needs to access the file descriptor of
some istream or ostream (provided file descriptors make sense, as
they do under Unix-like systems).  Sometimes, such functionality can
be essential.  Consider you want to call isatty(3) on the fd, or do
other fancy tricks...

Prior to the deployment of stdio_sync_filebuf, one could write code
like this:

#include <iostream>
#include <fstream>
#include <ext/stdio_filebuf.h>
using namespace std;
typedef __gnu_cxx::stdio_filebuf< char > unix_filebuf_t;
int main()
{
    unix_filebuf_t* buf;
    // cout could be an arbitrary ostream...
    buf = dynamic_cast< unix_filebuf_t* >( cout.rdbuf() );
    if ( buf == NULL ) {
	cout << "Don't know fd of cout." << endl;
    } else {
	cout << "fd of cout == " << buf->fd() << endl;
    }
}


Now, however, this does not work any more, since ios_base::Init::Init()
creates cout as a stdio_sync_filebuf<char> instead of as a
stdio_filebuf<char>.  But stdio_sync_filebuf provides no access to its
underlying stdio FILE.

There are three possible solution (at least):

1) Provide public access to stdio_sync_filebuf<>::_M_file, analogous to
   the fd() method of stdio_filebuf<>.

2) Provide direct access to _M_file's fd.  Sounds odd, but looking at
   the showmanyc() method one sees exactly this.

3) Fix ios_base::sync_with_stdio(bool).  Because when I modify the above
   program by calling that function with false as argument as first
   instruction in main(), the program's behaviour depends on whether it
   is compiled statically or dynamically:
   $ g++-3.4-20040206 test.cc -static && ./a.out
   fd of cout == 1
   $ g++-3.4-20040206 test.cc && ./a.out
   Don't know fd of cout.

-- 
           Summary: Severe disparity between stdio_filebuf and
                    stdio_sync_filebuf.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Richard dot Kreckel at Framatome-ANP dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
@ 2004-02-10 16:01 ` pinskia at gcc dot gnu dot org
  2004-02-10 16:18 ` Richard dot Kreckel at Framatome-ANP dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-10 16:01 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
  2004-02-10 16:01 ` [Bug libstdc++/14097] " pinskia at gcc dot gnu dot org
@ 2004-02-10 16:18 ` Richard dot Kreckel at Framatome-ANP dot com
  2004-02-11  5:05 ` ljrittle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Richard dot Kreckel at Framatome-ANP dot com @ 2004-02-10 16:18 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
  2004-02-10 16:01 ` [Bug libstdc++/14097] " pinskia at gcc dot gnu dot org
  2004-02-10 16:18 ` Richard dot Kreckel at Framatome-ANP dot com
@ 2004-02-11  5:05 ` ljrittle at gcc dot gnu dot org
  2004-02-11  5:22 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ljrittle at gcc dot gnu dot org @ 2004-02-11  5:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ljrittle at gcc dot gnu dot org  2004-02-11 05:05 -------
Yup, I see it on i386-*-freebsd4.9 as well.
Probably related to 14098 but different symbol...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-11 05:05:18
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
                   ` (2 preceding siblings ...)
  2004-02-11  5:05 ` ljrittle at gcc dot gnu dot org
@ 2004-02-11  5:22 ` cvs-commit at gcc dot gnu dot org
  2004-02-11  5:24 ` ljrittle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-11  5:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-11 05:22 -------
Subject: Bug 14097

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ljrittle@gcc.gnu.org	2004-02-11 05:21:57

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/config: linker-map.gnu 

Log message:
	PR libstdc++/14097
	* config/linker-map.gnu: Add typeinfo and typeinfo name for
	__gnu_cxx::stdio_filebuf<char, std::char_traits<char> >.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2324&r2=1.2325
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/linker-map.gnu.diff?cvsroot=gcc&r1=1.55&r2=1.56



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
                   ` (3 preceding siblings ...)
  2004-02-11  5:22 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-11  5:24 ` ljrittle at gcc dot gnu dot org
  2004-02-11  5:35 ` [Bug libstdc++/14097] [3.4 only] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ljrittle at gcc dot gnu dot org @ 2004-02-11  5:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ljrittle at gcc dot gnu dot org  2004-02-11 05:24 -------
Fixed on mainline pending roll to 3.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2004-02-11 05:05:18         |2004-02-11 05:24:51
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] [3.4 only] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
                   ` (4 preceding siblings ...)
  2004-02-11  5:24 ` ljrittle at gcc dot gnu dot org
@ 2004-02-11  5:35 ` pinskia at gcc dot gnu dot org
  2004-02-11  6:04 ` cvs-commit at gcc dot gnu dot org
  2004-02-11  6:23 ` ljrittle at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-11  5:35 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ljrittle at gcc dot gnu dot
                   |dot org                     |org
            Summary|Severe disparity between    |[3.4 only] Severe disparity
                   |stdio_filebuf and           |between stdio_filebuf and
                   |stdio_sync_filebuf.         |stdio_sync_filebuf.
   Target Milestone|---                         |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] [3.4 only] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
                   ` (5 preceding siblings ...)
  2004-02-11  5:35 ` [Bug libstdc++/14097] [3.4 only] " pinskia at gcc dot gnu dot org
@ 2004-02-11  6:04 ` cvs-commit at gcc dot gnu dot org
  2004-02-11  6:23 ` ljrittle at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-11  6:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-11 06:04 -------
Subject: Bug 14097

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	ljrittle@gcc.gnu.org	2004-02-11 06:04:00

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/config: linker-map.gnu 
	libstdc++-v3/include/ext: pool_allocator.h mt_allocator.h 

Log message:
	PR libstdc++/14098
	* config/linker-map.gnu: Add typeinfo and typeinfo name for
	__gnu_cxx::stdio_sync_filebuf<char, std::char_traits<char> >.
	
	PR libstdc++/14097
	* config/linker-map.gnu: Add typeinfo and typeinfo name for
	__gnu_cxx::stdio_filebuf<char, std::char_traits<char> >.
	
	* include/ext/pool_allocator.h: Include c++config.h.
	* include/ext/mt_allocator.h: Include c++config.h.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.31&r2=1.2224.2.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/linker-map.gnu.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.52.4.1&r2=1.52.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/ext/pool_allocator.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.7&r2=1.7.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/ext/mt_allocator.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.8.2.1&r2=1.8.2.2



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/14097] [3.4 only] Severe disparity between stdio_filebuf and stdio_sync_filebuf.
  2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
                   ` (6 preceding siblings ...)
  2004-02-11  6:04 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-11  6:23 ` ljrittle at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ljrittle at gcc dot gnu dot org @ 2004-02-11  6:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ljrittle at gcc dot gnu dot org  2004-02-11 06:23 -------
Rolled to 3.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14097


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-02-11  6:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-10 15:51 [Bug libstdc++/14097] New: Severe disparity between stdio_filebuf and stdio_sync_filebuf Richard dot Kreckel at Framatome-ANP dot com
2004-02-10 16:01 ` [Bug libstdc++/14097] " pinskia at gcc dot gnu dot org
2004-02-10 16:18 ` Richard dot Kreckel at Framatome-ANP dot com
2004-02-11  5:05 ` ljrittle at gcc dot gnu dot org
2004-02-11  5:22 ` cvs-commit at gcc dot gnu dot org
2004-02-11  5:24 ` ljrittle at gcc dot gnu dot org
2004-02-11  5:35 ` [Bug libstdc++/14097] [3.4 only] " pinskia at gcc dot gnu dot org
2004-02-11  6:04 ` cvs-commit at gcc dot gnu dot org
2004-02-11  6:23 ` ljrittle at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).