summaryrefslogtreecommitdiff
path: root/gcc/fixinc.sco
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>1997-07-01 20:16:19 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>1997-07-01 20:16:19 +0000
commitb3fd81925d96d46b83b9d32daf10a213792ca9a4 (patch)
tree0a81ba150e8cc4cddf9ad29ee3201b8b9d7c1105 /gcc/fixinc.sco
parent8195ec37afe082d68902cab332762a92fc4c5abf (diff)
downloadgcc-b3fd81925d96d46b83b9d32daf10a213792ca9a4.tar.gz
Fix static functions in sys/stat.h for C++
From-SVN: r14366
Diffstat (limited to 'gcc/fixinc.sco')
-rwxr-xr-xgcc/fixinc.sco30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/fixinc.sco b/gcc/fixinc.sco
index ead82984b58..c0ca7826d7f 100755
--- a/gcc/fixinc.sco
+++ b/gcc/fixinc.sco
@@ -338,6 +338,36 @@ if [ \! -z "$file_to_fix" ]; then
rm -f /tmp/$base
fi
+#
+# Also, the static functions lstat() and fchmod() in <sys/stat.h>
+# cause G++ grief since they're not wrapped in "if __cplusplus".
+# Fix that up now.
+#
+file=sys/stat.h
+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, static definitions not C++-aware.
+ sed -e '/^static int[ ]*/i\
+#if __cplusplus\
+extern "C"\
+{\
+#endif /* __cplusplus */ \
+' \
+-e '/^}$/a\
+#if __cplusplus\
+}\
+#endif /* __cplusplus */ \
+' ${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
+ fi
+fi
echo 'Removing unneeded directories:'
cd $LIB