This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Gthreads patch to disable static initializer macros
Jon,
> On 10 February 2012 14:48, Rainer Orth wrote:
>> I've also noticed one feature of your patch that I don't like:
>> __GTHREAD_{MUTEX,COND}_INIT_FUNCTION ignore the return values of
>> pthread_{mutex,cond}_init_function instead of passing them on as all
>> other gthr-posix.h functions do. ?This might lead to bad error handling,
>> and my previous patch (based on an older version of yours you had
>> attached to the PR) changed them to return int instead. ?I suppose
>> changing this now is out of question, and this is left as 4.8 material.
>
> I didn't like that feature of the patch much either, but the signature
> of the mutex_init function is specified in gthr.h:
>
> __GTHREAD_MUTEX_INIT_FUNCTION
> some systems can't initialize a mutex without a
> function call. On such systems, define this to a
> function which looks like this:
> void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
>
> The recursive one says it should have the same signature, and I (maybe
I don't see this, neither in gthr.h nor in gthr-posix.h.
> wrongly) assumed the cond_init one should too.
I don't think this is cast in stone: the gthr*.h headers aren't
installed in a public place and aren't considered an external interface
to the best of my knowledge, so it should be possible to change.
Currently, __GTHREAD_MUTEX_INIT_FUNCTION is only used in libgcc,
libgfortran, and libstdc++ (and __GTHREAD_COND_INIT_FUNCTION only in
libstdc++), so changing the 13 calls is doable.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University