OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / limits.cc
index b0172b8..9c953c9 100644 (file)
@@ -1,11 +1,12 @@
 // Static data members of -*- C++ -*- numeric_limits classes
 
-// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2001, 2002, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 // terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
+// Free Software Foundation; either version 3, or (at your option)
 // any later version.
 
 // This library is distributed in the hope that it will be useful,
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
 
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
 
 // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
 
 
 #include <limits>
 
-namespace std 
-{
-  const __float_storage __glibcpp_float_infinity =
-    __glibcpp_float_infinity_bytes;
-  const __float_storage __glibcpp_float_QNaN = __glibcpp_float_QNaN_bytes;
-  const __float_storage __glibcpp_float_SNaN = __glibcpp_float_SNaN_bytes;
-  const __float_storage __glibcpp_float_denorm_min =
-    __glibcpp_float_denorm_min_bytes;
-
-  const __double_storage __glibcpp_double_infinity =
-    __glibcpp_double_infinity_bytes;
-  const __double_storage __glibcpp_double_QNaN = __glibcpp_double_QNaN_bytes;
-  const __double_storage __glibcpp_double_SNaN = __glibcpp_double_SNaN_bytes;
-  const __double_storage __glibcpp_double_denorm_min =
-    __glibcpp_double_denorm_min_bytes;
-
-  const __long_double_storage __glibcpp_long_double_infinity =
-    __glibcpp_long_double_infinity_bytes;
-  const __long_double_storage __glibcpp_long_double_QNaN =
-    __glibcpp_long_double_QNaN_bytes;
-  const __long_double_storage __glibcpp_long_double_SNaN =
-    __glibcpp_long_double_SNaN_bytes;
-  const __long_double_storage __glibcpp_long_double_denorm_min =
-    __glibcpp_long_double_denorm_min_bytes;
+_GLIBCXX_BEGIN_NAMESPACE(std)
 
   const bool __numeric_limits_base::is_specialized;
   const int  __numeric_limits_base::digits;
   const int  __numeric_limits_base::digits10;
+  const int  __numeric_limits_base::max_digits10;
   const bool __numeric_limits_base::is_signed;
   const bool __numeric_limits_base::is_integer;
   const bool __numeric_limits_base::is_exact;
@@ -88,6 +62,7 @@ namespace std
   const bool numeric_limits<bool>::is_specialized;
   const int  numeric_limits<bool>::digits;
   const int  numeric_limits<bool>::digits10;
+  const int  numeric_limits<bool>::max_digits10;
   const bool numeric_limits<bool>::is_signed;
   const bool numeric_limits<bool>::is_integer;
   const bool numeric_limits<bool>::is_exact;
@@ -112,6 +87,7 @@ namespace std
   const bool numeric_limits<char>::is_specialized;
   const int  numeric_limits<char>::digits;
   const int  numeric_limits<char>::digits10;
+  const int  numeric_limits<char>::max_digits10;
   const bool numeric_limits<char>::is_signed;
   const bool numeric_limits<char>::is_integer;
   const bool numeric_limits<char>::is_exact;
@@ -136,6 +112,7 @@ namespace std
   const bool numeric_limits<signed char>::is_specialized;
   const int  numeric_limits<signed char>::digits;
   const int  numeric_limits<signed char>::digits10;
+  const int  numeric_limits<signed char>::max_digits10;
   const bool numeric_limits<signed char>::is_signed;
   const bool numeric_limits<signed char>::is_integer;
   const bool numeric_limits<signed char>::is_exact;
@@ -160,6 +137,7 @@ namespace std
   const bool numeric_limits<unsigned char>::is_specialized;
   const int  numeric_limits<unsigned char>::digits;
   const int  numeric_limits<unsigned char>::digits10;
+  const int  numeric_limits<unsigned char>::max_digits10;
   const bool numeric_limits<unsigned char>::is_signed;
   const bool numeric_limits<unsigned char>::is_integer;
   const bool numeric_limits<unsigned char>::is_exact;
@@ -182,10 +160,11 @@ namespace std
 
   // wchar_t
   // This used to be problematic...
-#ifdef _GLIBCPP_USE_WCHAR_T  
+#ifdef _GLIBCXX_USE_WCHAR_T  
   const bool numeric_limits<wchar_t>::is_specialized;
   const int  numeric_limits<wchar_t>::digits;
   const int  numeric_limits<wchar_t>::digits10;
+  const int  numeric_limits<wchar_t>::max_digits10;
   const bool numeric_limits<wchar_t>::is_signed;
   const bool numeric_limits<wchar_t>::is_integer;
   const bool numeric_limits<wchar_t>::is_exact;
@@ -205,12 +184,13 @@ namespace std
   const bool numeric_limits<wchar_t>::traps;
   const bool numeric_limits<wchar_t>::tinyness_before;
   const float_round_style numeric_limits<wchar_t>::round_style;
-#endif // _GLIBCPP_USE_WCHAR_T
+#endif // _GLIBCXX_USE_WCHAR_T
 
   // short
   const bool numeric_limits<short>::is_specialized;
   const int  numeric_limits<short>::digits;
   const int  numeric_limits<short>::digits10;
+  const int  numeric_limits<short>::max_digits10;
   const bool numeric_limits<short>::is_signed;
   const bool numeric_limits<short>::is_integer;
   const bool numeric_limits<short>::is_exact;
@@ -235,6 +215,7 @@ namespace std
   const bool numeric_limits<unsigned short>::is_specialized;
   const int  numeric_limits<unsigned short>::digits;
   const int  numeric_limits<unsigned short>::digits10;
+  const int  numeric_limits<unsigned short>::max_digits10;
   const bool numeric_limits<unsigned short>::is_signed;
   const bool numeric_limits<unsigned short>::is_integer;
   const bool numeric_limits<unsigned short>::is_exact;
@@ -259,6 +240,7 @@ namespace std
   const bool numeric_limits<int>::is_specialized;
   const int  numeric_limits<int>::digits;
   const int  numeric_limits<int>::digits10;
+  const int  numeric_limits<int>::max_digits10;
   const bool numeric_limits<int>::is_signed;
   const bool numeric_limits<int>::is_integer;
   const bool numeric_limits<int>::is_exact;
@@ -283,6 +265,7 @@ namespace std
   const bool numeric_limits<unsigned int>::is_specialized;
   const int  numeric_limits<unsigned int>::digits;
   const int  numeric_limits<unsigned int>::digits10;
+  const int  numeric_limits<unsigned int>::max_digits10;
   const bool numeric_limits<unsigned int>::is_signed;
   const bool numeric_limits<unsigned int>::is_integer;
   const bool numeric_limits<unsigned int>::is_exact;
@@ -307,6 +290,7 @@ namespace std
   const bool numeric_limits<long>::is_specialized;
   const int  numeric_limits<long>::digits;
   const int  numeric_limits<long>::digits10;
+  const int  numeric_limits<long>::max_digits10;
   const bool numeric_limits<long>::is_signed;
   const bool numeric_limits<long>::is_integer;
   const bool numeric_limits<long>::is_exact;
@@ -331,6 +315,7 @@ namespace std
   const bool numeric_limits<unsigned long>::is_specialized;
   const int  numeric_limits<unsigned long>::digits;
   const int  numeric_limits<unsigned long>::digits10;
+  const int  numeric_limits<unsigned long>::max_digits10;
   const bool numeric_limits<unsigned long>::is_signed;
   const bool numeric_limits<unsigned long>::is_integer;
   const bool numeric_limits<unsigned long>::is_exact;
@@ -355,6 +340,7 @@ namespace std
   const bool numeric_limits<long long>::is_specialized;
   const int  numeric_limits<long long>::digits;
   const int  numeric_limits<long long>::digits10;
+  const int  numeric_limits<long long>::max_digits10;
   const bool numeric_limits<long long>::is_signed;
   const bool numeric_limits<long long>::is_integer;
   const bool numeric_limits<long long>::is_exact;
@@ -378,6 +364,7 @@ namespace std
   const bool numeric_limits<unsigned long long>::is_specialized;
   const int  numeric_limits<unsigned long long>::digits;
   const int  numeric_limits<unsigned long long>::digits10;
+  const int  numeric_limits<unsigned long long>::max_digits10;
   const bool numeric_limits<unsigned long long>::is_signed;
   const bool numeric_limits<unsigned long long>::is_integer;
   const bool numeric_limits<unsigned long long>::is_exact;
@@ -402,6 +389,7 @@ namespace std
   const bool numeric_limits<float>::is_specialized;
   const int  numeric_limits<float>::digits;
   const int  numeric_limits<float>::digits10;
+  const int  numeric_limits<float>::max_digits10;
   const bool numeric_limits<float>::is_signed;
   const bool numeric_limits<float>::is_integer;
   const bool numeric_limits<float>::is_exact;
@@ -426,6 +414,7 @@ namespace std
   const bool numeric_limits<double>::is_specialized;
   const int  numeric_limits<double>::digits;
   const int  numeric_limits<double>::digits10;
+  const int  numeric_limits<double>::max_digits10;
   const bool numeric_limits<double>::is_signed;
   const bool numeric_limits<double>::is_integer;
   const bool numeric_limits<double>::is_exact;
@@ -450,6 +439,7 @@ namespace std
   const bool numeric_limits<long double>::is_specialized;
   const int  numeric_limits<long double>::digits;
   const int  numeric_limits<long double>::digits10;
+  const int  numeric_limits<long double>::max_digits10;
   const bool numeric_limits<long double>::is_signed;
   const bool numeric_limits<long double>::is_integer;
   const bool numeric_limits<long double>::is_exact;
@@ -469,4 +459,86 @@ namespace std
   const bool numeric_limits<long double>::traps;
   const bool numeric_limits<long double>::tinyness_before;
   const float_round_style numeric_limits<long double>::round_style;
-} // namespace std
+
+  // char16_t
+  const bool numeric_limits<char16_t>::is_specialized;
+  const int  numeric_limits<char16_t>::digits;
+  const int  numeric_limits<char16_t>::digits10;
+  const int  numeric_limits<char16_t>::max_digits10;
+  const bool numeric_limits<char16_t>::is_signed;
+  const bool numeric_limits<char16_t>::is_integer;
+  const bool numeric_limits<char16_t>::is_exact;
+  const int  numeric_limits<char16_t>::radix;
+  const int  numeric_limits<char16_t>::min_exponent;
+  const int  numeric_limits<char16_t>::min_exponent10;
+  const int  numeric_limits<char16_t>::max_exponent;
+  const int  numeric_limits<char16_t>::max_exponent10;
+  const bool numeric_limits<char16_t>::has_infinity;
+  const bool numeric_limits<char16_t>::has_quiet_NaN;
+  const bool numeric_limits<char16_t>::has_signaling_NaN;
+  const float_denorm_style numeric_limits<char16_t>::has_denorm;
+  const bool numeric_limits<char16_t>::has_denorm_loss;
+  const bool numeric_limits<char16_t>::is_iec559;
+  const bool numeric_limits<char16_t>::is_bounded;
+  const bool numeric_limits<char16_t>::is_modulo;
+  const bool numeric_limits<char16_t>::traps;
+  const bool numeric_limits<char16_t>::tinyness_before;
+  const float_round_style numeric_limits<char16_t>::round_style;
+
+  // char32_t
+  const bool numeric_limits<char32_t>::is_specialized;
+  const int  numeric_limits<char32_t>::digits;
+  const int  numeric_limits<char32_t>::digits10;
+  const int  numeric_limits<char32_t>::max_digits10;
+  const bool numeric_limits<char32_t>::is_signed;
+  const bool numeric_limits<char32_t>::is_integer;
+  const bool numeric_limits<char32_t>::is_exact;
+  const int  numeric_limits<char32_t>::radix;
+  const int  numeric_limits<char32_t>::min_exponent;
+  const int  numeric_limits<char32_t>::min_exponent10;
+  const int  numeric_limits<char32_t>::max_exponent;
+  const int  numeric_limits<char32_t>::max_exponent10;
+  const bool numeric_limits<char32_t>::has_infinity;
+  const bool numeric_limits<char32_t>::has_quiet_NaN;
+  const bool numeric_limits<char32_t>::has_signaling_NaN;
+  const float_denorm_style numeric_limits<char32_t>::has_denorm;
+  const bool numeric_limits<char32_t>::has_denorm_loss;
+  const bool numeric_limits<char32_t>::is_iec559;
+  const bool numeric_limits<char32_t>::is_bounded;
+  const bool numeric_limits<char32_t>::is_modulo;
+  const bool numeric_limits<char32_t>::traps;
+  const bool numeric_limits<char32_t>::tinyness_before;
+  const float_round_style numeric_limits<char32_t>::round_style;
+
+_GLIBCXX_END_NAMESPACE
+
+// XXX GLIBCXX_ABI Deprecated
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+#define _GLIBCXX_NUM_LIM_COMPAT(type, member, len) \
+  extern "C" type _ZNSt14numeric_limitsIeE ## len ## member ## E \
+  __attribute__ ((alias ("_ZNSt14numeric_limitsIdE" #len #member "E")))
+_GLIBCXX_NUM_LIM_COMPAT (bool, is_specialized, 14);
+_GLIBCXX_NUM_LIM_COMPAT (int, digits, 6);
+_GLIBCXX_NUM_LIM_COMPAT (int, digits10, 8);
+_GLIBCXX_NUM_LIM_COMPAT (bool, is_signed, 9);
+_GLIBCXX_NUM_LIM_COMPAT (bool, is_integer, 10);
+_GLIBCXX_NUM_LIM_COMPAT (bool, is_exact, 8);
+_GLIBCXX_NUM_LIM_COMPAT (int, radix, 5);
+_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent, 12);
+_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent10, 14);
+_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent, 12);
+_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent10, 14);
+_GLIBCXX_NUM_LIM_COMPAT (bool, has_infinity, 12);
+_GLIBCXX_NUM_LIM_COMPAT (bool, has_quiet_NaN, 13);
+_GLIBCXX_NUM_LIM_COMPAT (bool, has_signaling_NaN, 17);
+_GLIBCXX_NUM_LIM_COMPAT (std::float_denorm_style, has_denorm, 10);
+_GLIBCXX_NUM_LIM_COMPAT (bool, has_denorm_loss, 15);
+_GLIBCXX_NUM_LIM_COMPAT (bool, is_iec559, 9);
+_GLIBCXX_NUM_LIM_COMPAT (bool, is_bounded, 10);
+_GLIBCXX_NUM_LIM_COMPAT (bool, is_modulo, 9);
+_GLIBCXX_NUM_LIM_COMPAT (bool, traps, 5);
+_GLIBCXX_NUM_LIM_COMPAT (bool, tinyness_before, 15);
+_GLIBCXX_NUM_LIM_COMPAT (std::float_round_style, round_style, 11);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT