]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/fixinc.svr4
(va_list) [__SVR4_2__]: Don't set or test _VA_LIST.
[gcc.git] / gcc / fixinc.svr4
index 4288efc8bd6448d60d658ddd745f8deef52b08df..003750630203c6459126a3ffd8be65464a69e6e9 100755 (executable)
@@ -31,6 +31,9 @@
 #
 #      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}}
 
@@ -41,7 +44,7 @@ exit 1
 fi
 
 # Directory in which to store the results.
-LIB=${1-${LIB-/usr/local/lib/gcc-include}}
+LIB=${1?"fixincludes: output directory not specified"}
 
 # Make sure it exists.
 if [ ! -d $LIB ]; then
@@ -55,8 +58,12 @@ cd $LIB; LIB=`pwd`
 
 # This prevents /bin/ex from failing if the current terminal type is
 # unrecognizable.
-TERM=unknown
+TERM=dumb
 export TERM
+# This prevents /bin/ex from failing if the EXINIT environment variable
+# was set to something invalid.
+EXINIT=""
+export EXINIT
 
 echo 'Building fixincludes in ' ${LIB}
 
@@ -494,6 +501,7 @@ EOF
 fi
 
 # Add a #define of _SIGACTION_ into <sys/signal.h>.
+# Also fix types of SIG_DFL, SIG_ERR, SIG_IGN, and SIG_HOLD.
 
 file=sys/signal.h
 base=`basename $file`
@@ -515,6 +523,7 @@ if [ \! -z "$file_to_fix" ]; then
 #define _SIGACTION_
 struct  sigaction  {
 .
+  1,\$s/(void *(\*)())/(void (*)(int))/
   wq
 EOF
   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
@@ -853,6 +862,114 @@ if [ \! -z "$file_to_fix" ]; then
   fi
 fi
 
+# Remove useless extern keyword from struct forward declarations in
+# <sys/stream.h> and <sys/strsubr.h>
+
+file=sys/stream.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
+  sed -e 's/extern struct \(stdata\|strevent\);/struct \1;/' $file_to_fix > /tmp/$base 
+  if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
+    echo No change needed in $file_to_fix
+  else
+    echo Fixed $file_to_fix
+    rm -f ${LIB}/$file
+    cp /tmp/$base ${LIB}/$file
+  fi
+  rm -f /tmp/$base
+fi
+
+file=sys/strsubr.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
+  sed -e 's/extern struct \(strbuf\|uio\|thread\|proc\);/struct \1;/' $file_to_fix > /tmp/$base 
+  if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
+    echo No change needed in $file_to_fix
+  else
+    echo Fixed $file_to_fix
+    rm -f ${LIB}/$file
+    cp /tmp/$base ${LIB}/$file
+  fi
+  rm -f /tmp/$base
+fi
+
+# Convert functions to prototype form, and fix arg names in <sys/stat.h>.
+
+file=sys/stat.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
+  cp $file_to_fix /tmp/$base
+  chmod +w /tmp/$base
+  ex /tmp/$base <<EOF
+/^stat(path, buf)/j
+j
+-
+/^stat(path, buf)/c
+stat (const char *path, struct stat *buf)
+.
+/^lstat(path, buf)/j
+j
+-
+/^lstat(path, buf)/c
+lstat (const char *path, struct stat *buf)
+.
+/^fstat(fd, buf)/j
+j
+-
+/^fstat(fd, buf)/c
+fstat (int fd, struct stat *buf)
+.
+/^mknod(path, mode, dev)/j
+j
+j
+-
+/^mknod(path, mode, dev)/c
+mknod (const char *path, mode_t mode, dev_t dev)
+.
+1,\$s/path/__path/g
+1,\$s/buf/__buf/g
+1,\$s/fd/__fd/g
+1,\$s/ret\\([^u]\\)/__ret\1/g
+1,\$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g
+1,\$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g
+wq
+EOF
+  echo Fixed $file_to_fix
+  rm -f ${LIB}/$file
+  cp /tmp/$base ${LIB}/$file
+  rm -f /tmp/$base
+fi
+
 # Sony NEWSOS 5.0 does not support the complete ANSI C standard.
 
 if [ -x /bin/sony ]; then
@@ -950,7 +1067,7 @@ cd ${ORIG_DIR}
 
 echo 'Replacing <sys/byteorder.h>'
 rm -f ${LIB}/sys/byteorder.h
-cp byteorder.h ${LIB}/sys/byteorder.h
+cp ${SRCDIR}/byteorder.h ${LIB}/sys/byteorder.h
 
 exit 0
 
This page took 0.031603 seconds and 5 git commands to generate.