Some shadow fixes. (more comments)
Nathan Myers
ncm@cantrip.org
Fri May 19 02:31:00 GMT 2000
On Thu, May 18, 2000 at 12:36:21PM -0700, Steven King wrote:
> This patch fixes some typos that prevent compilation and adds some required
> symbols. ...
Some comments below, aside from the inline math functions issue.
> Index: time.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/time.h,v
> retrieving revision 1.1
> diff -r1.1 time.h
> 36c36
> < #undef __need_timespec))
> ---
> > #undef __need_timespec
This one is good.
> Index: wchar.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/wchar.h,v
> retrieving revision 1.1
> diff -r1.1 wchar.h
> 68a69
> > # ifdef __USE_GNU
> 69a71
> > # endif
I think this is good. It wraps wcsdup, which I think is not standard.
> Index: bits/std_cassert.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_cassert.h,v
> retrieving revision 1.2
> diff -r1.2 std_cassert.h
> 39,42c39,45
> < extern "C" {
> < # pragma system_header
> < # include_next <assert.h>
> < }
> ---
> > namespace _C_Swamp {
> > extern "C" {
> > # pragma system_header
> > # include_next <assert.h>
> > }
> > namespace _C_Shadow { }
> > } // close namespace ::_C_Swamp::
I'm none too sure about this one. assert() is weird.
I don't think <assert.h> defines any global names we need to hide,
and the reserved names it defines must be found from wherever the
assert macro appears. We don't know what those reserved names
might be, or how they are declared.
I seem to recall similar remarks apply to <stdarg.h>.
> Index: bits/std_cstdlib.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_cstdlib.h,v
> retrieving revision 1.2
> diff -r1.2 std_cstdlib.h
> 158c158
> < void exit(int __i) // XXX must define correctly for C++, like atexit().
> ---
> > inline void exit(int __i) // XXX must define correctly for C++, like atexit().
> 172c172
> < size_t __size, int (*__cmp)(const void*, const void*))
> ---
> > size_t __size, int (*__cmp)(const void*, const void*))
> 180c180
> < int (*__cmp)(const void*, const void*))
> ---
> > int (*__cmp)(const void*, const void*))
> 188c188
> < { _div_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
> ---
> > { div_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
> 191,192c191,196
> < inline ldiv_t ldiv(long __num, long __den)
> < { _ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
> ---
> > inline ldiv_t ldiv(long __n, long __d)
> > { ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
> > inline long abs(long __x)
> > { return __x >= 0 ? __x : -__x; }
> > inline ldiv_t div(long __n, long __d)
> > { ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
> 212c216
> < using ::std::abs;
> ---
> > // using ::std::abs;
Most of the above looks good, except perhaps abs(). (At this time
of the morning I'm not sure.)
> Index: bits/std_ctime.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_ctime.h,v
> retrieving revision 1.2
> 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::.
> Index: bits/std_cwchar.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_cwchar.h,v
> retrieving revision 1.2
> diff -r1.2 std_cwchar.h
> 101a102
> > #ifdef __USE_GNU
> 102a104
> > #endif
> 215a218
> > #ifdef __USE_GNU
> 216a220
> > #endif
This wraps more instances of wcsdup, which seems kosher.
Nathan Myers
ncm at cantrip dot org
More information about the Libstdc++
mailing list