OSDN Git Service

(sys/types.h): Replace definition of size_t based on SIZE_TYPE.
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Feb 1993 23:21:42 +0000 (23:21 +0000)
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Feb 1993 23:21:42 +0000 (23:21 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@3481 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fixincludes

index 987d4e4..52a1e27 100755 (executable)
@@ -280,6 +280,33 @@ done
 
 cd ${INPUT}
 
+# Install the proper definition of size_t in header files that it comes from.
+for file in sys/types.h sys/stdtypes.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 $file comment
+    # Extract the definition of SIZE_TYPE, if any.
+    # (This file must be called something.c).
+    echo "#include \"tm.h\"
+gobblegobble SIZE_TYPE" > types.c
+    foo=`cc -E -I. -I$SRCDIR -I$SRCDIR/config types.c | grep gobblegobble | sed -e "s/gobblegobble[    ]*//"`
+    rm -f types.c
+    # Default to our preferred type.
+    if [ $foo = SIZE_TYPE ]; then foo="unsigned long int"; else true; fi
+    sed -e "s/typedef[         a-z_]*[         ]size_t/typedef $foo size_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 one other error in this file: a mismatched quote not inside a C comment.
 file=sundev/vuid_event.h
 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then