aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>1996-09-30 21:19:11 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>1996-09-30 21:19:11 +0000
commitded732a0b7c7f4a84bd9e1500346ba9b5c705a79 (patch)
tree629a8978cae9ef511867d6849a691dc1fdc3d6df
parent6cb2e74e2e477603388f02e638d9325b07bc2214 (diff)
downloadgcc-ded732a0b7c7f4a84bd9e1500346ba9b5c705a79.zip
gcc-ded732a0b7c7f4a84bd9e1500346ba9b5c705a79.tar.gz
gcc-ded732a0b7c7f4a84bd9e1500346ba9b5c705a79.tar.bz2
Redefine exception in math.h
From-SVN: r12881
-rwxr-xr-xgcc/fixincludes46
1 files changed, 45 insertions, 1 deletions
diff --git a/gcc/fixincludes b/gcc/fixincludes
index 642a73c..a687766 100755
--- a/gcc/fixincludes
+++ b/gcc/fixincludes
@@ -1322,7 +1322,7 @@ if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
fi
if [ -r ${LIB}/$file ]; then
- if grep 'class[(]' ${LIB}/$file >/dev/null; then
+ if grep '[^a-zA-Z_]class[(]' ${LIB}/$file >/dev/null; then
echo Fixing $file
sed -e '/class[(]/i\
#ifndef __cplusplus
@@ -2705,6 +2705,50 @@ if [ -r ${LIB}/$file ]; then
fi
fi
+# Some math.h files define 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
+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, exception
+ sed -e '/struct exception/i\
+#ifdef __cplusplus\
+#define exception __math_exception\
+#endif'\
+ -e '/struct exception/a\
+#ifdef __cplusplus\
+#undef exception\
+#endif' ${LIB}/$file > ${LIB}/${file}.sed
+ rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+ if egrep 'matherr()' ${LIB}/$file >/dev/null 2>&1; then
+ sed -e '/matherr/i\
+#ifdef __cplusplus\
+#define exception __math_exception\
+#endif'\
+ -e '/matherr/a\
+#ifdef __cplusplus\
+#undef exception\
+#endif' ${LIB}/$file > ${LIB}/${file}.sed
+ rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+ fi
+ if cmp $file ${LIB}/$file >/dev/null 2>&1; then
+ rm -f ${LIB}/$file
+ else
+ # Find any include directives that use "file".
+ for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
+ dir=`echo $file | sed -e s'|/[^/]*$||'`
+ required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
+ done
+ fi
+fi
+
# This loop does not appear to do anything, because it uses file
# rather than $file when setting target. It also appears to be
# unnecessary, since the main loop processes symbolic links.