OSDN Git Service

Fix static functions in sys/stat.h for C++
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 Jul 1997 20:16:19 +0000 (20:16 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 Jul 1997 20:16:19 +0000 (20:16 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14366 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fixinc.sco

index ead8298..c0ca782 100755 (executable)
@@ -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