bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fixes for gcc 3.0


From: Felix Natter
Subject: fixes for gcc 3.0
Date: 22 Jun 2001 15:23:34 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

hi,

I attached a patch which makes Common-C++ 1.4.3 compilable with gcc 3.0.

- remove using-decls in headers (!)
(you should never put a using-declaration in a header)
- I added a std::-prefix even in *.cpp-files. If you want to, you
can replace all these prefixes by doing this:
        using std::cout;
        using std::endl;
or
        using namespace std;
but this can only be done in *.cpp-files (!)
- header-file-fixes (e.g. <iostream.h>=><iostream>, <stdlib.h>=><cstdlib>)
- socket.cpp,slog.h: <strstream> (or <strstream.h> or <strstrea.h>) don't seem
to be used so I removed the #include's
- socket.cpp,slog.cpp: remove std::iostream::init(this)/
std::ostream::init(this) in favor of the corresponding std::iostream (or
std::ostream..)-constructor (the empty std::iostream-constructor is not in
the C++ standard)
- socket.cpp,serial.cpp: missing std::streambuf::setb(...)
=> this is not in the C++ standard (gcc 3.0 does not provide it).
I commented it out but I haven't yet found a "proper" solution
(I posted to comp.lang.c++ but didn't yet get a reply)
- add casts (e.g. startDocumentSAXFunc) in posix/xml.cpp
- common/misc.h:
In file included from mempager.cpp:45:
misc.h:503: friend declaration requires class-key, i.e. `friend class 
   StringTokenizer'
misc.h:588: friend declaration requires class-key, i.e. `friend class 
   StringTokenizer::iterator'
- xmlfetch.cpp:59: buffer needs a cast to (char*)
- demo/tcpthread.cpp: unsetf(
=> unsetf only accepts format-flags (gcc 2.95.x used unsigned long
to represent format-flags and open-modes, so you never got an error
until gcc 3.0, which uses enums, see below)
here is the message I posted to comp.lang.c++ and the reply I got:
"John Harrison" <address@hidden> writes:
> "Felix Natter" <address@hidden> wrote in message
> news:address@hidden
> > hi,
> >
> > when compiling with gcc 3, I get the following error:
> >
> > tcpthread.cpp: In constructor
> `myTCPSession::myTCPSession(cc_TCPSocket&)':
> > tcpthread.cpp:88: no matching function for call to
> `myTCPSession::unsetf(const
> >    std::_Ios_Openmode&)'
> > /opt/gcc3/include/g++-v3/bits/ios_base.h:340: candidates are: void
> >    std::ios_base::unsetf(std::_Ios_Fmtflags)
> >
> > the code is this:
> >
> > myTCPSession::myTCPSession(TCPSocket &server) :
> > TCPSession(NULL, server)
> > {
> > std::cout << "creating session client object" << std::endl;
> > mutex.EnterMutex();
> > ++count;
> > mutex.LeaveMutex();
> >     unsetf(std::ios::binary);
> > }
> >
> > thanks,
> >
> > --
> > Felix Natter
> >
> 
> std::ios::binary isn't a format flag and can't be passed to unsetf. The
> only place you can use std::ios::binary is when you open a stream.
> 
> john

- all these changes make the code compilable with gcc 3.0, but demo/tcp*
fail when compiling with gcc 3.0 (when compiling with gcc 2.95.3
they seem to work just fine).
Nevertheless I *believe* that the changes I made are correct, but some of
your code must be non-standard. 
If you want to track this down, you will have to set up gcc 3.0 as
a secondary compiler (you should probably keep gcc 2.95.x around to make
sure that the code remains compatible with it). If you need help with this,
just tell me.

-- 
Felix Natter

Attachment: CommonC++-1.4.3-gcc3.diff
Description: fixes for gcc 3.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]