summaryrefslogtreecommitdiff
path: root/gcc/fixinc.sco
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1997-06-21 11:54:35 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1997-06-21 11:54:35 +0000
commit443a01226af88aaf1deaa5d23aa24cb248d8e1a4 (patch)
tree55b2d5a1b90747f33b24952e0e3f645008ac113c /gcc/fixinc.sco
parent32727b9e15ffb7f5479c5e41c16b99dd8bede2e7 (diff)
downloadgcc-443a01226af88aaf1deaa5d23aa24cb248d8e1a4.tar.gz
(math.h): Correct the collision of "exception".
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14280 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixinc.sco')
-rwxr-xr-xgcc/fixinc.sco40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/fixinc.sco b/gcc/fixinc.sco
index b3301e19cba..1b2a0630f66 100755
--- a/gcc/fixinc.sco
+++ b/gcc/fixinc.sco
@@ -6,6 +6,8 @@
# Based on fixinc.svr4 script by Ron Guilmette (rfg@ncd.com) (SCO
# modifications by Ian Lance Taylor (ian@airs.com)).
#
+# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+#
# This file is part of GNU CC.
#
# GNU CC is free software; you can redistribute it and/or modify
@@ -290,6 +292,44 @@ if [ -r ${LIB}/$file ]; then
fi
fi
+# This function is borrowed from fixinclude.svr4
+# The OpenServer math.h defines struct exception, which conflicts with
+# the class exception defined in the C++ file std/stdexcept.h. We
+# redefine it to __math_exception. This is not a great fix, but I
+# haven't been able to think of anything better.
+file=math.h
+base=`basename $file`
+if [ -r ${LIB}/$file ]; then
+ file_to_fix=${LIB}/$file
+else
+ if [ -r ${INPUT}/$file ]; then
+ file_to_fix=${INPUT}/$file
+ else
+ file_to_fix=""
+ fi
+fi
+if [ \! -z "$file_to_fix" ]; then
+ echo Checking $file_to_fix
+ sed -e '/struct exception/i\
+#ifdef __cplusplus\
+#define exception __math_exception\
+#endif'\
+ -e '/struct exception/a\
+#ifdef __cplusplus\
+#undef exception\
+#endif' $file_to_fix > /tmp/$base
+ if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
+ true
+ else
+ echo Fixed $file_to_fix
+ rm -f ${LIB}/$file
+ cp /tmp/$base ${LIB}/$file
+ chmod a+r ${LIB}/$file
+ fi
+ rm -f /tmp/$base
+fi
+
+
echo 'Removing unneeded directories:'
cd $LIB
files=`find . -type d -print | sort -r`