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 2.6 pthread mutex init fixes


This is the "as applied" patch for GCC 3.3
2003-05-06  Bruce Korb  <bkorb@gnu.org>

	* inclhack.def: fix up whitespace differences from mainline.
	mark fix tests that fail on BSD systems (like mainline).
	Fixup the solaris_mutex_init test to cope with Sol. 2.6 (like mainline).
    Removed unused SONY commentary (its obsolete anyway).
	(svr4_mach_defines): remove i860 machine from comment (like mainline).
	* gcc/fixinc/tests/base/pthread.h: solaris_mutex_init fix tests
	* gcc/fixinc/tests/base/testing.h: remove ^M chars from someone's DOS editor
	* gcc/fixinc/tests/base/Xm/Traversal.h: accommodate BSD's sed
	* gcc/fixinc/tests/base/sys/stat.h: accommodate BSD's sed
	* gcc/fixinc/fixincl.x: regenerated

Index: inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.139.4.5
diff -u -p -r1.139.4.5 inclhack.def
--- inclhack.def	1 Mar 2003 20:43:24 -0000	1.139.4.5
+++ inclhack.def	7 May 2003 01:56:37 -0000
@@ -109,7 +109,7 @@ fix = {
      * the wrapper, this will follow the #include_next chain until
      * we arrive at the real <asm/posix_types.h>.
      */
-    replace  = <<-  _EOF_
+    replace  = <<-  _EndOfHeader_
 	/* This file fixes a bug in the __FD_ZERO macro
 	   for older versions of the Linux kernel. */
 	#ifndef _POSIX_TYPES_H_WRAPPER
@@ -130,7 +130,7 @@ fix = {
 	
 	#define _POSIX_TYPES_H_WRAPPER
 	#endif /* _POSIX_TYPES_H_WRAPPER */
-	_EOF_;
+	_EndOfHeader_;
 };
 
 
@@ -742,6 +742,7 @@ fix = {
     test_text = "# define bool\t char \n";
 };
 
+
 fix = {
     hackname = avoid_bool_type;
     files    = curses.h;
@@ -758,6 +759,7 @@ fix = {
     test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
 };
 
+
 /*
  *  For C++, avoid any typedef definition of wchar_t,
  *  and use the built in type instead.
@@ -774,6 +776,7 @@ fix = {
     test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
 };
 
+
 /*
  *  Fix #defines under Alpha OSF/1:
  *  The following files contain '#pragma extern_prefix "_FOO"' followed by
@@ -1004,6 +1007,7 @@ fix = {
                 "extern __DJ_wint_t x;\n";
 };
 
+
 /*
  * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
  */
@@ -1713,12 +1717,16 @@ fix = {
  *  comment.  Fortunately, HP/UX already uses #ifndefs in limits.h; if
  *  we find a #ifndef FLT_MIN we assume that all the required #ifndefs
  *  are there, and we do not add them ourselves.
+ *
+ *  QNX Software Systems also guards the defines, but doesn't define
+ *  FLT_MIN.  Therefore, bypass the fix for *either* guarded FLT_MIN
+ *  or guarded FLT_MAX.
  */
 fix = {
     hackname = limits_ifndefs;
     files  = "sys/limits.h";
     files  = "limits.h";
-    bypass = "ifndef[ \t]+FLT_MIN";
+    bypass = "ifndef[ \t]+FLT_(MIN|MAX)";
 
     c_fix     = format;
     c_fix_arg = "#ifndef %1\n%0\n#endif";
@@ -1980,6 +1988,7 @@ fix = {
                 "#define OPEN_MAX  20 /* Max, Max, ... */\n";
 };
 
+
 /*
  *  fix bogus recursive stdlib.h in NEWS-OS 4.0C
  */
@@ -2221,7 +2230,7 @@ fix = {
     "#ifdef __STDC__\n"
     "static int\tstat(const char *__f, struct stat *__p) {\n"
     "\treturn __stat32(__f, __p);\n"
-    "}\n\n#  else /* !__STDC__ */\n"
+    "}\n\n#  else /* !__STDC__ THIS FAILS ON BSD SYSTEMS */\n"
 
     "static int\tstat(__f, __p)\n"
     "\tchar *__f;\n"
@@ -2251,6 +2260,26 @@ fix = {
 
 
 /*
+ *  Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
+ *  incorrectly, so we replace them with versions that correspond to
+ *  the definition.  We also explicitly name this fix "1" and the next
+ *  fix "2" because this one does not deal with the last field.  This
+ *  fix needs to run before the next.
+ */
+fix = {
+    hackname = solaris_mutex_init_1;
+    select = '@\(#\)pthread.h' "[ \t]+1.1[0-9][ \t]+9[567]/[0-9/]+ SMI";
+    files = pthread.h;
+    sed   = "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n"
+            "/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/";
+    test_text =
+    '#ident "@(#)pthread.h  1.16    97/05/05 SMI"'"\n"
+    "#define PTHREAD_MUTEX_INITIALIZER\t{0, 0, 0}\n"
+    "#define PTHREAD_COND_INITIALIZER\t{0, 0} /* */\n";
+};
+
+
+/*
  * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
  * "0" for the last field of the pthread_mutex_t structure, which is
  * of type upad64_t, which itself is typedef'd to int64_t, but with
@@ -2258,7 +2287,7 @@ fix = {
  * initializer to "{0}" instead
  */
 fix = {
-    hackname = solaris_mutex_init;
+    hackname = solaris_mutex_init_2;
     select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
     files = pthread.h;
     c_fix = format;
@@ -2310,35 +2339,6 @@ fix = {
     test_text = "#include <euc.h>";
 };
 
-/*
- *  Sony NEWSOS 5.0 does not support the complete ANSI C standard.
- */
-#ifdef SONY
-fix = {
-    hackname = sony_ctype;
-    files    = ctype.h;
-    test     = " -x /bin/sony";
-    test     = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
-    sed      = "s/__ctype/_ctype/g";
-};
-#endif
-
-
-/*
- *  Sony NEWSOS 5.0 does not support the complete ANSI C standard.
- */
-#ifdef SONY
-fix = {
-    hackname = sony_stdio;
-    files    = stdio.h;
-    test     = " -x /bin/sony";
-    test     = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
-    sed      = "s/__filbuf/_filbuf/g\n"
-               "s/__flsbuf/_flsbuf/g\n"
-               "s/__iob/_iob/g";
-};
-#endif
-
 
 /*
  *  Add a `static' declaration of `getrnge' into <regexp.h>.
@@ -2859,8 +2859,8 @@ fix = {
 fix = {
     hackname = svr4_mach_defines;
     files    = ieeefp.h;
-    select   = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
-    sed      = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
+    select   = "#define[ \t]*__(i386|mips|sparc|m88k|m68k)[ \t]";
+    sed      = "/#define[ \t]*__\\(i386|mips|sparc|m88k|m68k\\)[ \t]/d";
 };
 #endif
 
@@ -3286,7 +3286,7 @@ fix = {
     test_text =
     "@(#)stat.h      6.1     (ULTRIX)\n"
     "#define S_IFPORT S_IFIFO\n"
-    "\tfstat(),\n";
+    "\tfstat(),\n/* THE INSERTION LINE FAILS ON BSD SYSTEMS */";
 };
 
 
@@ -3619,7 +3619,7 @@ fix = {
     sed      = "s/Widget new,/Widget c_new,/g";
     test_text =
     "struct wedge {\n"
-    "   Widget\told, new; /* fix the new */\n"
+    "   Widget\told, new; /* fixinc check FAILS ON BSD */\n"
     "};\nextern Wedged( Widget new, Widget old );";
 };
 
Index: tests/base/pthread.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/tests/base/pthread.h,v
retrieving revision 1.8
diff -u -p -r1.8 pthread.h
--- tests/base/pthread.h	22 May 2002 21:29:38 -0000	1.8
+++ tests/base/pthread.h	7 May 2003 01:56:37 -0000
@@ -20,7 +20,23 @@ extern int __page_size;
 #endif  /* PTHREAD_PAGE_SIZE_CHECK */
 
 
-#if defined( SOLARIS_MUTEX_INIT_CHECK )
+#if defined( SOLARIS_MUTEX_INIT_1_CHECK )
+#ident "@(#)pthread.h  1.16    97/05/05 SMI"
+#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
+#define PTHREAD_MUTEX_INITIALIZER	{{{0}, 0}, {{{0}}}, 0}
+#else
+#define PTHREAD_MUTEX_INITIALIZER	{{{0}, 0}, {{{0}}}, {0}}
+#endif
+#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
+#define PTHREAD_COND_INITIALIZER	{{{0},0}, 0} /* */
+#else
+#define PTHREAD_COND_INITIALIZER	{{{0},0}, {0}} /* */
+#endif
+
+#endif  /* SOLARIS_MUTEX_INIT_1_CHECK */
+
+
+#if defined( SOLARIS_MUTEX_INIT_2_CHECK )
 #ident "@(#)pthread.h  1.26  98/04/12 SMI"
 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
 #define PTHREAD_MUTEX_INITIALIZER	{{{0},0}, {{{0}}}, 0}
@@ -33,7 +49,7 @@ extern int __page_size;
 #define PTHREAD_COND_INITIALIZER	{{{0}, 0}, {0}}	/* DEFAULTCV */
 #endif
 #define PTHREAD_RWLOCK_INITIALIZER	{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}
-#endif  /* SOLARIS_MUTEX_INIT_CHECK */
+#endif  /* SOLARIS_MUTEX_INIT_2_CHECK */
 
 
 #if defined( THREAD_KEYWORD_CHECK )
Index: tests/base/testing.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/tests/base/testing.h,v
retrieving revision 1.11.4.1
diff -u -p -r1.11.4.1 testing.h
--- tests/base/testing.h	22 Apr 2003 23:40:47 -0000	1.11.4.1
+++ tests/base/testing.h	7 May 2003 01:56:37 -0000
@@ -113,9 +113,9 @@ extern size_t
 
 
 #if defined( UNDEFINE_NULL_CHECK )
-#ifndef NULL
-#define NULL 0UL
-#endif
+#ifndef NULL
+#define NULL 0UL
+#endif
 #ifndef NULL
 #define NULL	((void*)0)
 #endif
Index: tests/base/Xm/Traversal.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/tests/base/Xm/Traversal.h,v
retrieving revision 1.2
diff -u -p -r1.2 Traversal.h
--- tests/base/Xm/Traversal.h	19 Jul 2000 14:18:29 -0000	1.2
+++ tests/base/Xm/Traversal.h	7 May 2003 01:56:37 -0000
@@ -14,7 +14,7 @@ struct wedge {
 #ifdef __cplusplus
 	Widget	old, c_new;
 #else
-   Widget	old, new; /* fix the new */
+   Widget	old, new; /* fixinc check FAILS ON BSD */
 #endif
 };
 extern Wedged( Widget c_new, Widget old );
Index: tests/base/sys/stat.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/tests/base/sys/stat.h,v
retrieving revision 1.4.56.1
diff -u -p -r1.4.56.1 stat.h
--- tests/base/sys/stat.h	1 Mar 2003 20:41:38 -0000	1.4.56.1
+++ tests/base/sys/stat.h	7 May 2003 01:56:37 -0000
@@ -36,7 +36,7 @@ static int	stat(const char *__f, struct 
  }
 #endif /* __cplusplus */
 
-#  else /* !__STDC__ */
+#  else /* !__STDC__ THIS FAILS ON BSD SYSTEMS */
 #if __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -62,7 +62,7 @@ static int	stat(__f, __p)
 
 	fstat(),
 	lstat(),
-
+/* THE INSERTION LINE FAILS ON BSD SYSTEMS */
 #endif  /* ULTRIX_STAT_CHECK */
 
 

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