Patchwork AIX pthread.h fixincludes

login
register
mail settings
Submitter David Edelsohn
Date June 19, 2012, 2:16 p.m.
Message ID <CAGWvny=QMLwDXO-efUN_zLh5jcWCnQ7ByQwpGnHzhSs_cU7+wQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/165734/
State New
Headers show

Comments

David Edelsohn - June 19, 2012, 2:16 p.m.
AIX 5.2 pthread.h uses the wrong number of braces for more of the
PTHREAD initializers. This patch extends the earlier patch to fix the
other broken macros.

        * inclhack.def (aix_mutex_initializer_1, aix_cond_initializer_1,
        aix_rwlock_initializer): New.
        * fixincl.x: Regenerate.
        * tests/base/pthread.h [AIX_MUTEX_INITIALIZER_1_CHECK,
        AIX_COND_INITIALIZER_1_CHECK,
        AIX_RWLOCK_INITIALIZER_1_CHECK]: New.

Okay?

Thanks, David
Bruce Korb - June 19, 2012, 2:36 p.m.
Hi David,

On Tue, Jun 19, 2012 at 7:16 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
> Okay?

Okay.

Cheers - Bruce

Patch

Index: inclhack.def
===================================================================
--- inclhack.def	(revision 188738)
+++ inclhack.def	(working copy)
@@ -397,7 +397,9 @@ 
 };
 
 /*
- *  pthread.h on AIX defines PTHREAD_ONCE_INIT without enough braces.
+ *  pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
+ *  PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
+ *  braces.
  */
 fix = {
     hackname  = aix_once_init_1;
@@ -425,6 +427,45 @@ 
 		"}\n";
 };
 
+fix = {
+    hackname  = aix_mutex_initializer_1;
+    mach      = "*-*-aix*";
+    files     = "pthread.h";
+    select    = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
+		"\\{ \\\\\n";
+    c_fix     = format;
+    c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
+		"{{ \\\n";
+    test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
+		"{ \\\\\n";
+};
+
+fix = {
+    hackname  = aix_cond_initializer_1;
+    mach      = "*-*-aix*";
+    files     = "pthread.h";
+    select    = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
+		"\\{ \\\\\n";
+    c_fix     = format;
+    c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
+		"{{ \\\n";
+    test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
+		"{ \\\\\n";
+};
+
+fix = {
+    hackname  = aix_rwlock_initializer_1;
+    mach      = "*-*-aix*";
+    files     = "pthread.h";
+    select    = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
+		"\\{ \\\\\n";
+    c_fix     = format;
+    c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
+		"{{ \\\n";
+    test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
+		"{ \\\\\n";
+};
+
 /*
  *  pthread.h on AIX 4.3.3 tries to define a macro without whitspace
  *  which violates a requirement of ISO C.