[PATCH]: fix PTHREAD_ONCE_INIT when using -ansi

Bruce Korb bkorb@gnu.org
Wed Sep 27 16:23:00 GMT 2006


Kaveh R. Ghazi wrote:
> A couple of notes: The fix must not be applied on solaris 10, I found

>  /*
> + * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
> + *  fields of the pthread_once_t structure, which are of type
> + *  upad64_t, which itself is typedef'd to int64_t, but with __STDC__
> + *  defined (e.g. by -ansi) it is a union. So change the initializer
> + *  to "{0}" instead.  This test relies on solaris_once_init_1.
> + */
> +fix = {
> +    hackname = solaris_once_init_2;
> +    select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
> +    files = pthread.h;
> +    /*
> +     * On Solaris 10, this fix is unnecessary because upad64_t is
> +     * always defined correctly regardless of the definition of the
> +     * __STDC__ macro.
> +     */
> +    mach = '*-*-solaris2.1[0-9]*';
> +    not_machine = true;

This will select all OS-es other than solaris2.10 and following.
How about:

     mach = '*-*-solaris2.[1-9]', '*-*-solaris2.[1-9][!0-9]*';

That will catch all pre-10 Solari, regardless of any suffix after
the 5.N gotten from `uname -r`.  (One has to ask, "Why '!' and not '^'?"
Guess:  '^' is the pipe operator, as everyone should know. ;)

Cheers - Bruce



More information about the Gcc-patches mailing list