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"
13 LDFLAGS
='-nodefaultlibs -lcygwin -lc -lkernel32 -lgcc' ;;
17 LDFLAGS
='-nodefaultlibs -lgcc -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a' ;;
19 LDFLAGS
='-nodefaultlibs -lgcc -lc' ;;
23 LDFLAGS
='-nodefaultlibs -lgcc -lc' ;;
27 if [ ! -d "$BUILD_DIR" ]; then
28 echo "build directory $BUILD_DIR not found, exiting."
32 if [ ! -d "$BUILD_DIR/include" ]; then
33 mkdir
"$BUILD_DIR/include"
36 if [ ! -d "$BUILD_DIR/include/bits" ]; then
37 mkdir
"$BUILD_DIR/include/bits"
40 if [ ! -d "$BUILD_DIR/src" ]; then
41 mkdir
"$BUILD_DIR/src"
44 OUT_H
="$BUILD_DIR/include/bits/std_limits.h"
45 OUT_C
="$BUILD_DIR/src/limitsMEMBERS.cc"
47 if [ -f $OUT_C ]; then
48 rm -f $OUT_H $OUT_C $OUT_H-t $OUT_C-t
52 if [ ! -d "$SRC_DIR" ]; then
53 echo "source directory $SRC_DIR not found, exiting."
58 if [ $XCOMPILE -eq 1 ]; then
59 echo "using default values for cross compiles"
60 cp $SRC_DIR/include
/bits
/limits_generic.h
$OUT_H
61 cp $SRC_DIR/src
/limits_generic.cc
$OUT_C
65 : ${CXX:="$BUILD_DIR/../../gcc/g++ -B$BUILD_DIR/../../gcc/"}
67 # We output to a temporary file, so that we don't appear to have
68 # succeeded unless we actually do.
70 // The template and inlines for the -*- C++ -*- numeric_limits classes.
72 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
74 // This file is part of the GNU ISO C++ Library. This library is free
75 // software; you can redistribute it and/or modify it under the
76 // terms of the GNU General Public License as published by the
77 // Free Software Foundation; either version 2, or (at your option)
80 // This library is distributed in the hope that it will be useful,
81 // but WITHOUT ANY WARRANTY; without even the implied warranty of
82 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83 // GNU General Public License for more details.
85 // You should have received a copy of the GNU General Public License along
86 // with this library; see the file COPYING. If not, write to the Free
87 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
90 // As a special exception, you may use this file as part of a free software
91 // library without restriction. Specifically, if other files instantiate
92 // templates or use macros or inline functions from this file, or you compile
93 // this file and link it with other files to produce an executable, this
94 // file does not by itself cause the resulting executable to be covered by
95 // the GNU General Public License. This exception does not however
96 // invalidate any other reasons why the executable file might be covered by
97 // the GNU General Public License.
99 // Note: this is not a conforming implementation.
100 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
103 // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
111 #ifndef _CPP_NUMERIC_LIMITS
112 #define _CPP_NUMERIC_LIMITS 1
114 #include <bits/c++config.h>
115 #include <bits/std_cfloat.h>
119 enum float_round_style {
120 round_indeterminate = -1,
121 round_toward_zero = 0,
122 round_to_nearest = 1,
123 round_toward_infinity = 2,
124 round_toward_neg_infinity = 3
127 enum float_denorm_style {
128 denorm_indeterminate = -1,
133 template<typename _Tp> struct numeric_limits {
134 static const bool is_specialized = false;
136 static _Tp min() throw() { return static_cast<_Tp>(0); }
137 static _Tp max() throw() { return static_cast<_Tp>(0); }
139 static const int digits = 0;
140 static const int digits10 = 0;
141 static const bool is_signed = false;
142 static const bool is_integer = false;
143 static const bool is_exact = false;
144 static const int radix = 0;
146 static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
147 static _Tp round_error() throw() { return static_cast<_Tp>(0); }
149 static const int min_exponent = 0;
150 static const int min_exponent10 = 0;
151 static const int max_exponent = 0;
152 static const int max_exponent10 = 0;
154 static const bool has_infinity = false;
155 static const bool has_quiet_NaN = false;
156 static const bool has_signaling_NaN = false;
157 static const float_denorm_style has_denorm = denorm_absent;
158 static const bool has_denorm_loss = false;
160 static _Tp infinity() throw() { return static_cast<_Tp>(0); }
161 static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
162 static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
163 static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
165 static const bool is_iec559 = false;
166 static const bool is_bounded = false;
167 static const bool is_modulo = false;
169 static const bool traps = false;
170 static const bool tinyness_before = false;
171 static const float_round_style round_style = round_toward_zero;
174 template<typename _Tp> _Tp __limits_infinity();
175 template<typename _Tp> _Tp __limits_quiet_NaN();
176 template<typename _Tp> _Tp __limits_signaling_NaN();
177 template<typename _Tp> _Tp __limits_denorm_min();
181 echo "$CXX -I. $CPPFLAGS -I$BUILD_DIR/include -DHAVE_CONFIG_H \
182 -o "$BUILD_DIR/src
/gen-num-limits
" "$SRC_DIR/src
/gen-num-limits.cc
" \
185 { $CXX -I.
$CPPFLAGS -I$BUILD_DIR/include
-DHAVE_CONFIG_H \
186 -o "$BUILD_DIR/src/gen-num-limits" "$SRC_DIR/src/gen-num-limits.cc" \
189 echo "gen-num-limits failed to build, exiting."
193 "$BUILD_DIR/src/gen-num-limits" >> $OUT_H-t
195 cat <<EOF >> $OUT_H-t
198 #endif // _CPP_NUMERIC_LIMITS
201 trait_name
=numeric_limits
204 // Static data members of -*- C++ -*- numeric_limits classes
206 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
208 // This file is part of the GNU ISO C++ Library. This library is free
209 // software; you can redistribute it and/or modify it under the
210 // terms of the GNU General Public License as published by the
211 // Free Software Foundation; either version 2, or (at your option)
212 // any later version.
214 // This library is distributed in the hope that it will be useful,
215 // but WITHOUT ANY WARRANTY; without even the implied warranty of
216 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
217 // GNU General Public License for more details.
219 // You should have received a copy of the GNU General Public License along
220 // with this library; see the file COPYING. If not, write to the Free
221 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
224 // As a special exception, you may use this file as part of a free software
225 // library without restriction. Specifically, if other files instantiate
226 // templates or use macros or inline functions from this file, or you compile
227 // this file and link it with other files to produce an executable, this
228 // file does not by itself cause the resulting executable to be covered by
229 // the GNU General Public License. This exception does not however
230 // invalidate any other reasons why the executable file might be covered by
231 // the GNU General Public License.
233 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
236 // ISO C++ 14882:1998
240 #include <bits/std_limits.h>
244 for type_name
in bool char
'signed char' 'unsigned char' \
245 short
'unsigned short' int
'unsigned int' \
246 long
'unsigned long' 'long long' 'unsigned long long' \
247 float double
'long double'
249 grep "<$type_name>" $OUT_H-t >/dev
/null
2>&1 ||
continue
250 cat <<EOF >> $OUT_C-t
252 const bool $trait_name<$type_name>::is_specialized;
253 const int $trait_name<$type_name>::digits;
254 const int $trait_name<$type_name>::digits10;
255 const bool $trait_name<$type_name>::is_signed;
256 const bool $trait_name<$type_name>::is_integer;
257 const bool $trait_name<$type_name>::is_exact;
258 const int $trait_name<$type_name>::radix;
259 const int $trait_name<$type_name>::min_exponent;
260 const int $trait_name<$type_name>::min_exponent10;
261 const int $trait_name<$type_name>::max_exponent;
262 const int $trait_name<$type_name>::max_exponent10;
263 const bool $trait_name<$type_name>::has_infinity;
264 const bool $trait_name<$type_name>::has_quiet_NaN;
265 const bool $trait_name<$type_name>::has_signaling_NaN;
266 const float_denorm_style $trait_name<$type_name>::has_denorm;
267 const bool $trait_name<$type_name>::has_denorm_loss;
268 const bool $trait_name<$type_name>::is_iec559;
269 const bool $trait_name<$type_name>::is_bounded;
270 const bool $trait_name<$type_name>::is_modulo;
271 const bool $trait_name<$type_name>::traps;
272 const bool $trait_name<$type_name>::tinyness_before;
273 const float_round_style $trait_name<$type_name>::round_style;
278 cat <<EOF >> $OUT_C-t