* cpphash.h (IN_I): New flag for directive table.
[official-gcc.git] / libstdc++-v3 / mknumeric_limits
blob3f5221152b1e2e8b5f53d3f13cbc115e6a87c713
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 : ${CXX:=g++}
13 case `uname` in
14 CYGWIN*)
15 LDFLAGS='-nodefaultlibs -lcygwin -lc -lkernel32 -lgcc' ;;
16 *)
17 LDFLAGS='-nodefaultlibs -lgcc -lc' ;;
18 esac
20 BUILD_DIR=$1
21 if [ ! -d "$BUILD_DIR" ]; then
22 echo "build directory $BUILD_DIR not found, exiting."
23 exit 1
26 if [ ! -d "$BUILD_DIR/bits" ]; then
27 mkdir "$BUILD_DIR/bits"
29 if [ ! -d "$BUILD_DIR/src" ]; then
30 mkdir "$BUILD_DIR/src"
33 OUT_H="$BUILD_DIR/bits/std_limits.h"
34 OUT_C="$BUILD_DIR/src/limitsMEMBERS.cc"
36 if [ -f $OUT_C ]; then
37 rm -f $OUT_H OUT_C
40 SRC_DIR=$2
41 if [ ! -d "$SRC_DIR" ]; then
42 echo "source directory $SRC_DIR not found, exiting."
43 exit 1
46 XCOMPILE=$3
47 if [ $XCOMPILE -eq 1 ]; then
48 echo "using default values for cross compiles"
49 cp $SRC_DIR/bits/limits_generic.h $OUT_H
50 cp $SRC_DIR/src/limits_generic.cc $OUT_C
51 exit 0;
52 fi
54 cat <<EOF > $OUT_H
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 echo "$CXX $CPPFLAGS -I$BUILD_DIR \
167 -o "$BUILD_DIR/src/gen-num-limits" "$SRC_DIR/src/gen-num-limits.cc" \
168 $LDFLAGS"
170 $CXX $CPPFLAGS -I$BUILD_DIR \
171 -o "$BUILD_DIR/src/gen-num-limits" "$SRC_DIR/src/gen-num-limits.cc" \
172 $LDFLAGS
174 if [ ! -f "$BUILD_DIR/src/gen-num-limits" ]; then
175 echo "gen-num-limits failed to build, exiting."
176 exit 1
179 "$BUILD_DIR/src/gen-num-limits" >> $OUT_H
181 cat <<EOF >> $OUT_H
182 } // namespace std
184 #endif // _CPP_NUMERIC_LIMITS
187 trait_name=numeric_limits
189 cat <<EOF > $OUT_C
190 // Static data members of -*- C++ -*- numeric_limits classes
192 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
194 // This file is part of the GNU ISO C++ Library. This library is free
195 // software; you can redistribute it and/or modify it under the
196 // terms of the GNU General Public License as published by the
197 // Free Software Foundation; either version 2, or (at your option)
198 // any later version.
200 // This library is distributed in the hope that it will be useful,
201 // but WITHOUT ANY WARRANTY; without even the implied warranty of
202 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
203 // GNU General Public License for more details.
205 // You should have received a copy of the GNU General Public License along
206 // with this library; see the file COPYING. If not, write to the Free
207 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
208 // USA.
210 // As a special exception, you may use this file as part of a free software
211 // library without restriction. Specifically, if other files instantiate
212 // templates or use macros or inline functions from this file, or you compile
213 // this file and link it with other files to produce an executable, this
214 // file does not by itself cause the resulting executable to be covered by
215 // the GNU General Public License. This exception does not however
216 // invalidate any other reasons why the executable file might be covered by
217 // the GNU General Public License.
219 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
222 // ISO C++ 14882:1998
223 // 18.2.1
226 #include <bits/std_limits.h>
227 namespace std {
230 for type_name in bool char 'signed char' 'unsigned char' \
231 short 'unsigned short' int 'unsigned int' \
232 long 'unsigned long' 'long long' 'unsigned long long' \
233 float double 'long double'
235 grep "<$type_name>" $OUT_H >/dev/null 2>&1 || continue
236 cat <<EOF >> $OUT_C
238 const bool $trait_name<$type_name>::is_specialized;
239 const int $trait_name<$type_name>::digits;
240 const int $trait_name<$type_name>::digits10;
241 const bool $trait_name<$type_name>::is_signed;
242 const bool $trait_name<$type_name>::is_integer;
243 const bool $trait_name<$type_name>::is_exact;
244 const int $trait_name<$type_name>::radix;
245 const int $trait_name<$type_name>::min_exponent;
246 const int $trait_name<$type_name>::min_exponent10;
247 const int $trait_name<$type_name>::max_exponent;
248 const int $trait_name<$type_name>::max_exponent10;
249 const bool $trait_name<$type_name>::has_infinity;
250 const bool $trait_name<$type_name>::has_quiet_NaN;
251 const bool $trait_name<$type_name>::has_signaling_NaN;
252 const float_denorm_style $trait_name<$type_name>::has_denorm;
253 const bool $trait_name<$type_name>::has_denorm_loss;
254 const bool $trait_name<$type_name>::is_iec559;
255 const bool $trait_name<$type_name>::is_bounded;
256 const bool $trait_name<$type_name>::is_modulo;
257 const bool $trait_name<$type_name>::traps;
258 const bool $trait_name<$type_name>::tinyness_before;
259 const float_round_style $trait_name<$type_name>::round_style;
262 done
264 cat <<EOF >> $OUT_C
265 } // namespace std