* decl.c (grokdeclarator): Remove const and volatile from type after
[official-gcc.git] / gcc / fixinc.math
bloba8a9fe7e4d3f86418bc73074df7998d0e08707b6
1 #! /bin/sh
2 # Fix struct exception in /usr/include/math.h.
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.
9 # Directory containing the original header files.
10 # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
11 INPUT=${2-${INPUT-/usr/include}}
13 # Directory in which to store the results.
14 LIB=${1?"fixincludes: output directory not specified"}
16 # Make sure it exists.
17 if [ ! -d $LIB ]; then
18 mkdir $LIB || exit 1
21 echo Building fixed headers in ${LIB}
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.
27 file=math.h
28 if [ -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
53 exit 0