public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* linux libio status
@ 1997-10-14 23:23 Joe Buck
  1997-10-15  0:06 ` Richard Henderson
  1997-10-15  0:52 ` Olivier Galibert
  0 siblings, 2 replies; 35+ messages in thread
From: Joe Buck @ 1997-10-14 23:23 UTC (permalink / raw)
  To: egcs team

Well, it looks like we *really* need to clean out the old 
$prefix/include/g++ before doing make install, because it seemed
that everyone missed this problem ('cause they all had leftover
headers that were getting used).

Thanks to Mumit's suggestion, I blew away everything under $prefix
and re-installed on my Linux Red Hat 4.2 box -- 971008 plus HJ's
patch adding weak symbols.  The good news is that the failing
test posted here recently now passes.  The problem is that we now get a
number of warnings, even for "hello world".

The problem is this: we are now using the /usr/include/libio.h
rather than the one from egcs.  The version included with Red Hat
(libc 5.3.12) has the text

#ifndef NULL
#if !defined(__cplusplus) || defined(__GNUC__)
#define NULL ((void*)0)
#else
#define NULL (0)
#endif
#endif

Now, egcs has been fixed so that C++ no longer freely casts (void *)0
to other pointers, so this now gives lots of warnings.

e.g. for "hello world", or
-----
#include <iostream.h>

main () {
        cout << "Hello, world\n";
}
-----

In file included from /usr/local/egcs/include/g++/iostream.h:31,
                 from hello.cc:1:
/usr/local/egcs/include/g++/streambuf.h:394: warning: invalid type `void
*' for default argument to `ios *'
In file included from hello.cc:1:
/usr/local/egcs/include/g++/iostream.h:50: warning: invalid type `void *'
for default argument to `ostream *'
/usr/local/egcs/include/g++/iostream.h: In method `int ostream::opfx()':
/usr/local/egcs/include/g++/iostream.h:53: warning: implicit declaration
of function `int _IO_flockfile(...)'
/usr/local/egcs/include/g++/iostream.h: In method `void ostream::osfx()':
/usr/local/egcs/include/g++/iostream.h:54: warning: implicit declaration
of function `int _IO_funlockfile(...)'
/usr/local/egcs/include/g++/iostream.h: At top level:
/usr/local/egcs/include/g++/iostream.h:123: warning: invalid type `void *'
for default argument to `ostream *'
/usr/local/egcs/include/g++/iostream.h:230: warning: invalid type `void *'
for default argument to `ostream *'

If we force NULL to be 0 as in
c++ -DNULL=0 hello.cc

we are down to

/usr/local/egcs/include/g++/iostream.h: In method `int ostream::opfx()':
In file included from hello.cc:1:
/usr/local/egcs/include/g++/iostream.h:53: warning: implicit declaration
of function `int _IO_flockfile(...)'
/usr/local/egcs/include/g++/iostream.h: In method `void ostream::osfx()':
/usr/local/egcs/include/g++/iostream.h:54: warning: implicit declaration
of function `int _IO_funlockfile(...)'

We need to silence these warnings.  For the NULL, I suggest a global
s/NULL/0/ in the C++ iostreams headers.  There is no reason to write
NULL, it is just a source of problems like this (*especially* since
we have changed C++ to be strict about void*).

I don't know where the missing declarations should go; perhaps HJ has
an idea.  One possibility is to just define them to null when the
older library is in use.  The new libio.h could have its locking
functions split off into a new header, which always gets installed.
Or something; I'm sure HJ and/or Ulrich have better ideas.

Joe




