From 1fda9d7bbba123dde51fdd4c1d2056ee1e0cf193 Mon Sep 17 00:00:00 2001
From: Roger Sayle <roger@eyesopen.com>
Date: Sun, 21 Nov 2004 16:25:07 +0000
Subject: [PATCH] inclhack.def (alpha_pthread_init): New fix.

	* inclhack.def (alpha_pthread_init): New fix.
	* fixincl.x: Regenerate.
	* tests/base/pthread.h: Update for new test.

Co-Authored-By: Bruce Korb <bkorb@gnu.org>

From-SVN: r90981
---
 fixincludes/ChangeLog            |  7 ++++
 fixincludes/fixincl.x            | 57 +++++++++++++++++++++++++++++---
 fixincludes/inclhack.def         | 44 ++++++++++++++++++++++++
 fixincludes/tests/base/pthread.h | 21 ++++++++++++
 4 files changed, 124 insertions(+), 5 deletions(-)

diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 9794c668f7b8..ace5d2a75e62 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,10 @@
+2004-11-20  Roger Sayle  <roger@eyesopen.com>
+	    Bruce Korb  <bkorb@gnu.org>
+
+	* inclhack.def (alpha_pthread_init): New fix.
+	* fixincl.x: Regenerate.
+	* tests/base/pthread.h: Update for new test.
+
 2004-11-15  Bruce Korb  <bkorb@gnu.org>
 
 	* fixincl.c(fix_with_system): correct misuse of variables and
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 3700290c2c07..ff772117d1e1 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  Saturday November 13, 2004 at 08:30:08 PM UTC
+ * It has been AutoGen-ed  Sunday November 21, 2004 at 09:09:46 AM MST
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT CVS-MERGE THIS FILE, EITHER Sat Nov 13 20:30:09 UTC 2004
+/* DO NOT CVS-MERGE THIS FILE, EITHER Sun Nov 21 09:09:46 MST 2004
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 176 fixup descriptions.
+ * This file contains 177 fixup descriptions.
  *
  * See README for more information.
  *
@@ -1083,6 +1083,47 @@ static const char* apzAlpha_Pthread_GccPatch[] = {
 %0",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Alpha_Pthread_Init fix
+ */
+tSCC zAlpha_Pthread_InitName[] =
+     "alpha_pthread_init";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zAlpha_Pthread_InitList[] =
+  "|pthread.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzAlpha_Pthread_InitMachs[] = {
+        "alpha*-dec-osf*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zAlpha_Pthread_InitSelect0[] =
+       " \\* @\\(#\\)\\$RCSfile: pthread\\.h,v \\$ \\$Revision: 1\\.1\\.33\\.21 \\$ \\(DEC\\) \\$Date: 2000/08/15 15:30:13 \\$";
+
+#define    ALPHA_PTHREAD_INIT_TEST_CT  1
+static tTestDesc aAlpha_Pthread_InitTests[] = {
+  { TT_EGREP,    zAlpha_Pthread_InitSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Alpha_Pthread_Init
+ */
+static const char* apzAlpha_Pthread_InitPatch[] = { "sed",
+    "-e", "s@MVALID\\(.*\\)A}@MVALID\\1A, 0, 0, 0, 0, 0, 0 }@\n\
+s@MVALID\\(.*\\)_}@MVALID\\1_, 0, 0, 0, 0 }@\n\
+s@CVALID\\(.*\\)A}@CVALID\\1A, 0, 0, 0, 0 }@\n\
+s@CVALID\\(.*\\)_}@CVALID\\1_, 0, 0 }@\n\
+s@WVALID\\(.*\\)A}@WVALID\\1A, 0, 0, 0, 0, 0, 0, 0, 0, 0 }@\n\
+s@WVALID\\(.*\\)_}@WVALID\\1_, 0, 0, 0, 0, 0, 0, 0 }@\n",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Alpha_Sbrk fix
@@ -7031,9 +7072,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          205
+#define REGEX_COUNT          206
 #define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT            176
+#define FIX_COUNT            177
 
 /*
  *  Enumerate the fixes
@@ -7063,6 +7104,7 @@ typedef enum {
     ALPHA_PARENS_FIXIDX,
     ALPHA_PTHREAD_FIXIDX,
     ALPHA_PTHREAD_GCC_FIXIDX,
+    ALPHA_PTHREAD_INIT_FIXIDX,
     ALPHA_SBRK_FIXIDX,
     ALPHA_WCHAR_FIXIDX,
     AVOID_BOOL_DEFINE_FIXIDX,
@@ -7338,6 +7380,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      ALPHA_PTHREAD_GCC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aAlpha_Pthread_GccTests,   apzAlpha_Pthread_GccPatch, 0 },
 
+  {  zAlpha_Pthread_InitName,    zAlpha_Pthread_InitList,
+     apzAlpha_Pthread_InitMachs,
+     ALPHA_PTHREAD_INIT_TEST_CT, FD_MACH_ONLY,
+     aAlpha_Pthread_InitTests,   apzAlpha_Pthread_InitPatch, 0 },
+
   {  zAlpha_SbrkName,    zAlpha_SbrkList,
      apzAlpha_SbrkMachs,
      ALPHA_SBRK_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 828ee06eca61..37f231172836 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -705,6 +705,50 @@ fix = {
 		"#endif";
 };
 
+/*
+ * Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
+ * incorrectly, specifying less fields in the initializers than are
+ * defined in the corresponding structure types.  Use of these macros
+ * in user code results in spurious warnings.
+ */
+fix = {
+    hackname  = alpha_pthread_init;
+    files     = pthread.h;
+    select    = ' \* @\(#\)\$' 'RCSfile: pthread\.h,v \$'
+                ' \$'  'Revision: 1\.1\.33\.21 \$ \(DEC\)'
+                ' \$'  'Date: 2000/08/15 15:30:13 \$';
+    mach      = "alpha*-dec-osf*";
+    sed       = "s@MVALID\\(.*\\)A}@MVALID\\1A, 0, 0, 0, 0, 0, 0 }@\n"
+                "s@MVALID\\(.*\\)_}@MVALID\\1_, 0, 0, 0, 0 }@\n"
+                "s@CVALID\\(.*\\)A}@CVALID\\1A, 0, 0, 0, 0 }@\n"
+                "s@CVALID\\(.*\\)_}@CVALID\\1_, 0, 0 }@\n"
+                "s@WVALID\\(.*\\)A}@WVALID\\1A, 0, 0, 0, 0, 0, 0, 0, 0, 0 }@\n"
+                "s@WVALID\\(.*\\)_}@WVALID\\1_, 0, 0, 0, 0, 0, 0, 0 }@\n";
+    test_text = "/*\n"
+                " * @(#)\\$"  "RCSfile: pthread.h,v \\$ \\$"
+                "Revision: 1.1.33.21 \\$ (DEC) \\$"
+                "Date: 2000/08/15 15:30:13 \\$\n"
+                " */\n"
+"#ifndef _PTHREAD_NOMETER_STATIC\n"
+"# define PTHREAD_MUTEX_INITIALIZER \\\n"
+"    {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
+"# define PTHREAD_COND_INITIALIZER \\\n"
+"    {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA}\n"
+"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
+"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
+"#else\n"
+"# define PTHREAD_MUTEX_INITIALIZER {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
+"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
+"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {0, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
+"#endif\n\n"
+"#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA}\n"
+"#define PTHREAD_RWLOCK_INITWITHNAME_NP(_n_,_a_) \\\n"
+"        {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, _n_, _a_}\n";
+};
 
 /*
  *  Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
diff --git a/fixincludes/tests/base/pthread.h b/fixincludes/tests/base/pthread.h
index 385c055ec83d..735c0ef7ffd6 100644
--- a/fixincludes/tests/base/pthread.h
+++ b/fixincludes/tests/base/pthread.h
@@ -35,6 +35,27 @@
 #endif  /* ALPHA_PTHREAD_GCC_CHECK */
 
 
+#if defined( ALPHA_PTHREAD_INIT_CHECK )
+/*
+ * @(#)$RCSfile: pthread.h,v $ $Revision: 1.1.33.21 $ (DEC) $Date: 2000/08/15 15:30:13 $
+ */
+#ifndef _PTHREAD_NOMETER_STATIC
+# define PTHREAD_MUTEX_INITIALIZER     {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, 0, 0, 0, 0, 0, 0 }
+# define PTHREAD_COND_INITIALIZER     {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, 0, 0, 0, 0 }
+# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_)     {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_, 0, 0, 0, 0 }
+# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_)     {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_, 0, 0 }
+#else
+# define PTHREAD_MUTEX_INITIALIZER {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, 0, 0, 0, 0, 0, 0 }
+# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_)     {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_, 0, 0, 0, 0 }
+# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_)     {{{0},0}, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_, 0, 0 }
+#endif
+
+#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+#define PTHREAD_RWLOCK_INITWITHNAME_NP(_n_,_a_)         {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, _n_, _a_, 0, 0, 0, 0, 0, 0, 0 }
+
+#endif  /* ALPHA_PTHREAD_INIT_CHECK */
+
+
 #if defined( PTHREAD_PAGE_SIZE_CHECK )
 extern int __page_size;
 #endif  /* PTHREAD_PAGE_SIZE_CHECK */
-- 
GitLab