From 85df6fdf7a043fddce4af427b438726cf06b3971 Mon Sep 17 00:00:00 2001
From: sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 24 Apr 2004 22:42:29 +0000
Subject: [PATCH] 	* fixinc/inclhack.def (aix_syswait_2): New fix. 
 * fixinc/fixincl.x: Regenerate. 	* fixinc/tests/base/sys/wait.h: Update
 for new test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81147 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                    |  7 +++++
 gcc/fixinc/fixincl.x             | 51 ++++++++++++++++++++++++++++----
 gcc/fixinc/inclhack.def          | 14 +++++++++
 gcc/fixinc/tests/base/sys/wait.h |  5 ++++
 4 files changed, 72 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b81ca8546acc..8c705240b81a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2004-04-24  Roger Sayle  <roger@eyesopen.com>
+	    Bruce Korb  <bkorb@gnu.org>
+
+	* fixinc/inclhack.def (aix_syswait_2): New fix.
+	* fixinc/fixincl.x: Regenerate.
+	* fixinc/tests/base/sys/wait.h: Update for new test.
+
 2004-04-24  Alan Modra  <amodra@bigpond.net.au>
 
 	PR target/14960
diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x
index f3a1149dce1d..efd41f300e8f 100644
--- a/gcc/fixinc/fixincl.x
+++ b/gcc/fixinc/fixincl.x
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  Wednesday April  7, 2004 at 10:23:41 PM UTC
+ * It has been AutoGen-ed  Friday April 23, 2004 at 06:53:51 AM MDT
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT CVS-MERGE THIS FILE, EITHER Wed Apr  7 22:23:41 UTC 2004
+/* DO NOT CVS-MERGE THIS FILE, EITHER Fri Apr 23 06:53:51 MDT 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 174 fixup descriptions.
+ * This file contains 175 fixup descriptions.
  *
  * See README for more information.
  *
@@ -647,6 +647,41 @@ static const char* apzAix_SyswaitPatch[] = {
 %0",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Aix_Syswait_2 fix
+ */
+tSCC zAix_Syswait_2Name[] =
+     "aix_syswait_2";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zAix_Syswait_2List[] =
+  "|sys/wait.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzAix_Syswait_2Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zAix_Syswait_2Select0[] =
+       "\\? (\\(\\(\\(\\(unsigned[^)]*\\)[^)]*\\) >> [^)]*\\) \\& 0xff\\) : -1)";
+
+#define    AIX_SYSWAIT_2_TEST_CT  1
+static tTestDesc aAix_Syswait_2Tests[] = {
+  { TT_EGREP,    zAix_Syswait_2Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Aix_Syswait_2
+ */
+static const char* apzAix_Syswait_2Patch[] = {
+    "format",
+    "? (int)%1",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Aix_Volatile fix
@@ -6894,9 +6929,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          195
+#define REGEX_COUNT          196
 #define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT            174
+#define FIX_COUNT            175
 
 /*
  *  Enumerate the fixes
@@ -6914,6 +6949,7 @@ typedef enum {
     AIX_PTHREAD_FIXIDX,
     AIX_SYSMACHINE_FIXIDX,
     AIX_SYSWAIT_FIXIDX,
+    AIX_SYSWAIT_2_FIXIDX,
     AIX_VOLATILE_FIXIDX,
     ALPHA___ASSERT_FIXIDX,
     ALPHA___EXTERN_PREFIX_FIXIDX,
@@ -7139,6 +7175,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      AIX_SYSWAIT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aAix_SyswaitTests,   apzAix_SyswaitPatch, 0 },
 
+  {  zAix_Syswait_2Name,    zAix_Syswait_2List,
+     apzAix_Syswait_2Machs,
+     AIX_SYSWAIT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aAix_Syswait_2Tests,   apzAix_Syswait_2Patch, 0 },
+
   {  zAix_VolatileName,    zAix_VolatileList,
      apzAix_VolatileMachs,
      AIX_VOLATILE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index 086b8c0d4201..2e57d0f0e5c2 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -493,6 +493,20 @@ fix = {
 };
 
 
+/*
+ *  sys/wait.h on AIX 5.2 defines macros that have both signed and
+ *  unsigned types in conditional expressions.
+ */
+fix = {
+    hackname  = aix_syswait_2;
+    files     = sys/wait.h;
+    select    = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
+    c_fix     = format;
+    c_fix_arg = "? (int)%1";
+    test_text = "#define WSTOPSIG(__x)    (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
+};
+
+
 /*
  *  sys/signal.h on some versions of AIX uses volatile in the typedef of
  *  sig_atomic_t, which causes gcc to generate a warning about duplicate
diff --git a/gcc/fixinc/tests/base/sys/wait.h b/gcc/fixinc/tests/base/sys/wait.h
index c0edf05f1cd8..a0311c65d0fd 100644
--- a/gcc/fixinc/tests/base/sys/wait.h
+++ b/gcc/fixinc/tests/base/sys/wait.h
@@ -17,6 +17,11 @@ extern pid_t wait3();
 #endif  /* AIX_SYSWAIT_CHECK */
 
 
+#if defined( AIX_SYSWAIT_2_CHECK )
+#define WSTOPSIG(__x)    (int)(WIFSTOPPED(__x) ? (int)((((unsigned int)__x) >> 8) & 0xff) : -1)
+#endif  /* AIX_SYSWAIT_2_CHECK */
+
+
 #if defined( NEXT_WAIT_UNION_CHECK )
 extern pid_d wait(void*);
 #endif  /* NEXT_WAIT_UNION_CHECK */
-- 
GitLab