*ping* generic atomicity.h
Danny Smith
danny_r_smith_2001@yahoo.co.nz
Wed Jan 1 09:32:00 GMT 2003
The patch presented here:
http://gcc.gnu.org/ml/libstdc++/2002-12/msg00015.html
does not work on i386-pc-mingw32 which does need
__GTHREAD_MUTEX_INIT_FUNCTION.
The main problem is with lack of support for __attribute__((weak)) but
there are other problmes as well. See annotated patch below,
Another query:
cpu_include_dir defaults to the cpu part of the target triplet.
But doesn't that correspond to the -mcpu or -mtune default rather than
to the -march default. In the case of generic vs i486 atomicity.h, the
selection should be based on the default instruction set -- which is
__i386__ -- not the default tuning??
>
>What do you think?
>
>
>Index: config/cpu/generic/atomicity.h
>===================================================================
>RCS file:
/home/pme/Repositories/GCC/gcc/libstdc++-v3/config/cpu/generic/atomicity.h,v
>retrieving revision 1.4
>diff -u -r1.4 atomicity.h
>--- config/cpu/generic/atomicity.h 8 Nov 2002 19:24:41 -0000 1.4
>+++ config/cpu/generic/atomicity.h 26 Nov 2002 18:36:59 -0000
>@@ -37,19 +37,34 @@
> namespace __gnu_cxx
> {
> __gthread_mutex_t _Atomic_add_mutex __attribute__ ((__weak__))
>- = __GTHREAD_MUTEX_INIT;
>+#ifdef __GTHREAD_MUTEX_INIT
>+ = __GTHREAD_MUTEX_INIT
>+#endif
__attribute__((weak)) is not supported on i386-pc-mingw or cygwin, hence get
multiple definition problem. Make extern declaration and define in
src/misc-inst.cc??
>+ ;
>+
>+#ifndef __GTHREAD_MUTEX_INIT
>+ #define __GTHREAD_NEED_MUTEX_ONCE_FUNCTION
>+ __gthread_once_t _Atomic_add_mutex_once __attribute__ ((__weak__))
>+ = __GTHREAD_ONCE_INIT;
Ditto.
>+ static void __gthread_atomic_add_mutex_once();
static function declaration, but missing definition when included by
any file _except_ src/misc-inst.cc. Should this function be inlined here
rather than definition in src/misc-inst.cc.
==snip===;
>Index: src/misc-inst.cc
>===================================================================
>RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/src/misc-inst.cc,v
>retrieving revision 1.20
>diff -u -r1.20 misc-inst.cc
>--- src/misc-inst.cc 5 Nov 2002 19:17:37 -0000 1.20
>+++ src/misc-inst.cc 26 Nov 2002 18:36:05 -0000
>@@ -87,3 +87,14 @@
> string*, __false_type);
> #endif
> } // namespace std
>+
>+namespace __gnu_cxx
>+{
>+ #ifdef __GTHREAD_NEED_MUTEX_ONCE_FUNCTION
>+ // generic atomicity.h without static initialization
>+ static void __gthread_atomic_add_mutex_once()
>+ {
>+ __GTHREAD_MUTEX_INIT_FUNCTION (_Atomic_add_mutex);
Should be __GTHREAD_MUTEX_INIT_FUNCTION (&_Atomic_add_mutex), as per
description in gthr.h and implementation in, eg., gthr-win32.h.
Danny
http://movies.yahoo.com.au - Yahoo! Movies
- What's on at your local cinema?
More information about the Libstdc++
mailing list