OSDN Git Service

Part 1 of the checkins for the SCO port update. This is the fixinclude
authorjkj <jkj@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 19 Apr 2003 21:10:08 +0000 (21:10 +0000)
committerjkj <jkj@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 19 Apr 2003 21:10:08 +0000 (21:10 +0000)
stuff.

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

gcc/ChangeLog
gcc/fixinc/check.tpl
gcc/fixinc/fixincl.x
gcc/fixinc/inclhack.def
gcc/fixinc/tests/base/math.h
gcc/fixinc/tests/base/string.h [new file with mode: 0644]
gcc/fixinc/tests/base/sys/regset.h [new file with mode: 0644]

index 9c99f2e..eda3fc2 100644 (file)
@@ -1,3 +1,15 @@
+2003-04-19  Kean Johnston  <jkj@sco.com>
+
+       * fixinc/check.tpl: Allow user to over-ride diff program.
+       * fixinc/inclhack.def: Removed extraneous #ifndef SVR5.
+       (sco_math): Added test for SCO math header files.
+       (sco_regset): Added check for conflicts with ieeefp.h.
+       (svr4_disable_opt): Removed extraneous #ifdef SVR4.
+       * fixinc/fixincl.x: Regenerated
+       * fixinc/tests/base/math.h: Added sco_math tests.
+       * fixinc/tests/base/string.h: New file.
+       * fixinc/tests/base/sys/regset.h: New file.
+
 2003-04-19  Neil Booth  <neil@daikokuya.co.uk>
 
        * cpphash.h (struct cpp_buffer): Remove backup_to.
index bc5e4b8..3401cf8 100644 (file)
@@ -135,7 +135,7 @@ do
     :
 
   else
-    diff -u $f ${TESTBASE}/$f >&2 || :
+    ${DIFF:-diff} -u $f ${TESTBASE}/$f >&2 || :
     exitok=false
   fi
 done
index 80e489a..5b623b9 100644 (file)
@@ -5,7 +5,7 @@
  * files which are fixed to work correctly with ANSI C and placed in a
  * directory that GNU C will search.
  *
- * This file contains 149 fixup descriptions.
+ * This file contains 152 fixup descriptions.
  *
  * See README for more information.
  *
