* gcc_release: Add support for modifying ChangeLogs and
[official-gcc.git] / libstdc++-v3 / mknumeric_limits
blob635e280abd699f4c462bb20c6d2d5489d6a91a62
1 #! /bin/sh
3 # mknumeric_limits: generates
4 # - part of bits/std_limits.h completed by gen-num-limits.cc
5 # - src/limitsMEMBERS.cc that contains the definition of various
6 # static data members of specialization of class template numeric_limits
9 echo "running mknumeric_limits"
11 BUILD_DIR=$1
12 if [ ! -d "$BUILD_DIR" ]; then
13 echo "build directory $BUILD_DIR not found, exiting."
14 exit 1
17 if [ ! -d "$BUILD_DIR/include" ]; then
18 mkdir "$BUILD_DIR/include"
21 if [ ! -d "$BUILD_DIR/include/bits" ]; then
22 mkdir "$BUILD_DIR/include/bits"
25 if [ ! -d "$BUILD_DIR/src" ]; then
26 mkdir "$BUILD_DIR/src"
29 OUT_H="$BUILD_DIR/include/bits/std_limits.h"
30 OUT_C="$BUILD_DIR/src/limitsMEMBERS.cc"
32 if [ -f $OUT_C ]; then
33 rm -f $OUT_H $OUT_C $OUT_H-t $OUT_C-t
36 SRC_DIR=$2
37 if [ ! -d "$SRC_DIR" ]; then
38 echo "source directory $SRC_DIR not found, exiting."
39 exit 1
42 XCOMPILE=$3
43 if [ $XCOMPILE -eq 1 ]; then
44 echo "using default values for cross compiles"
45 cp $SRC_DIR/include/bits/limits_generic.h $OUT_H
46 cp $SRC_DIR/src/limits_generic.cc $OUT_C
47 exit 0;
48 fi
50 CC=${CC="$BUILD_DIR/../../gcc/xgcc -B$BUILD_DIR/../../gcc/"}
52 # We output to a temporary file, so that we don't appear to have
53 # succeeded unless we actually do.
54 cat <<EOF > $OUT_H-t
55 // The template and inlines for the -*- C++ -*- numeric_limits classes.
57 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
59 // This file is part of the GNU ISO C++ Library. This library is free
60 // software; you can redistribute it and/or modify it under the
61 // terms of the GNU General Public License as published by the
62 // Free Software Foundation; either version 2, or (at your option)
63 // any later version.
65 // This library is distributed in the hope that it will be useful,
66 // but WITHOUT ANY WARRANTY; without even the implied warranty of
67 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 // GNU General Public License for more details.
70 // You should have received a copy of the GNU General Public License along
71 // with this library; see the file COPYING. If not, write to the Free
72 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
73 // USA.
75 // As a special exception, you may use this file as part of a free software
76 // library without restriction. Specifically, if other files instantiate
77 // templates or use macros or inline functions from this file, or you compile
78 // this file and link it with other files to produce an executable, this
79 // file does not by itself cause the resulting executable to be covered by
80 // the GNU General Public License. This exception does not however
81 // invalidate any other reasons why the executable file might be covered by
82 // the GNU General Public License.
84 // Note: this is not a conforming implementation.
85 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
88 // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
92 // ISO 14882:1998
93 // 18.2.1
96 #ifndef _CPP_NUMERIC_LIMITS
97 #define _CPP_NUMERIC_LIMITS 1
99 #include <bits/c++config.h>
100 #include <bits/std_cfloat.h>
102 namespace std {
104 enum float_round_style {
105 round_indeterminate = -1,
106 round_toward_zero = 0,
107 round_to_nearest = 1,
108 round_toward_infinity = 2,
109 round_toward_neg_infinity = 3
112 enum float_denorm_style {
113 denorm_indeterminate = -1,
114 denorm_absent = 0,
115 denorm_present = 1
118 template<typename _Tp> struct numeric_limits {
119 static const bool is_specialized = false;
121 static _Tp min() throw() { return static_cast<_Tp>(0); }
122 static _Tp max() throw() { return static_cast<_Tp>(0); }
124 static const int digits = 0;
125 static const int digits10 = 0;
126 static const bool is_signed = false;
127 static const bool is_integer = false;
128 static const bool is_exact = false;
129 static const int radix = 0;
131 static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
132 static _Tp round_error() throw() { return static_cast<_Tp>(0); }
134 static const int min_exponent = 0;
135 static const int min_exponent10 = 0;
136 static const int max_exponent = 0;
137 static const int max_exponent10 = 0;
139 static const bool has_infinity = false;
140 static const bool has_quiet_NaN = false;
141 static const bool has_signaling_NaN = false;
142 static const float_denorm_style has_denorm = denorm_absent;
143 static const bool has_denorm_loss = false;
145 static _Tp infinity() throw() { return static_cast<_Tp>(0); }
146 static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
147 static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
148 static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
150 static const bool is_iec559 = false;
151 static const bool is_bounded = false;
152 static const bool is_modulo = false;
154 static const bool traps = false;
155 static const bool tinyness_before = false;
156 static const float_round_style round_style = round_toward_zero;
159 template<typename _Tp> _Tp __limits_infinity();
160 template<typename _Tp> _Tp __limits_quiet_NaN();
161 template<typename _Tp> _Tp __limits_signaling_NaN();
162 template<typename _Tp> _Tp __limits_denorm_min();
166 # Must turn off exceptions, because the C++ exception handling support
167 # routines have not been built yet.
168 echo "$CC -I. $CPPFLAGS -I$BUILD_DIR/include -DHAVE_CONFIG_H -fno-exceptions \
169 -o $BUILD_DIR/src/gen-num-limits $SRC_DIR/src/gen-num-limits.cc"
171 { $CC -I. $CPPFLAGS -I$BUILD_DIR/include -DHAVE_CONFIG_H -fno-exceptions \
172 -o "$BUILD_DIR/src/gen-num-limits" "$SRC_DIR/src/gen-num-limits.cc"
173 } || {
174 echo "gen-num-limits failed to build, exiting."
175 exit 1
178 "$BUILD_DIR/src/gen-num-limits" >> $OUT_H-t || {
179 echo "gen-num-limits failed to execute, exiting."
180 exit 1
183 cat <<EOF >> $OUT_H-t
184 } // namespace std
186 #endif // _CPP_NUMERIC_LIMITS
189 trait_name=numeric_limits
191 cat <<EOF > $OUT_C-t
192 // Static data members of -*- C++ -*- numeric_limits classes
194 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
196 // This file is part of the GNU ISO C++ Library. This library is free
197 // software; you can redistribute it and/or modify it under the
198 // terms of the GNU General Public License as published by the
199 // Free Software Foundation; either version 2, or (at your option)
200 // any later version.
202 // This library is distributed in the hope that it will be useful,
203 // but WITHOUT ANY WARRANTY; without even the implied warranty of
204 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
205 // GNU General Public License for more details.
207 // You should have received a copy of the GNU General Public License along
208 // with this library; see the file COPYING. If not, write to the Free
209 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
210 // USA.
212 // As a special exception, you may use this file as part of a free software
213 // library without restriction. Specifically, if other files instantiate
214 // templates or use macros or inline functions from this file, or you compile
215 // this file and link it with other files to produce an executable, this
216 // file does not by itself cause the resulting executable to be covered by
217 // the GNU General Public License. This exception does not however
218 // invalidate any other reasons why the executable file might be covered by
219 // the GNU General Public License.
221 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
224 // ISO C++ 14882:1998
225 // 18.2.1
228 #include <bits/std_limits.h>
229 namespace std {
232 for type_name in bool char 'signed char' 'unsigned char' \
233 short 'unsigned short' int 'unsigned int' \
234 long 'unsigned long' 'long long' 'unsigned long long' \
235 float double 'long double'
237 grep "<$type_name>" $OUT_H-t >/dev/null 2>&1 || continue
238 cat <<EOF >> $OUT_C-t
240 const bool $trait_name<$type_name>::is_specialized;
241 const int $trait_name<$type_name>::digits;
242 const int $trait_name<$type_name>::digits10;
243 const bool $trait_name<$type_name>::is_signed;
244 const bool $trait_name<$type_name>::is_integer;
245 const bool $trait_name<$type_name>::is_exact;
246 const int $trait_name<$type_name>::radix;
247 const int $trait_name<$type_name>::min_exponent;
248 const int $trait_name<$type_name>::min_exponent10;
249 const int $trait_name<$type_name>::max_exponent;
250 const int $trait_name<$type_name>::max_exponent10;
251 const bool $trait_name<$type_name>::has_infinity;
252 const bool $trait_name<$type_name>::has_quiet_NaN;
253 const bool $trait_name<$type_name>::has_signaling_NaN;
254 const float_denorm_style $trait_name<$type_name>::has_denorm;
255 const bool $trait_name<$type_name>::has_denorm_loss;
256 const bool $trait_name<$type_name>::is_iec559;
257 const bool $trait_name<$type_name>::is_bounded;
258 const bool $trait_name<$type_name>::is_modulo;
259 const bool $trait_name<$type_name>::traps;
260 const bool $trait_name<$type_name>::tinyness_before;
261 const float_round_style $trait_name<$type_name>::round_style;
264 done
266 cat <<EOF >> $OUT_C-t
267 } // namespace std
272 mv $OUT_C-t $OUT_C
273 mv $OUT_H-t $OUT_H