This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[libstdc++] numeric_limits.cc check the wchar_t limits facility


In order to avoid that another wchar_t limits related problem falls
through the cracks of the test suite I suggest applying the appended
patch to numeric_limits.cc. 

I have no idea how to check for the signedness of wchar_t since two
targets define it as unsigned (hpux, aix) in contrast to all others
and I see no way of getting access to this information in a
painless way.

Hope this helps,

Peter Schmid

2001-09-20  Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>

	* libstdc++-v3/testsuite/18_support/numeric_limits.cc: Check
          wchar_t too if available


*** libstdc++-v3/testsuite/18_support/numeric_limits.cc.orig	Fri Oct 26 18:54:39 2001
--- libstdc++-v3/testsuite/18_support/numeric_limits.cc	Fri Oct 26 19:02:13 2001
***************
*** 23,28 ****
--- 23,29 ----
  #include <limits>
  #include <limits.h>
  #include <float.h>
+ #include <cwchar>
  #include <testsuite_hooks.h>
  
  template<typename T>
*************** DEFINE_EXTREMA(float, FLT_MIN, FLT_MAX);
*** 50,55 ****
--- 51,60 ----
  DEFINE_EXTREMA(double, DBL_MIN, DBL_MAX);
  DEFINE_EXTREMA(long double, LDBL_MIN, LDBL_MAX);
  
+ #if defined(_GLIBCPP_USE_WCHAR_T) && defined(WCHAR_MAX) && defined(WCHAR_MIN)
+ DEFINE_EXTREMA(wchar_t, WCHAR_MIN, WCHAR_MAX);
+ #endif
+ 
  #undef DEFINE_EXTREMA
  
  template<typename T>
*************** void test02()
*** 148,153 ****
--- 153,165 ----
    const int* pi2 = &b_nl_type::digits10;
    const int* pi3 = &b_nl_type::max_exponent10;
    const bool* pb1 = &b_nl_type::traps;
+ 
+   // Squelch compiler warnings
+   (void) &pi1; 
+   (void) &pi2;
+   (void) &pi3;
+   (void) &pb1;
+   
  }
  
  int main()
*************** int main()
*** 157,164 ****
  
    test_extrema<char>();
    test_extrema<signed char>();
!   test_extrema<unsigned char>();
!   
    test_extrema<short>();
    test_extrema<unsigned short>();
  
--- 169,176 ----
  
    test_extrema<char>();
    test_extrema<signed char>();
!   test_extrema<unsigned char>();  
! 
    test_extrema<short>();
    test_extrema<unsigned short>();
  
*************** int main()
*** 172,178 ****
    test_extrema<double>();
    test_extrema<long double>();
  
    test_sign();
  
!     return 0;
  }
--- 184,194 ----
    test_extrema<double>();
    test_extrema<long double>();
  
+ #if defined(_GLIBCPP_USE_WCHAR_T) && defined(WCHAR_MAX) && defined(WCHAR_MIN)
+   test_extrema<wchar_t>();
+ #endif
+ 
    test_sign();
  
!   return 0;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]