OSDN Git Service

(gen_sequence): If the insn has a non-null
[pf3gnuchains/gcc-fork.git] / gcc / fixinc.svr4
index 93adb9f..658243d 100755 (executable)
@@ -31,9 +31,6 @@
 #
 #      See README-fixinc for more information.
 
-# Directory where gcc sources (and sometimes special include files) live.
-SRCDIR=${3-${SRCDIR-.}}
-
 # Directory containing the original header files.
 INPUT=${2-${INPUT-/usr/include}}
 
@@ -177,6 +174,8 @@ while [ $# != 0 ]; do
          /#[a-z]*if.*[  (]m68k/                s/\([^_]\)m68k/\1__m68k__/g
          /#[a-z]*if.*[  (]__i386\([^_]\)/      s/__i386/__i386__/g
          /#[a-z]*if.*[  (]i386/                s/\([^_]\)i386/\1__i386__/g
+         /#[a-z]*if.*[  (!]__i860\([^_]\)/     s/__i860/__i860__/g
+         /#[a-z]*if.*[  (!]i860/               s/\([^_]\)i860/\1__i860__/g
          /#[a-z]*if.*[  (]sparc/       s/\([^_]\)sparc/\1__sparc__/g
          /#[a-z]*if.*[  (]mc68000/     s/\([^_]\)mc68000/\1__mc68000__/g
          /#[a-z]*if.*[  (]vax/         s/\([^_]\)vax/\1__vax__/g
@@ -189,6 +188,7 @@ while [ $# != 0 ]; do
          s/__STDC__[   ][      ]*==[   ][      ]*1/defined (__STRICT_ANSI__)/g
          s/__STDC__[   ][      ]*!=[   ][      ]*0/defined (__STRICT_ANSI__)/g
          s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
+         /^typedef[    ][      ]*[unsigned     ]*long[         ][      ]*[u_]*longlong_t;/s/long/long long/
        ' $2/$file > $2/$file.sed
        mv $2/$file.sed $2/$file
        if cmp $file $2/$file >/dev/null 2>&1; then
@@ -201,6 +201,44 @@ while [ $# != 0 ]; do
   shift; shift
 done
 
+# Install the proper definition of the three standard types in header files
+# that they come from.
+for file in sys/types.h stdlib.h sys/stdtypes.h stddef.h memory.h unistd.h; do
+  if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+    cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
+    chmod +w ${LIB}/$file 2>/dev/null
+    chmod a+r ${LIB}/$file 2>/dev/null
+  fi
+
+  if [ -r ${LIB}/$file ]; then
+    echo Fixing size_t, ptrdiff_t and wchar_t in $file
+    sed \
+      -e '/typedef[    ][      ]*[a-z_][       a-z_]*[         ]size_t/i\
+#ifndef __SIZE_TYPE__\
+#define __SIZE_TYPE__ long unsigned int\
+#endif
+' \
+      -e 's/typedef[   ][      ]*[a-z_][       a-z_]*[         ]size_t/typedef __SIZE_TYPE__ size_t/' \
+      -e '/typedef[    ][      ]*[a-z_][       a-z_]*[         ]ptrdiff_t/i\
+#ifndef __PTRDIFF_TYPE__\
+#define __PTRDIFF_TYPE__ long int\
+#endif
+' \
+      -e 's/typedef[   ][      ]*[a-z_][       a-z_]*[         ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
+      -e '/typedef[    ][      ]*[a-z_][       a-z_]*[         ]wchar_t/i\
+#ifndef __WCHAR_TYPE__\
+#define __WCHAR_TYPE__ int\
+#endif
+' \
+      -e 's/typedef[   ][      ]*[a-z_][       a-z_]*[         ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
+      ${LIB}/$file > ${LIB}/${file}.sed
+    rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+    if cmp $file ${LIB}/$file >/dev/null 2>&1; then
+      rm ${LIB}/$file
+    fi
+  fi
+done
+
 # Fix first broken decl of getcwd present on some svr4 systems.
 
 file=stdlib.h
@@ -471,7 +509,6 @@ fi
 
 # Avoid the definition of the bool type in the Solaris 2.x curses.h when using
 # g++, since it's now an official type in the C++ language.
-# CYGNUS LOCAL
 file=curses.h
 base=`basename $file`
 if [ -r ${LIB}/$file ]; then
@@ -971,32 +1008,33 @@ if [ \! -z "$file_to_fix" ]; then
 fi
 
 # Conditionalize some of <netinet/in.h> on _KERNEL being defined.
-
-file=netinet/in.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    sed -e '/#ifdef INKERNEL/i\
-#ifdef _KERNEL' \
-    -e '/#endif[       ]*\/\* INKERNEL \*\//a\
-#endif /* _KERNEL */' \
-    $file_to_fix > ${LIB}/${file}.sed
-    rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
-    echo Fixed $file_to_fix
-  fi
-fi
+# This has been taken out because it breaks on some versions of
+# DYNIX/ptx, and it does not seem to do much good on any system.
+# file=netinet/in.h
+# base=`basename $file`
+# if [ -r ${LIB}/$file ]; then
+#   file_to_fix=${LIB}/$file
+# else
+#   if [ -r ${INPUT}/$file ]; then
+#     file_to_fix=${INPUT}/$file
+#   else
+#     file_to_fix=""
+#   fi
+# fi
+# if [ \! -z "$file_to_fix" ]; then
+#   echo Checking $file_to_fix
+#   if grep _KERNEL $file_to_fix > /dev/null; then
+#     true
+#   else
+#     sed -e '/#ifdef INKERNEL/i\
+# #ifdef _KERNEL' \
+#     -e '/#endif[     ]*\/\* INKERNEL \*\//a\
+# #endif /* _KERNEL */' \
+#     $file_to_fix > ${LIB}/${file}.sed
+#     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+#     echo Fixed $file_to_fix
+#   fi
+# fi
 
 # Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
 
@@ -1383,6 +1421,38 @@ if [ \! -z "$file_to_fix" ]; then
   rm -f /tmp/$base
 fi
 
+# Solaris math.h and floatingpoint.h define __P without protection,
+# which conflicts with the fixproto definition.  The fixproto
+# definition and the Solaris definition are used the same way.
+for file in math.h floatingpoint.h; do
+  base=`basename $file`
+  if [ -r ${LIB}/$file ]; then
+    file_to_fix=${LIB}/$file
+  else
+    if [ -r ${INPUT}/$file ]; then
+      file_to_fix=${INPUT}/$file
+    else
+      file_to_fix=""
+    fi
+  fi
+  if [ \! -z "$file_to_fix" ]; then
+    echo Checking $file_to_fix
+    sed -e '/^#define[         ]*__P/i\
+#ifndef __P'\
+        -e '/^#define[         ]*__P/a\
+#endif' $file_to_fix > /tmp/$base
+    if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
+      true
+    else
+      echo Fixed $file_to_fix
+      rm -f ${LIB}/$file
+      cp /tmp/$base ${LIB}/$file
+      chmod a+r ${LIB}/$file
+    fi
+   rm -f /tmp/$base
+  fi
+done
+
 echo 'Removing unneeded directories:'
 cd $LIB
 files=`find . -type d -print | sort -r`
@@ -1440,17 +1510,11 @@ cat <<'__EOF__' >${LIB}/sys/byteorder.h
 #define __PDP_ENDIAN__      3412
 #endif
 
-#ifdef __GNUC__
-#define __STATIC static
-#else
-#define __STATIC
-#endif
-
 #ifdef __STDC__
-__STATIC __inline__ unsigned long htonl (unsigned long);
-__STATIC __inline__ unsigned short htons (unsigned int);
-__STATIC __inline__ unsigned long ntohl (unsigned long);
-__STATIC __inline__ unsigned short ntohs (unsigned int);
+static __inline__ unsigned long htonl (unsigned long);
+static __inline__ unsigned short htons (unsigned int);
+static __inline__ unsigned long ntohl (unsigned long);
+static __inline__ unsigned short ntohs (unsigned int);
 #endif /* defined (__STDC__) */
 
 #if defined (__i386__)
@@ -1463,7 +1527,7 @@ __STATIC __inline__ unsigned short ntohs (unsigned int);
 
 /* We must use a new-style function definition, so that this will also
    be valid for C++.  */
-__STATIC __inline__ unsigned long
+static __inline__ unsigned long
 htonl (unsigned long __arg)
 {
   register unsigned long __result;
@@ -1476,7 +1540,7 @@ htonl (unsigned long __arg)
 
 /* Convert a host short to a network short.  */
 
-__STATIC __inline__ unsigned short
+static __inline__ unsigned short
 htons (unsigned int __arg)
 {
   register unsigned short __result;
@@ -1498,7 +1562,7 @@ htons (unsigned int __arg)
 
 /* Convert a host long to a network long.  */
 
-__STATIC __inline__ unsigned long
+static __inline__ unsigned long
 htonl (unsigned long __arg)
 {
   register unsigned long __result;
@@ -1512,7 +1576,7 @@ htonl (unsigned long __arg)
 
 /* Convert a host short to a network short.  */
 
-__STATIC __inline__ unsigned short
+static __inline__ unsigned short
 htons (unsigned int __arg)
 {
   register unsigned short __result;
@@ -1530,7 +1594,7 @@ htons (unsigned int __arg)
 
 /* Convert a host long to a network long.  */
 
-__STATIC __inline__ unsigned long
+static __inline__ unsigned long
 htonl (unsigned long __arg)
 {
   return __arg;
@@ -1538,7 +1602,7 @@ htonl (unsigned long __arg)
 
 /* Convert a host short to a network short.  */
 
-__STATIC __inline__ unsigned short
+static __inline__ unsigned short
 htons (unsigned int __arg)
 {
   return __arg;
@@ -1548,7 +1612,7 @@ htons (unsigned int __arg)
 
 /* Convert a network long to a host long.  */
 
-__STATIC __inline__ unsigned long
+static __inline__ unsigned long
 ntohl (unsigned long __arg)
 {
   return htonl (__arg);
@@ -1556,15 +1620,12 @@ ntohl (unsigned long __arg)
 
 /* Convert a network short to a host short.  */
 
-__STATIC __inline__ unsigned short
+static __inline__ unsigned short
 ntohs (unsigned int __arg)
 {
   return htons (__arg);
 }
 
-
-#undef __STATIC
-
 __EOF__
 
 if [ -r ${INPUT}/sys/byteorder.h ]; then