diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7c903fa40b95..226e2efd2caa 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2000-04-30 Benjamin Kosnik + + * mknumeric_limits (trait_name): Fix copyright notice. + * src/gen-num-limits.cc: Explicitly instantiate epsilon and + round_error data members of struct value. This works around + weak-linking issues on AIX, HPUX. + 2000-04-29 Phil Edwards * docs/download.html: Add link to list of mirror sites. diff --git a/libstdc++-v3/mknumeric_limits b/libstdc++-v3/mknumeric_limits index 89e7a611130d..3f5221152b1e 100755 --- a/libstdc++-v3/mknumeric_limits +++ b/libstdc++-v3/mknumeric_limits @@ -189,7 +189,7 @@ trait_name=numeric_limits cat < $OUT_C // Static data members of -*- C++ -*- numeric_limits classes -// Copyright (C) 1999 Cygnus Solutions +// Copyright (C) 1999, 2000 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 diff --git a/libstdc++-v3/src/gen-num-limits.cc b/libstdc++-v3/src/gen-num-limits.cc index 8dd3a16e2488..f9ecbacf09d3 100644 --- a/libstdc++-v3/src/gen-num-limits.cc +++ b/libstdc++-v3/src/gen-num-limits.cc @@ -342,7 +342,7 @@ template const int value::digits = bits_per_byte * sizeof(T) - int(predicate::is_signed); -// Non integer types should specialize this. Alwyas two for +// Non integer types should specialize this. Always two for // integer types. template const int value::radix = 2; @@ -366,16 +366,38 @@ SPECIALIZE_RADIX(long double, FLT_RADIX); #undef SPECIALIZE_RADIX +// Non integer types should specialize this. +// Unfortunately, systems that don't deal with weak linking correctly +// (Ie, hpux and aix), cannot use this sophisticated yet sane method. So, +// explicitly instantiate all the data members here so that they will +// be happy. +// sophisticated, sane method +#if 0 template const char value::epsilon[] = "0"; - -template -const char value::round_error[] = "0"; +#endif #define SPECIALIZE_EPSILON(T, E) DO_SPECIALIZE_EPSILON(T, E) #define DO_SPECIALIZE_EPSILON(T, E) const char value< T >::epsilon[] = #E +// unsophisticated, gross method +#if 1 +SPECIALIZE_EPSILON(bool, 0); +SPECIALIZE_EPSILON(char, 0); +SPECIALIZE_EPSILON(unsigned char, 0); +SPECIALIZE_EPSILON(signed char, 0); +SPECIALIZE_EPSILON(wchar_t, 0); +SPECIALIZE_EPSILON(short, 0); +SPECIALIZE_EPSILON(unsigned short, 0); +SPECIALIZE_EPSILON(int, 0); +SPECIALIZE_EPSILON(unsigned int, 0); +SPECIALIZE_EPSILON(long, 0); +SPECIALIZE_EPSILON(unsigned long, 0); +SPECIALIZE_EPSILON(long long, 0); +SPECIALIZE_EPSILON(unsigned long long, 0); +#endif + SPECIALIZE_EPSILON(float, FLT_EPSILON); SPECIALIZE_EPSILON(double, DBL_EPSILON); SPECIALIZE_EPSILON(long double, LDBL_EPSILON); @@ -384,7 +406,35 @@ SPECIALIZE_EPSILON(long double, LDBL_EPSILON); #undef SPECIALIZE_EPSILON +// Non integer types should specialize this. +// Unfortunately, systems that don't deal with weak linking correctly +// (Ie, hpux and aix), cannot use this sophisticated yet sane method. So, +// explicitly instantiate all the data members here so that they will +// be happy. + +// sophisticated, sane method +#if 0 +template +const char value::round_error[] = "0"; +#endif + #define SPECIALIZE_ROUND_ERROR(T, R) const char value< T >::round_error[] = #R +// unsophisticated, gross method +#if 1 +SPECIALIZE_ROUND_ERROR(bool, 0); +SPECIALIZE_ROUND_ERROR(char, 0); +SPECIALIZE_ROUND_ERROR(unsigned char, 0); +SPECIALIZE_ROUND_ERROR(signed char, 0); +SPECIALIZE_ROUND_ERROR(wchar_t, 0); +SPECIALIZE_ROUND_ERROR(short, 0); +SPECIALIZE_ROUND_ERROR(unsigned short, 0); +SPECIALIZE_ROUND_ERROR(int, 0); +SPECIALIZE_ROUND_ERROR(unsigned int, 0); +SPECIALIZE_ROUND_ERROR(long, 0); +SPECIALIZE_ROUND_ERROR(unsigned long, 0); +SPECIALIZE_ROUND_ERROR(long long, 0); +SPECIALIZE_ROUND_ERROR(unsigned long long, 0); +#endif SPECIALIZE_ROUND_ERROR(float, 1.0f); SPECIALIZE_ROUND_ERROR(double, 1.0);