From 6313a654f751f936d313f265849c76e87515b2c4 Mon Sep 17 00:00:00 2001 From: Brendan Kehoe Date: Tue, 3 Jun 1997 19:19:01 -0400 Subject: [PATCH] * fixincludes: Fix AIX NULL macro use of void*. From-SVN: r14144 --- gcc/fixincludes | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gcc/fixincludes b/gcc/fixincludes index cdb25b20d28c..f7adfa1a0e54 100755 --- a/gcc/fixincludes +++ b/gcc/fixincludes @@ -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. -- 2.43.5