diff --git a/gcc/fixincludes b/gcc/fixincludes index c3b749c7ef7..413eefef5d4 100755 --- a/gcc/fixincludes +++ b/gcc/fixincludes @@ -43,11 +43,9 @@ fi echo 'Making directories:' cd ${INPUT} -if $LINKS; then - files=`ls -LR | sed -n s/:$//p` -else - files=`find . -type d -print | sed '/^.$/d'` -fi +# Find all directories and all symlinks that point to directories. +files=` find . -type d -print | sed '/^.$/d' + $LINKS && find . -type l -exec test -d '{}' \; -print` for file in $files; do rm -rf $LIB/$file if [ ! -d $LIB/$file ] @@ -110,10 +108,12 @@ while [ $# != 0 ]; do for file in $files; do # This call to egrep is essential, since checking a file with egrep # is much faster than actually trying to fix it. +# It is also essential that most files *not* match! +# Thus, matching every #endif is unacceptable. # But the argument to egrep must be kept small, or many versions of egrep # won't be able to handle it. # rms: I removed `|#[el].*if.*[^/ ]' because it made egrep fail. - if egrep '[ _]_IO|CTRL|#define.NULL|#[el]*if.*([0-9]|#e[nl]|sparc|vax|sun|pyr)' $file > /dev/null; then + if egrep '[ _]_IO|CTRL|#define.NULL|#[el]*if.*([0-9]|sparc|vax|sun|pyr)' $file > /dev/null; then echo Fixing $file if [ -r $file ]; then cp $file $2/$file >/dev/null 2>&1 \ @@ -194,8 +194,8 @@ if [ -r ${LIB}/$file ]; then ex ${LIB}/$file < has defined it. */ +#ifndef _T_PTRDIFF_ #ifndef _T_PTRDIFF #ifndef __PTRDIFF_T #ifndef _PTRDIFF_T_ #ifndef ___int_ptrdiff_t_h +#ifndef _GCC_PTRDIFF_T #define _PTRDIFF_T +#define _T_PTRDIFF_ #define _T_PTRDIFF #define __PTRDIFF_T #define _PTRDIFF_T_ #define ___int_ptrdiff_t_h +#define _GCC_PTRDIFF_T #ifndef __PTRDIFF_TYPE__ #define __PTRDIFF_TYPE__ long int #endif typedef __PTRDIFF_TYPE__ ptrdiff_t; +#endif /* _GCC_PTRDIFF_T */ #endif /* ___int_ptrdiff_t_h */ #endif /* _PTRDIFF_T_ */ #endif /* __PTRDIFF_T */ #endif /* _T_PTRDIFF */ +#endif /* _T_PTRDIFF_ */ #endif /* _PTRDIFF_T */ /* Unsigned type of `sizeof' something. */ #ifndef _SIZE_T /* in case has defined it. */ +#ifndef _T_SIZE_ #ifndef _T_SIZE #ifndef __SIZE_T #ifndef _SIZE_T_ #ifndef ___int_size_t_h +#ifndef _GCC_SIZE_T #define _SIZE_T +#define _T_SIZE_ #define _T_SIZE #define __SIZE_T #define _SIZE_T_ #define ___int_size_t_h +#define _GCC_SIZE_T #ifndef __SIZE_TYPE__ #define __SIZE_TYPE__ long unsigned int #endif typedef __SIZE_TYPE__ size_t; +#endif /* _GCC_SIZE_T */ #endif /* ___int_size_t_h */ #endif /* _SIZE_T_ */ #endif /* __SIZE_T */ #endif /* _T_SIZE */ +#endif /* _T_SIZE_ */ #endif /* _SIZE_T */ /* Data type for wide chars. */ @@ -65,12 +77,14 @@ typedef __SIZE_TYPE__ size_t; #ifndef __WCHAR_T #ifndef _WCHAR_T_ #ifndef ___int_wchar_t_h +#ifndef _GCC_WCHAR_T #define _WCHAR_T #define _T_WCHAR_ #define _T_WCHAR #define __WCHAR_T #define _WCHAR_T_ #define ___int_wchar_t_h +#define _GCC_WCHAR_T #ifndef __WCHAR_TYPE__ #define __WCHAR_TYPE__ int #endif @@ -81,6 +95,7 @@ typedef __WCHAR_TYPE__ wchar_t; #endif #endif #endif +#endif #endif /* __sys_stdtypes_h */