This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Solaris testers needed for fixinclude patch, PTHREAD_ONCE_INIT


One of the fixes necessary to the pthread.h file on solaris involves
the PTHREAD_ONCE_INIT macro.  The `pthread_once_t' typedef in
sys/types.h looks like this:

 > typedef struct _once {
 >         upad64_t        __pthread_once_pad[4];
 > } pthread_once_t;

But the macro is defined as:

 > #define PTHREAD_ONCE_INIT       {0, 0, 0, PTHREAD_ONCE_NOTDONE}


A structure containing an array requires two levels of brackets, but
the macro PTHREAD_ONCE_INIT only contains one.  At least, that is the
case on solaris7, 9 and 10 which I have access to.  Anyone with 2.5.1
or 2.6 who could test this would be greatly appreciated.  A C-only
--disable-bootstrap make should suffice to see what happened to
pthread.h and let me know if the pthread_once_t declaration is the
same on your box.

I've tested this on solaris10 with a full bootstrap and regtest.  I
also did a C-only --disable-bootstrap on solaris7 and 9 and verified
things are okay.


Bruce - assuming we get older solaris version confirmation, okay for
mainline now (or perhaps in stage1)?

		Thanks,
		--Kaveh


2006-09-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* inclhack.def (solaris_once_init_1): New.
	* tests/base/pthread.h: Adjust for new fix.
	
	* fixincl.x: Regenerate.
	
diff -rup orig/egcc-SVN20060923/fixincludes/inclhack.def egcc-SVN20060923/fixincludes/inclhack.def
--- orig/egcc-SVN20060923/fixincludes/inclhack.def	2006-06-23 20:01:40.000000000 -0400
+++ egcc-SVN20060923/fixincludes/inclhack.def	2006-09-25 10:21:55.264964645 -0400
@@ -2990,6 +2990,24 @@ fix = {
 
 
 /*
+ * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
+ * structure.  As such, it need two levels of brackets, but only
+ * contains one.  Wrap the macro definition in an extra layer.
+ */
+fix = {
+    hackname = solaris_once_init_1;
+    select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+    files = pthread.h;
+    c_fix = format;
+    c_fix_arg = "%1{%2}%3";
+    c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
+    test_text =
+    '#pragma ident	"@(#)pthread.h	1.37	04/09/28 SMI"'"\n"
+    "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
+};
+
+
+/*
  * Solaris 2.5.1 and 2.6 use an outdated prototype for send & recv
  * in sys/socket.h.  This is corrected in Solaris 7 and up.
  */
diff -rup orig/egcc-SVN20060923/fixincludes/tests/base/pthread.h egcc-SVN20060923/fixincludes/tests/base/pthread.h
--- orig/egcc-SVN20060923/fixincludes/tests/base/pthread.h	2006-01-23 00:54:57.000000000 -0500
+++ egcc-SVN20060923/fixincludes/tests/base/pthread.h	2006-09-25 10:10:44.095331405 -0400
@@ -98,6 +98,12 @@ extern int __sigsetjmp (struct __jmp_buf
 #endif  /* SOLARIS_MUTEX_INIT_2_CHECK */
 
 
+#if defined( SOLARIS_ONCE_INIT_1_CHECK )
+#pragma ident	"@(#)pthread.h	1.37	04/09/28 SMI"
+#define PTHREAD_ONCE_INIT	{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}
+#endif  /* SOLARIS_ONCE_INIT_1_CHECK */
+
+
 #if defined( THREAD_KEYWORD_CHECK )
 extern int pthread_create (pthread_t *__restrict __thr,
 extern int pthread_kill (pthread_t __thr, int __signo);




diff -rup orig/egcc-SVN20060923/fixincludes/fixincl.x egcc-SVN20060923/fixincludes/fixincl.x
--- orig/egcc-SVN20060923/fixincludes/fixincl.x	2006-06-23 20:01:39.000000000 -0400
+++ egcc-SVN20060923/fixincludes/fixincl.x	2006-09-25 10:21:59.000000000 -0400
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  Thursday June 22, 2006 at 03:07:03 PM PDT
+ * It has been AutoGen-ed  Monday September 25, 2006 at 10:21:59 AM EDT
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT CVS-MERGE THIS FILE, EITHER Thu Jun 22 15:07:03 PDT 2006
+/* DO NOT CVS-MERGE THIS FILE, EITHER Mon Sep 25 10:21:59 EDT 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 196 fixup descriptions.
+ * This file contains 197 fixup descriptions.
  *
  * See README for more information.
  *
@@ -5498,6 +5498,42 @@ static const char* apzSolaris_Mutex_Init
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Solaris_Once_Init_1 fix
+ */
+tSCC zSolaris_Once_Init_1Name[] =
+     "solaris_once_init_1";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zSolaris_Once_Init_1List[] =
+  "|pthread.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzSolaris_Once_Init_1Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Once_Init_1Select0[] =
+       "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+
+#define    SOLARIS_ONCE_INIT_1_TEST_CT  1
+static tTestDesc aSolaris_Once_Init_1Tests[] = {
+  { TT_EGREP,    zSolaris_Once_Init_1Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Solaris_Once_Init_1
+ */
+static const char* apzSolaris_Once_Init_1Patch[] = {
+    "format",
+    "%1{%2}%3",
+    "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Solaris_Socket fix
  */
 tSCC zSolaris_SocketName[] =
@@ -7977,9 +8013,9 @@ static const char* apzX11_SprintfPatch[]
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          239
+#define REGEX_COUNT          240
 #define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT            196
+#define FIX_COUNT            197
 
 /*
  *  Enumerate the fixes
@@ -8118,6 +8154,7 @@ typedef enum {
     SOLARIS_MATH_9_FIXIDX,
     SOLARIS_MUTEX_INIT_1_FIXIDX,
     SOLARIS_MUTEX_INIT_2_FIXIDX,
+    SOLARIS_ONCE_INIT_1_FIXIDX,
     SOLARIS_SOCKET_FIXIDX,
     SOLARIS_STDIO_TAG_FIXIDX,
     SOLARIS_UNISTD_FIXIDX,
@@ -8849,6 +8886,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      SOLARIS_MUTEX_INIT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aSolaris_Mutex_Init_2Tests,   apzSolaris_Mutex_Init_2Patch, 0 },
 
+  {  zSolaris_Once_Init_1Name,    zSolaris_Once_Init_1List,
+     apzSolaris_Once_Init_1Machs,
+     SOLARIS_ONCE_INIT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aSolaris_Once_Init_1Tests,   apzSolaris_Once_Init_1Patch, 0 },
+
   {  zSolaris_SocketName,    zSolaris_SocketList,
      apzSolaris_SocketMachs,
      SOLARIS_SOCKET_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]