Patchwork [fixincludes] Fix PTHREAD_*_INITIALIZER on IRIX 6.5

login
register
mail settings
Submitter Rainer Orth
Date Nov. 8, 2010, 10:10 p.m.
Message ID <yddwron1n64.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/70466/
State New
Headers show

Comments

Rainer Orth - Nov. 8, 2010, 10:10 p.m.
On IRIX 6.5, the following tests fail:

FAIL: gcc.dg/pthread-init-1.c (test for excess errors)

Excess errors:
In file included from /vol/gcc/src/hg/trunk/irix/gcc/testsuite/gcc.dg/pthread-init-1.c:14:0:
/vol/gcc/src/hg/trunk/irix/gcc/testsuite/gcc.dg/pthread-init-common.h:15:3: warning: missing braces around initializer [-Wmissing-braces]
/vol/gcc/src/hg/trunk/irix/gcc/testsuite/gcc.dg/pthread-init-common.h:15:3: warning: (near initialization for 'pmutex.__D') [-Wmissing-braces]
/vol/gcc/src/hg/trunk/irix/gcc/testsuite/gcc.dg/pthread-init-common.h:27:3: warning: missing braces around initializer [-Wmissing-braces]
/vol/gcc/src/hg/trunk/irix/gcc/testsuite/gcc.dg/pthread-init-common.h:27:3: warning: (near initialization for 'pcond.__D') [-Wmissing-braces]
/vol/gcc/src/hg/trunk/irix/gcc/testsuite/gcc.dg/pthread-init-common.h:30:3: warning: missing braces around initializer [-Wmissing-braces]
/vol/gcc/src/hg/trunk/irix/gcc/testsuite/gcc.dg/pthread-init-common.h:30:3: warning: (near initialization for 'prwlock.__D') [-Wmissing-braces]

FAIL: gcc.dg/pthread-init-2.c (test for excess errors)

The following patch fixes this by adding another level of braces to the
initializers in <pthread.h>.  It passes make check in fixincludes and
<pthread.h> is fixed as expected.

mips-sgi-irix6.5 bootstrap still running, ok for mainline if it passes?

	Rainer


2010-11-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* inclhack.def (irix_pthread_init): New fix.
	* fixincl.x: Regenerate.
	* tests/base/pthread.h [IRIX_PTHREAD_INIT_CHECK]: New test.
Bruce Korb - Nov. 8, 2010, 10:19 p.m.
On 11/08/10 14:10, Rainer Orth wrote:
> On IRIX 6.5, the following tests fail:

Is it really so painfully difficult for vendors to define
proper initializers for pthread structures?  Oh, well.....

Looks completely correct to me.  OK by me for all active
development branches.

Regards, Bruce
> 2010-11-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	* inclhack.def (irix_pthread_init): New fix.
> 	* fixincl.x: Regenerate.
> 	* tests/base/pthread.h [IRIX_PTHREAD_INIT_CHECK]: New test.

Patch

diff -r 87ba044c9a41 fixincludes/inclhack.def
--- a/fixincludes/inclhack.def	Mon Nov 08 20:02:25 2010 +0100
+++ b/fixincludes/inclhack.def	Mon Nov 08 20:36:36 2010 +0100
@@ -2484,6 +2484,24 @@ 
 
 
 /*
+ *  IRIX 6.5 PTHREAD_*_INITIALIZER need an additional level of braces in
+ *  <pthread.h>.
+ */
+fix = {
+    hackname    = irix_pthread_init;
+    files       = pthread.h;
+    select      = "^(#define[ \t]+PTHREAD_.*_INITIALIZER[ \t]+)(\\{ 0 \\})";
+
+    mach	= "mips-sgi-irix6.5";
+    c_fix       = format;
+    c_fix_arg   = "%1{ %2 }";
+    test_text   = "#define PTHREAD_MUTEX_INITIALIZER	{ 0 }\n"
+		  "#define PTHREAD_COND_INITIALIZER	{ 0 }\n"
+		  "#define PTHREAD_RWLOCK_INITIALIZER	{ 0 }";
+};
+
+
+/*
  *  IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
  *  Various socket function prototypes use different types instead,
  *  depending on the API in use (BSD, XPG4/5), but the socklen_t
diff -r 87ba044c9a41 fixincludes/tests/base/pthread.h
--- a/fixincludes/tests/base/pthread.h	Mon Nov 08 20:02:25 2010 +0100
+++ b/fixincludes/tests/base/pthread.h	Mon Nov 08 20:36:36 2010 +0100
@@ -96,6 +96,13 @@ 
 #endif  /* GLIBC_MUTEX_INIT_CHECK */
 
 
+#if defined( IRIX_PTHREAD_INIT_CHECK )
+#define PTHREAD_MUTEX_INITIALIZER	{ { 0 } }
+#define PTHREAD_COND_INITIALIZER	{ { 0 } }
+#define PTHREAD_RWLOCK_INITIALIZER	{ { 0 } }
+#endif  /* IRIX_PTHREAD_INIT_CHECK */
+
+
 #if defined( PTHREAD_INCOMPLETE_STRUCT_ARGUMENT_CHECK )
 extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask);
 #endif  /* PTHREAD_INCOMPLETE_STRUCT_ARGUMENT_CHECK */