This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-3.1: problems with filebuf constructor for FILE*


Benjamin Kosnik wrote:

I find that __c_file_type (as used in <bits/basic_file.h>) is
undefined when I
compile code that includes <ext/stdio_filebuf.h>. Introducing my own
"#define __c_file_type std::__c_file" seems to fix that.

Then I run into the problem that <bits/basic_file.h> is looking for _M_cfile
member variable that is no longer there, as shown below (at the bottom
of this e-mail). Adding my own
"#define _GLIBCPP_BASIC_FILE_ENCAPSULATION 1" seems to
alleviate that confusion.

Now I'm struggling with a conflict between const is_open methods at
one level
that invoke non-const is_open methods, so I see the warning:

You'll need to provide a minimal testcase, please.
This, for instance, works:

#include <ext/stdio_filebuf.h>

int main()
{
using namespace std;
using __gnu_cxx::stdio_filebuf;

stdio_filebuf<char> one(0, ios_base::in, true, BUFSIZ);

__c_file* f = fopen("tmp", "rw");
stdio_filebuf<char> two(f, ios_base::in, BUFSIZ);

return 0;
}


No, that doesn't compile for me. I saved the above program into test.cc and
compiled with plain vanilla gcc-3.1 on RedHat 6.2, and I got the following
error messages.

Scott Johnston

------------------------------------------------

gcc test.cc
In file included from /usr/local/include/g++-v3/fstream:48,
from /usr/local/include/g++-v3/ext/stdio_filebuf.h:30,
from test.cc:1:
/usr/local/include/g++-v3/bits/basic_file.h:52: parse error before `{' token
/usr/local/include/g++-v3/bits/basic_file.h:57: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:57: function `int std::overflow(int
= -1)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:60: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:60: function `int std::underflow()'
is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:63: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:63: function `int std::uflow()' is
initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:66: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:66: function `int
std::pbackfail(int)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:69: parse error before `*' token
/usr/local/include/g++-v3/bits/basic_file.h:69: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:69: function `streamsize
std::xsputn(...)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:72: `_CharT' was not declared in
this scope
/usr/local/include/g++-v3/bits/basic_file.h:72: `__s' was not declared in this
scope
/usr/local/include/g++-v3/bits/basic_file.h:72: parse error before `)' token
/usr/local/include/g++-v3/bits/basic_file.h:72: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:72: function `streamsize
std::xsgetn(...)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:76: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:76: function `streamoff
std::seekoff(long int, std::_Ios_Seekdir, std::_Ios_Openmode =
std::operator|(std::_Ios_Openmode,
std::_Ios_Openmode)((std::_Ios_Openmode)8, (std::_Ios_Openmode)16))' is
initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:80: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:80: function `streamoff
std::seekpos(long int, std::_Ios_Openmode =
std::operator|(std::_Ios_Openmode,
std::_Ios_Openmode)((std::_Ios_Openmode)8, (std::_Ios_Openmode)16))' is
initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:83: `_CharT' was not declared in
this scope
/usr/local/include/g++-v3/bits/basic_file.h:83: `__b' was not declared in this
scope
/usr/local/include/g++-v3/bits/basic_file.h:83: parse error before `)' token
/usr/local/include/g++-v3/bits/basic_file.h:83: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:83: function `std::streambuf*
std::setbuf(...)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:86: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:86: function `int std::sync()' is
initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:89: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:89: function `int std::doallocate()
' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:92: `_CharT' was not declared in
this scope
/usr/local/include/g++-v3/bits/basic_file.h:92: `__s' was not declared in this
scope
/usr/local/include/g++-v3/bits/basic_file.h:92: parse error before `)' token
/usr/local/include/g++-v3/bits/basic_file.h:92: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:92: function `streamsize
std::sys_read(...)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:95: parse error before `*' token
/usr/local/include/g++-v3/bits/basic_file.h:95: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:95: function `streamsize
std::sys_write(...)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:98: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:98: function `streamoff
std::sys_seek(long int, std::_Ios_Seekdir)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:101: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:101: function `int std::sys_close()
' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:104: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:104: function `int
std::sys_stat(void*)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:107: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:107: function `int std::showmanyc()
' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:110: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:110: function `void
std::imbue(void*)' is initialized like a variable
/usr/local/include/g++-v3/bits/basic_file.h:133: parse error before `*' token
/usr/local/include/g++-v3/bits/basic_file.h:136: parse error before `::' token
/usr/local/include/g++-v3/bits/basic_file.h:141: type specifier omitted for
parameter `ios_base'
/usr/local/include/g++-v3/bits/basic_file.h:141: parse error before `::' token
/usr/local/include/g++-v3/bits/basic_file.h:148: parse error before `::' token
/usr/local/include/g++-v3/bits/basic_file.h:185: `streamsize' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:185: parse error before `(' token
/usr/local/include/g++-v3/bits/basic_file.h:191: `streamsize' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:191: declaration of `int
__basic_file<_CharT>::streamsize'
/usr/local/include/g++-v3/bits/basic_file.h:185: conflicts with previous
declaration `int __basic_file<_CharT>::streamsize'
/usr/local/include/g++-v3/bits/basic_file.h:191: parse error before `(' token
/usr/local/include/g++-v3/bits/basic_file.h:197: `streamoff' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:197: parse error before `(' token
/usr/local/include/g++-v3/bits/basic_file.h:204: `streamoff' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:204: declaration of `int
__basic_file<_CharT>::streamoff'
/usr/local/include/g++-v3/bits/basic_file.h:197: conflicts with previous
declaration `int __basic_file<_CharT>::streamoff'
/usr/local/include/g++-v3/bits/basic_file.h:204: parse error before `(' token
/usr/local/include/g++-v3/bits/basic_file.h:207: `streambuf' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:207: parse error before `*' token
/usr/local/include/g++-v3/bits/basic_file.h:220: `streamsize' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:220: declaration of `int
__basic_file<_CharT>::streamsize'
/usr/local/include/g++-v3/bits/basic_file.h:185: conflicts with previous
declaration `int __basic_file<_CharT>::streamsize'
/usr/local/include/g++-v3/bits/basic_file.h:220: parse error before `(' token
/usr/local/include/g++-v3/bits/basic_file.h:226: `streamsize' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:226: declaration of `int
__basic_file<_CharT>::streamsize'
/usr/local/include/g++-v3/bits/basic_file.h:185: conflicts with previous
declaration `int __basic_file<_CharT>::streamsize'
/usr/local/include/g++-v3/bits/basic_file.h:226: parse error before `(' token
/usr/local/include/g++-v3/bits/basic_file.h:232: `streamoff' declared as a
`virtual' field
/usr/local/include/g++-v3/bits/basic_file.h:232: declaration of `int
__basic_file<_CharT>::streamoff'
/usr/local/include/g++-v3/bits/basic_file.h:197: conflicts with previous
declaration `int __basic_file<_CharT>::streamoff'
/usr/local/include/g++-v3/bits/basic_file.h:232: parse error before `(' token
/usr/local/include/g++-v3/bits/basic_file.h:246: parse error before `}' token
In file included from /usr/local/include/g++-v3/bits/basic_file.h:250,
from /usr/local/include/g++-v3/fstream:48,
from /usr/local/include/g++-v3/ext/stdio_filebuf.h:30,
from test.cc:1:
/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/basic_file_model.h:38: parse
error before `*' token
/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/basic_file_model.h:38: confused by earlier errors, bailing out



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]