source: trunk/third/gcc/fixinc.math @ 11288

Revision 11288, 1.5 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r11287, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1#! /bin/sh
2# Fix struct exception in /usr/include/math.h.
3#
4# We expect several systems which did not need fixincludes in the past
5# to need to fix just math.h.  So we created a separate fixinc.math
6# script to fix just that problem.
7# See README-fixinc for more information.
8
9# Directory containing the original header files.
10# (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
11INPUT=${2-${INPUT-/usr/include}}
12
13# Directory in which to store the results.
14LIB=${1?"fixincludes: output directory not specified"}
15
16# Make sure it exists.
17if [ ! -d $LIB ]; then
18  mkdir $LIB || exit 1
19fi
20
21echo Building fixed headers in ${LIB}
22
23# Some math.h files define struct exception, which conflicts with
24# the class exception defined in the C++ file std/stdexcept.h.  We
25# redefine it to __math_exception.  This is not a great fix, but I
26# haven't been able to think of anything better.
27file=math.h
28if [ -r $INPUT/$file ]; then
29  echo Checking $INPUT/$file
30  if grep 'struct exception' $INPUT/$file >/dev/null
31  then
32    echo Fixed $file
33    rm -f $LIB/$file
34    cat <<'__EOF__' >$LIB/$file
35#ifndef _MATH_H_WRAPPER
36#ifdef __cplusplus
37# define exception __math_exception
38#endif
39#include_next <math.h>
40#ifdef __cplusplus
41# undef exception
42#endif
43#define _MATH_H_WRAPPER
44#endif /* _MATH_H_WRAPPER */
45__EOF__
46    # Define _MATH_H_WRAPPER at the end of the wrapper, not the start,
47    # so that if #include_next gets another instance of the wrapper,
48    # this will follow the #include_next chain until we arrive at
49    # the real <math.h>.
50    chmod a+r $LIB/$file
51  fi
52fi
53exit 0
Note: See TracBrowser for help on using the repository browser.