OSDN Git Service

* fixincludes: Fix AIX NULL macro use of void*.
authorbrendan <brendan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jun 1997 23:19:01 +0000 (23:19 +0000)
committerbrendan <brendan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jun 1997 23:19:01 +0000 (23:19 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14144 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fixincludes

index cdb25b2..f7adfa1 100755 (executable)
@@ -2860,6 +2860,34 @@ for file in reg_types.h regex.h sys/lc_core.h; do
   fi
 done
 
+# AIX headers define NULL to be cast to a void pointer, which is illegal
+# in ANSI C++.
+for file in curses.h dbm.h locale.h stdio.h stdlib.h string.h time.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
+    if egrep '#.*define.*NULL.*void' ${LIB}/$file >/dev/null 2>&1; then
+      echo "Fixing $file, bad NULL macro"
+      sed -e 's/^#[    ]*define[       ]*NULL[         ]*((void[       ]*\*)0)/#define NULL 0/' \
+        ${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 -f ${LIB}/$file
+      else
+        # Find any include directives that use "file".
+        for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
+         dir=`echo $file | sed -e s'|/[^/]*$||'`
+         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
+        done
+      fi
+    fi
+  fi
+done
+
 # This loop does not appear to do anything, because it uses file
 # rather than $file when setting target.  It also appears to be
 # unnecessary, since the main loop processes symbolic links.