This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: fix PTHREAD_ONCE_INIT when using -ansi
- From: Bruce Korb <bkorb at gnu dot org>
- To: "Kaveh R. Ghazi" <ghazi at caipclassic dot rutgers dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Sep 2006 09:21:37 -0700
- Subject: Re: [PATCH]: fix PTHREAD_ONCE_INIT when using -ansi
- References: <200609271553.k8RFrr67020060@caipclassic.rutgers.edu>
- Reply-to: bkorb at gnu dot org
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