OSDN Git Service

* inclhack.def (pthread_mutex_init): New fix.
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Oct 2006 05:47:33 +0000 (05:47 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Oct 2006 05:47:33 +0000 (05:47 +0000)
        * tests/base/pthread.h: Update.

        * fixincl.x: Regenerate.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117343 138bc75d-0d04-0410-961f-82ee72b054a4

fixincludes/ChangeLog
fixincludes/fixincl.x
fixincludes/inclhack.def
fixincludes/tests/base/pthread.h

index 9bfa5a5..d32327b 100644 (file)
@@ -1,3 +1,10 @@
+2006-10-01  Uros Bizjak <uros@kss-loka.si>
+
+        * inclhack.def (glibc_mutex_init): New fix.
+        * tests/base/pthread.h: Update.
+
+        * fixincl.x: Regenerate.
+
 2006-09-29  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * inclhack.def (solaris_mutex_init_2): Update for Solaris9.
index e9c8b88..38d4f27 100644 (file)
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  Thursday September 28, 2006 at 11:06:33 PM EDT
+ * It has been AutoGen-ed  Saturday September 30, 2006 at 01:08:07 PM CEST
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT CVS-MERGE THIS FILE, EITHER Thu Sep 28 23:06:33 EDT 2006
+/* DO NOT CVS-MERGE THIS FILE, EITHER Sat Sep 30 13:08:07 CEST 2006
  *
  * 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 199 fixup descriptions.
+ * This file contains 200 fixup descriptions.
  *
  * See README for more information.
  *
@@ -2182,6 +2182,42 @@ static const char* apzFreebsd_Gcc4_BreakagePatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Glibc_Mutex_Init fix
+ */
+tSCC zGlibc_Mutex_InitName[] =
+     "glibc_mutex_init";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Mutex_InitList[] =
+  "|pthread.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Mutex_InitMachs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Mutex_InitSelect0[] =
+       "\\{ *\\{ *0, *\\} *\\}";
+
+#define    GLIBC_MUTEX_INIT_TEST_CT  1
+static tTestDesc aGlibc_Mutex_InitTests[] = {
+  { TT_EGREP,    zGlibc_Mutex_InitSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Mutex_Init
+ */
+static const char* apzGlibc_Mutex_InitPatch[] = { "sed",
+    "-e", "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/,+1s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/",
+    "-e", "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/N;s/^[ \t]*#[ \t]*\\(define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\n#  \\1\\n  { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\n# else\\n#  \\1\\n  { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\n# endif/",
+    "-e", "/define[ \t]\\+PTHREAD_COND_INITIALIZER/s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Gnu_Types fix
  */
 tSCC zGnu_TypesName[] =
@@ -8104,9 +8140,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          242
+#define REGEX_COUNT          243
 #define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT            199
+#define FIX_COUNT            200
 
 /*
  *  Enumerate the fixes
@@ -8162,6 +8198,7 @@ typedef enum {
     EXCEPTION_STRUCTURE_FIXIDX,
     FREEBSD_GCC3_BREAKAGE_FIXIDX,
     FREEBSD_GCC4_BREAKAGE_FIXIDX,
+    GLIBC_MUTEX_INIT_FIXIDX,
     GNU_TYPES_FIXIDX,
     HP_INLINE_FIXIDX,
     HP_SYSFILE_FIXIDX,
@@ -8564,6 +8601,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      FREEBSD_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aFreebsd_Gcc4_BreakageTests,   apzFreebsd_Gcc4_BreakagePatch, 0 },
 
+  {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
+     apzGlibc_Mutex_InitMachs,
+     GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
+     aGlibc_Mutex_InitTests,   apzGlibc_Mutex_InitPatch, 0 },
+
   {  zGnu_TypesName,    zGnu_TypesList,
      apzGnu_TypesMachs,
      GNU_TYPES_TEST_CT, FD_MACH_IFNOT | FD_SUBROUTINE,
index acef258..04c6ef5 100644 (file)
@@ -1288,6 +1288,38 @@ fix = {
 };
 
 
+/*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
+ *  so we replace them with versions that correspond to the
+ *  definition.
+ */
+fix = {
+    hackname = glibc_mutex_init;
+    files    = pthread.h;
+    select   = '\{ *\{ *0, *\} *\}';
+    sed      = "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/,+1"
+               "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/";
+    sed      = "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
+               "N;s/^[ \t]*#[ \t]*"
+               "\\(define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
+               "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\n"
+               "#  \\1\\n"
+               "  { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\n"
+               "# else\\n"
+               "#  \\1\\n"
+               "  { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\n"
+               "# endif/";
+    sed      = "/define[ \t]\\+PTHREAD_COND_INITIALIZER/"
+               "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
+
+    test_text =
+    "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
+    "  { { 0, } }\n"
+    "# define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
+    "  { { 0, } }\n"
+    "#define PTHREAD_COND_INITIALIZER { { 0, } }";
+};
+
+
 /*
  * Fix these files to use the types we think they should for
  * ptrdiff_t, size_t, and wchar_t.
index b8366bf..b1c4d51 100644 (file)
 #endif  /* ALPHA_PTHREAD_INIT_CHECK */
 
 
+#if defined( GLIBC_MUTEX_INIT_CHECK )
+#define PTHREAD_MUTEX_INITIALIZER \
+  { { 0, 0, 0, 0, 0, 0 } }
+# if __WORDSIZE == 64
+#  define PTHREAD_RWLOCK_INITIALIZER \
+  { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
+# else
+#  define PTHREAD_RWLOCK_INITIALIZER \
+  { { 0, 0, 0, 0, 0, 0, 0, 0 } }
+# endif
+#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
+#endif  /* GLIBC_MUTEX_INIT_CHECK */
+
+
 #if defined( PTHREAD_PAGE_SIZE_CHECK )
 extern int __page_size;
 #endif  /* PTHREAD_PAGE_SIZE_CHECK */