@@ -279,19 +279,17 @@ fix = {\n\
 #endif\n\n\n\
 /*\n\
  *  Completely replace <sys/byteorder.h>; with a file that implements gcc's\n\
- *  optimized byteswapping.  Restricted to \"SVR4\" machines until either\n\
- *  it is shown to be safe to replace this file always, or we get bolder ;-)\n\
+ *  optimized byteswapping.\n\
  */\n\
 fix = {\n\
     hackname = AAB_svr4_replace_byteorder;\n\
-#ifndef SVR5\n\
     mach     = \"*-*-sysv4*\";\n\
     mach     = \"i[34567]86-*-sysv5*\";\n\
+    mach     = \"i[34567]86-*-sco3.2v5*\";\n\
     mach     = \"i[34567]86-*-udk*\";\n\
     mach     = \"i[34567]86-*-solaris2.[0-4]\";\n\
     mach     = \"powerpcle-*-solaris2.[0-4]\";\n\
     mach     = \"sparc-*-solaris2.[0-4]\";\n\
-#endif /* SVR5 */\n\
     files    = sys/byteorder.h;\n\
     replace  = <<-  _EndOfHeader_\n\
 #ifndef _SYS_BYTEORDER_H\n\
@@ -3709,6 +3707,90 @@ static const char* apzRs6000_ParamPatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Sco_Math fix
+ */
+tSCC zSco_MathName[] =
+     "sco_math";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zSco_MathList[] =
+  "|math.h|ansi/math.h|posix/math.h|xpg4/math.h|xpg4v2/math.h|xpg4plus/math.h|ods_30_compat/math.h|oldstyle/math.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzSco_MathMachs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zSco_MathSelect0[] =
+       "inline double abs";
+
+#define    SCO_MATH_TEST_CT  1
+static tTestDesc aSco_MathTests[] = {
+  { TT_EGREP,    zSco_MathSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Sco_Math
+ */
+static const char* apzSco_MathPatch[] = { "sed",
+    "-e", "/#define.*__fp_class(a) \\\\/i\\\n\
+#ifndef __GNUC__\n",
+    "-e", "/.*__builtin_generic/a\\\n\
+#else\\\n\
+#define __fp_class(a) \\\\\\\n\
+  __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n\
+   __fpclassifyl(a), \\\\\\\n\
+    __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n\
+      __fpclassifyf(a),__fpclassify(a)))\\\n\
+#endif",
+    "-e", "/extern \"C\\+\\+\"/N;/inline double abs/i\\\n\
+#ifndef __GNUC__\n",
+    "-e", "/inline long double trunc/N;/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n\
+#endif /* ! __GNUC__ */",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Sco_Regset fix
+ */
+tSCC zSco_RegsetName[] =
+     "sco_regset";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zSco_RegsetList[] =
+  "|sys/regset.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzSco_RegsetMachs[] = {
+        "*-*-sco3.2v5*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zSco_RegsetSelect0[] =
+       "(struct[ \t]+.*)fpstate";
+
+#define    SCO_REGSET_TEST_CT  1
+static tTestDesc aSco_RegsetTests[] = {
+  { TT_EGREP,    zSco_RegsetSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Sco_Regset
+ */
+static const char* apzSco_RegsetPatch[] = {
+    "format",
+    "%1rsfpstate",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Sco_Static_Func fix
  */
 tSCC zSco_Static_FuncName[] =
@@ -4598,6 +4680,40 @@ static const char* apzSvr4__PPatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Svr4_Disable_Opt fix
+ */
+tSCC zSvr4_Disable_OptName[] =
+     "svr4_disable_opt";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zSvr4_Disable_OptList[] =
+  "|string.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzSvr4_Disable_OptMachs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zSvr4_Disable_OptSelect0[] =
+       "#define.*__std_hdr_";
+
+#define    SVR4_DISABLE_OPT_TEST_CT  1
+static tTestDesc aSvr4_Disable_OptTests[] = {
+  { TT_EGREP,    zSvr4_Disable_OptSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Svr4_Disable_Opt
+ */
+static const char* apzSvr4_Disable_OptPatch[] = { "sed",
+    "-e", "/#define.*__std_hdr_/d",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Svr4_Getcwd fix
  */
 tSCC zSvr4_GetcwdName[] =
@@ -5878,9 +5994,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          161
+#define REGEX_COUNT          164
 #define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT            149
+#define FIX_COUNT            152
 
 /*
  *  Enumerate the fixes
@@ -5978,6 +6094,8 @@ typedef enum {
     RS6000_DOUBLE_FIXIDX,
     RS6000_FCHMOD_FIXIDX,
     RS6000_PARAM_FIXIDX,
+    SCO_MATH_FIXIDX,
+    SCO_REGSET_FIXIDX,
     SCO_STATIC_FUNC_FIXIDX,
     SCO_UTIME_FIXIDX,
     SOLARIS_MUTEX_INIT_1_FIXIDX,
@@ -6001,6 +6119,7 @@ typedef enum {
     SUNOS_MATHERR_DECL_FIXIDX,
     SUNOS_STRLEN_FIXIDX,
     SVR4__P_FIXIDX,
+    SVR4_DISABLE_OPT_FIXIDX,
     SVR4_GETCWD_FIXIDX,
     SVR4_PROFIL_FIXIDX,
     SYSV68_STRING_FIXIDX,
@@ -6498,6 +6617,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      RS6000_PARAM_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aRs6000_ParamTests,   apzRs6000_ParamPatch, 0 },
 
+  {  zSco_MathName,    zSco_MathList,
+     apzSco_MathMachs,
+     SCO_MATH_TEST_CT, FD_MACH_ONLY,
+     aSco_MathTests,   apzSco_MathPatch, 0 },
+
+  {  zSco_RegsetName,    zSco_RegsetList,
+     apzSco_RegsetMachs,
+     SCO_REGSET_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aSco_RegsetTests,   apzSco_RegsetPatch, 0 },
+
   {  zSco_Static_FuncName,    zSco_Static_FuncList,
      apzSco_Static_FuncMachs,
      SCO_STATIC_FUNC_TEST_CT, FD_MACH_ONLY,
@@ -6613,6 +6742,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      SVR4__P_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aSvr4__PTests,   apzSvr4__PPatch, 0 },
 
+  {  zSvr4_Disable_OptName,    zSvr4_Disable_OptList,
+     apzSvr4_Disable_OptMachs,
+     SVR4_DISABLE_OPT_TEST_CT, FD_MACH_ONLY,
+     aSvr4_Disable_OptTests,   apzSvr4_Disable_OptPatch, 0 },
+
   {  zSvr4_GetcwdName,    zSvr4_GetcwdList,
      apzSvr4_GetcwdMachs,
      SVR4_GETCWD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
index 5256412..ad389f5 100644 (file)
@@ -222,19 +222,17 @@ fix = {
 
 /*
  *  Completely replace <sys/byteorder.h>; with a file that implements gcc's
- *  optimized byteswapping.  Restricted to "SVR4" machines until either
- *  it is shown to be safe to replace this file always, or we get bolder ;-)
+ *  optimized byteswapping.
  */
 fix = {
     hackname = AAB_svr4_replace_byteorder;
-#ifndef SVR5
     mach     = "*-*-sysv4*";
     mach     = "i[34567]86-*-sysv5*";
+    mach     = "i[34567]86-*-sco3.2v5*";
     mach     = "i[34567]86-*-udk*";
     mach     = "i[34567]86-*-solaris2.[0-4]";
     mach     = "powerpcle-*-solaris2.[0-4]";
     mach     = "sparc-*-solaris2.[0-4]";
-#endif /* SVR5 */
     files    = sys/byteorder.h;
     replace  = <<-  _EndOfHeader_
        #ifndef _SYS_BYTEORDER_H
@@ -381,7 +379,6 @@ fix = {
        _EndOfHeader_;
 };
 
-
 /*
  *  Cancel out ansi_compat.h on Ultrix.  Replace it with an empty file.
  */
@@ -2019,6 +2016,73 @@ fix = {
     test_text = 'extern int rename(const char *old, const char *new);';
 };
 
+/*
+ *  On OpenServer and on UnixWare 7, <math.h> uses the native compiler
+ *  __builtin_generic. We fix that usage to use the GCC equivalent.
+ * It also has a plethora of inline functions that conflict with libstdc++.
+ */
+fix = {
+    hackname = sco_math;
+    files    = math.h;
+    files    = ansi/math.h;
+    files    = posix/math.h;
+    files    = xpg4/math.h;
+    files    = xpg4v2/math.h;
+    files    = xpg4plus/math.h;
+    files    = ods_30_compat/math.h;
+    files    = oldstyle/math.h;
+    select   = "inline double abs";
+    sed      = "/#define.*__fp_class(a) \\\\/i\\\n"
+              "#ifndef __GNUC__\n";
+    sed      =
+"/.*__builtin_generic/a\\\n"
+"#else\\\n"
+"#define __fp_class(a) \\\\\\\n"
+"  __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n"
+"   __fpclassifyl(a), \\\\\\\n"
+"    __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n"
+"      __fpclassifyf(a),__fpclassify(a)))\\\n"
+"#endif";
+
+    sed      = "/extern \"C\\+\\+\"/N;"
+              "/inline double abs/i\\\n"
+               "#ifndef __GNUC__\n";
+    sed      = "/inline long double trunc/N;"
+              "/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n"
+              "#endif /* ! __GNUC__ */";
+
+    test_text =
+    "#define __fp_class(a) \\\\\n"
+    " __builtin_generic(a,\"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify\")\n";
+
+};
+
+/*
+ *  On SCO OpenServer prior to 5.0.7UP1, <sys/regset.h> and <ieeefp.h>
+ *  have a clash on struct _fpstate and struct fpstate.
+ */
+fix = {
+    hackname = sco_regset;
+    files    = sys/regset.h;
+    mach     = "*-*-sco3.2v5*";
+    select   = "(struct[ \t]+.*)fpstate";
+    c_fix     = format;
+    c_fix_arg = "%1rsfpstate";
+
+    test_text =
+    "union u_fps {\n"
+    "    struct\tfpstate\n"
+    "    {\n"
+    "       int whatever;\n"
+    "    }\n"
+    "};\n"
+    "union _u_fps {\n"
+    "    struct _fpstate\n"
+    "    {\n"
+    "       int whatever;\n"
+    "    }\n"
+    "};\n";
+};
 
 /*
  *  The static functions lstat() and fchmod() in <sys/stat.h>
@@ -2523,15 +2587,13 @@ fix = {
  *  that is visible to any ANSI compiler using this include.  Simply
  *  delete the lines that #define some string functions to internal forms.
  */
-#ifdef SVR4
 fix = {
     hackname = svr4_disable_opt;
     files    = string.h;
     select   = '#define.*__std_hdr_';
     sed      = '/#define.*__std_hdr_/d';
+    test_text = "#define strlen __std_hdr_strlen\n";
 };
-#endif
-
 
 /*
  *  Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
index dd29057..cff0a59 100644 (file)
@@ -82,6 +82,13 @@ extern int class();
 #endif  /* RS6000_DOUBLE_CHECK */
 
 
+#if defined( SCO_MATH_CHECK )
+#define __fp_class(a) \
+ __builtin_generic(a,"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify")
+
+#endif  /* SCO_MATH_CHECK */
+
+
 #if defined( STRICT_ANSI_NOT_CTD_CHECK )
 #if 1 && \
 && defined(mumbling) |& ( !defined(__STRICT_ANSI__)) \
diff --git a/gcc/fixinc/tests/base/string.h b/gcc/fixinc/tests/base/string.h
new file mode 100644 (file)
index 0000000..f32c240
--- /dev/null
@@ -0,0 +1,13 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+       "fixinc/tests/inc/string.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+#ifndef _STRING_INCLUDED
+#define _STRING_INCLUDED
+#include <strings.h>
+#endif /* _STRING_INCLUDED */
diff --git a/gcc/fixinc/tests/base/sys/regset.h b/gcc/fixinc/tests/base/sys/regset.h
new file mode 100644 (file)
index 0000000..adc31ad
--- /dev/null
@@ -0,0 +1,26 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+       "fixinc/tests/inc/sys/regset.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( SCO_REGSET_CHECK )
+union u_fps {
+    struct rsfpstate
+    {
+       int whatever;
+    }
+};
+union _u_fps {
+    struct _rsfpstate
+    {
+       int whatever;
+    }
+};
+
+#endif  /* SCO_REGSET_CHECK */