^ permalink raw reply	[flat|nested] 35+ messages in thread
[parent not found: <199710150623.XAA06491.cygnus.egcs@atrus.synopsys.com>]
* Re: linux libio status
@ 1997-10-15 12:10 Greg Galloway
  1997-10-16 12:53 ` H.J. Lu
  0 siblings, 1 reply; 35+ messages in thread
From: Greg Galloway @ 1997-10-15 12:10 UTC (permalink / raw)
  To: egcs

I previously wrote:
> By the way strstream seems to be broken if you let it dynamically allocate
> it's own buffer.  The following program gives a segmentation fault:
> 
> #include <cstdlib>
> #include <string>
> #include <strstream.h>
> main()
> {
>   ostrstream os;
>   os << "testing " << 123 << ends;
>   string s = os.str();
>   exit(0);
> }
> 

My previous problems with strstream and dynamically allocated buffers appears
to be gone.

Upon looking at the call trace in gdb this program goes into an infinite 
recursion on the basic_string<> ctor until __builtin_new() finally dies 
giving a segmentation fault.

Greg
----
Gregory L. Galloway
Research Scientist I

http://eoeml.gtri.gatech.edu/home/gregg/

^ permalink raw reply	[flat|nested] 35+ messages in thread
* Re: linux libio status
@ 1997-10-15 12:10 Greg Galloway
  1997-10-15 20:16 ` Joe Buck
  1997-10-16 12:58 ` H.J. Lu
  0 siblings, 2 replies; 35+ messages in thread
From: Greg Galloway @ 1997-10-15 12:10 UTC (permalink / raw)
  To: egcs

Richard Henderson wrote:
> Joe Buck wrote:
> > We need to silence these warnings.  For the NULL, I suggest a global
> > s/NULL/0/ in the C++ iostreams headers.
> 
> That's a reasonable solution.  In my version of the libio patches, 
> I make _G_config.h undef and redefine NULL to avoid this problem.
> 
> > I don't know where the missing declarations should go; perhaps HJ has
> > an idea.
> 
> I worked around this for Linux/Alpha by providing versions of 
> libc-lock.h and stdio-lock.h to install with the newly built library.
> Perhaps we do the same thing for Intel?

I worked around this by copying egcs-971009/libio/libio.h into
/usr/include/g++.

By the way strstream seems to be broken if you let it dynamically allocate
it's own buffer.  The following program gives a segmentation fault:

#include <cstdlib>
#include <string>
#include <strstream.h>
main()
{
  ostrstream os;
  os << "testing " << 123 << ends;
  string s = os.str();
  exit(0);
}

This one used to work for me under gcc-2.7.2.1 but is also broken with egcs:

#include <cstdlib>
#include <string>
#include <strstream.h>
main()
{
  char buf[100]
  ostrstream os(buf, 100);
  os << "testing " << 123 << ends;
  string s = os.str();
  exit(0);
}

Greg
----
Gregory L. Galloway
Research Scientist I

http://eoeml.gtri.gatech.edu/home/gregg/

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

end of thread, other threads:[~1997-10-17 12:53 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-14 23:23 linux libio status Joe Buck
1997-10-15  0:06 ` Richard Henderson
1997-10-15  0:52 ` Olivier Galibert
1997-10-15  8:25   ` [ECGS] " chip
1997-10-15 11:12   ` Joe Buck
1997-10-15 12:10     ` Olivier Galibert
1997-10-15 16:51       ` [ECGS] " chip
1997-10-15 20:16       ` Joe Buck
1997-10-15 20:16         ` Olivier Galibert
1997-10-16 12:53           ` Pal Engstad
1997-10-15 11:12   ` Peter Seebach
1997-10-15 20:16     ` Joe Buck
     [not found]   ` <199710151419.JAA20162.cygnus.egcs@monolith.solon.com>
1997-10-15 16:51     ` Jason Merrill
1997-10-15 20:16       ` Peter Seebach
1997-10-15 22:29         ` Jason Merrill
1997-10-16  8:31           ` Peter Seebach
1997-10-16 15:19             ` Jason Merrill
1997-10-16 12:53               ` Peter Seebach
1997-10-16 15:19       ` Paul Koning
     [not found] <199710150623.XAA06491.cygnus.egcs@atrus.synopsys.com>
1997-10-15  2:10 ` Jason Merrill
1997-10-15  9:15   ` Joe Buck
1997-10-15 11:12     ` Per Bothner
1997-10-15 14:33       ` Joe Buck
1997-10-15 16:51         ` Per Bothner
     [not found]         ` <199710152351.QAA02138.cygnus.egcs@cygnus.com>
1997-10-16  1:51           ` Jason Merrill
1997-10-16 12:58             ` Joe Buck
1997-10-17 12:53               ` Jason Merrill
1997-10-16 12:58             ` Alexandre Oliva
1997-10-15 16:51       ` Peter Seebach
1997-10-15 14:33     ` Richard Henderson
1997-10-15 12:10 Greg Galloway
1997-10-16 12:53 ` H.J. Lu
1997-10-15 12:10 Greg Galloway
1997-10-15 20:16 ` Joe Buck
1997-10-16 12:58 ` H.J. Lu

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).