This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fixinc for PTHREAD_MUTEX_INITIALIZER
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Subject: fixinc for PTHREAD_MUTEX_INITIALIZER
- From: Bruce Korb <bkorb at pacbell dot net>
- Date: Tue, 26 Jun 2001 18:03:50 -0700
- Organization: Home
On mulling this over some more and looking at this:
/*
* Sun Solaris 2.6 & 7 defines PTHREAD_MUTEX_INITIALIZER with a trailing
* "0" for the last field of the pthread_mutex_t structure, which is
* 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
*/
I have to wonder if the current fix for 2.7 is even the right one.
It seems to me that this might be "more correct":
fix = {
hackname = solaris_mutex_init;
select = '@\(#\)pthread.h' "[ \t]+1.[12]6[ \t]+9[0-9/]+ SMI";
files = pthread.h;
c_fix = format;
c_fix_arg = "#ifdef __STDC__\n"
"%1, {0}}\n"
"#else\n"
"%0\n"
"#endif";
c_fix_arg = "(#define[ \t]+PTHREAD_MUTEX_INITIALIZER.*),[ \t]*0}$";
test_text =
'#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
"#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0}";
};
for those not interested in following the funny formatting,
it would change the single line:
#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0}
into this (approximately):
#if defined( __STDC__ ) && words-are-32-bits-too?
#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, {0}}
#else
#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0}
#endif
Portmeisters?