Some shadow fixes. (more comments)

Nathan Myers ncm@cantrip.org
Sat May 20 04:35:00 GMT 2000


On Fri, May 19, 2000 at 05:52:13AM -0700, Steven King wrote:
> Nathan wrote:
> > Steven wrote:
> > > Index: bits/std_ctime.h
> > > diff -r1.2 std_ctime.h
> > > 121a122,126
> > > >       using ::std::ctime;
> > > >       using ::std::clock;
> > > >       using ::std::difftime;
> > > >       using ::std::mktime;
> > > >       using ::std::time;
> > 
> > I don't think these are appropriate.  ::std::ctime was imported
> > into ::std from _C_shadow to begin with, so I think there's no 
> > need to import it back into there again.  Note that the only 
> > names already in the list are the ones defined in std::.
> 
>   Again, I get a error if I include <time.h> and try to reference 
> the above functions in ::.

With 

  #include <time.h>
  #include <stdio.h>
  int main()
  {
    ::time_t t = time((::time_t*)0);
    ::printf("%s\n", ::ctime(&t));
    return 0;
  }

and compile line:
 
  v3/bin/g++ -O2 -ansi -Wall -I v3/include/shadow -I v3/include/cshadow \
    -D_ISOC9X_SOURCE t.cc

I get no errors.  I created my cshadow/ directory on my Linux
machine (glibc-2.1.3, x86) with:

  cd build/i686-pc-linux-gnu/libstdc++-v3
  ../../../gcc/libstdc++-v3/inclosure   \
      -I ../../gcc/include/   -I /usr/include   -G machine/ansi.h   
    | ../../../gcc/libstdc++-v3/mkcshadow
  cp -R cshadow $dest_dir/include
  mv $dest_dir/include/g++-v3/shadow $dest_dir/include

[Note for maintainer of "make install": shadow/ dir should get copied
 to $dest_dir/include.]

The idea for the using-declarations like those cited in your mail is 
that only names actually defined in std:: need to be imported into
namespace _C_legacy::_C_shadow, because if they're already defined 
in _C_legacy, they're inherited by _C_shadow automatically.

What are you doing differently?

Nathan Myers
ncm at cantrip dot org

p.s. Eeek.  I just noticed that shadow/bits/std_cstdlib.h needs a lot 
of work on the exit() functions.



More information about the Libstdc++ mailing list