gcc/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc

62 lines
1.8 KiB
C++
Raw Normal View History

denorm_min.cc: Use dg-add-options ieee. * testsuite/18_support/numeric_limits/denorm_min.cc: Use dg-add-options ieee. * testsuite/18_support/numeric_limits/digits10.cc: Likewise. * testsuite/18_support/numeric_limits/epsilon.cc: Likewise. * testsuite/18_support/numeric_limits/infinity.cc: Likewise. * testsuite/18_support/numeric_limits/is_iec559.cc: Likewise. * testsuite/18_support/numeric_limits/is_signed.cc: Likewise. * testsuite/18_support/numeric_limits/min_max.cc: Likewise. * testsuite/18_support/numeric_limits/quiet_NaN.cc: Likewise. * testsuite/18_support/numeric_limits/ specialization_default_values.cc: Likewise. * testsuite/18_support/numeric_limits/traps.cc: Likewise. * testsuite/26_numerics/complex/pow.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 01_assoc_laguerre/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 02_assoc_legendre/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 03_beta/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 04_comp_ellint_1/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 05_comp_ellint_2/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 06_comp_ellint_3/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 07_conf_hyperg/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 08_cyl_bessel_i/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 09_cyl_bessel_j/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 10_cyl_bessel_k/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 11_cyl_neumann/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 12_ellint_1/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 13_ellint_2/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 14_ellint_3/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 15_expint/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 16_hermite/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 17_hyperg/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 18_laguerre/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 19_legendre/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 20_riemann_zeta/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 21_sph_bessel/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 22_sph_legendre/check_nan.cc: Likewise. * testsuite/tr1/5_numerical_facilities/special_functions/ 23_sph_neumann/check_nan.cc: Likewise. Co-Authored-By: Kaz Kojima <kkojima@gcc.gnu.org> From-SVN: r151251
2009-09-01 00:29:47 +02:00
// { dg-add-options ieee }
// Copyright (C) 2005, 2009 Free Software Foundation
//
// 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 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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 COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 18.2.1.1 template class numeric_limits
#include <limits>
#include <testsuite_hooks.h>
template<typename T>
void
[multiple changes] 2005-12-28 Paolo Carlini <pcarlini@suse.de> * include/std/std_bitset.h (bitset<>::_M_copy_from_string, bitset<>::_M_copy_to_string, bitset<>::operator>>): Reverse loop. * testsuite/25_algorithms/heap/heap.cc (test01): Always enable complexity checks. * testsuite/18_support/numeric_limits/specialization.cc: Avoid unused parameter warning. * testsuite/18_support/numeric_limits/traps.cc: Acoid unused variable warning. * testsuite/ext/malloc_allocator/deallocate_global.cc: Fix format string. * testsuite/ext/malloc_allocator/deallocate_local.cc: Likewise. * testsuite/ext/array_allocator/2.cc: Remove unused variable. * testsuite/tr1/3_function_objects/mem_fn.cc: Avoid unused variable warnings. * testsuite/tr1/6_containers/unordered/instantiate/set.cc: Just instantiate. * testsuite/tr1/6_containers/unordered/instantiate/map.cc: Likewise. * testsuite/tr1/6_containers/unordered/instantiate/hash.cc: Likewise. * testsuite/tr1/6_containers/unordered/instantiate/multiset.cc: Likewise. * testsuite/tr1/6_containers/unordered/instantiate/multimap.cc: Likewise. * testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc: Avoid unused variable warnings. * testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc: Likewise. * testsuite/thread/18185.cc: Likewise. * testsuite/27_io/ios_base/storage/11584.cc: Likewise; avoid comparison between signed and unsigned warning. * testsuite/27_io/types/1.cc: Avoid unused variable warnings. * testsuite/testsuite_allocator.h (check_new): Likewise. (check_deallocate_null): Adjust return type. * testsuite/testsuite_hooks.h (bitmask_operators): Avoid unused variable warnings. * testsuite/21_strings/c_strings/wchar_t/24559.cc: Avoid unused variable warning. 2005-12-28 Chris Jefferson <chris@bubblescope.net> * include/std/std_bitset.h (bitset<0>::set, bitset<0>::reset, bitset<0>::flip, bitset<0>::test): Add inline specializations for bitset<0>. * testsuite/tr1/6_containers/unordered/insert/multiset_range.cc (test01): Add static cast. * testsuite/tr1/6_containers/unordered/insert/set_range.cc (test01): Likewise. * testsuite/testsuite_hooks.h (operator==(NonDefaultConstructible, NonDefaultConstructible), operator<(NonDefaultConstructible, NonDefaultConstrictible)): Avoid unused parameter warning. From-SVN: r109103
2005-12-28 10:57:57 +01:00
test_traps(T r = T(0))
{
typedef T value_type;
volatile value_type i(5);
volatile value_type j(0);
if (!std::numeric_limits<value_type>::traps)
[multiple changes] 2005-12-28 Paolo Carlini <pcarlini@suse.de> * include/std/std_bitset.h (bitset<>::_M_copy_from_string, bitset<>::_M_copy_to_string, bitset<>::operator>>): Reverse loop. * testsuite/25_algorithms/heap/heap.cc (test01): Always enable complexity checks. * testsuite/18_support/numeric_limits/specialization.cc: Avoid unused parameter warning. * testsuite/18_support/numeric_limits/traps.cc: Acoid unused variable warning. * testsuite/ext/malloc_allocator/deallocate_global.cc: Fix format string. * testsuite/ext/malloc_allocator/deallocate_local.cc: Likewise. * testsuite/ext/array_allocator/2.cc: Remove unused variable. * testsuite/tr1/3_function_objects/mem_fn.cc: Avoid unused variable warnings. * testsuite/tr1/6_containers/unordered/instantiate/set.cc: Just instantiate. * testsuite/tr1/6_containers/unordered/instantiate/map.cc: Likewise. * testsuite/tr1/6_containers/unordered/instantiate/hash.cc: Likewise. * testsuite/tr1/6_containers/unordered/instantiate/multiset.cc: Likewise. * testsuite/tr1/6_containers/unordered/instantiate/multimap.cc: Likewise. * testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc: Avoid unused variable warnings. * testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc: Likewise. * testsuite/thread/18185.cc: Likewise. * testsuite/27_io/ios_base/storage/11584.cc: Likewise; avoid comparison between signed and unsigned warning. * testsuite/27_io/types/1.cc: Avoid unused variable warnings. * testsuite/testsuite_allocator.h (check_new): Likewise. (check_deallocate_null): Adjust return type. * testsuite/testsuite_hooks.h (bitmask_operators): Avoid unused variable warnings. * testsuite/21_strings/c_strings/wchar_t/24559.cc: Avoid unused variable warning. 2005-12-28 Chris Jefferson <chris@bubblescope.net> * include/std/std_bitset.h (bitset<0>::set, bitset<0>::reset, bitset<0>::flip, bitset<0>::test): Add inline specializations for bitset<0>. * testsuite/tr1/6_containers/unordered/insert/multiset_range.cc (test01): Add static cast. * testsuite/tr1/6_containers/unordered/insert/set_range.cc (test01): Likewise. * testsuite/testsuite_hooks.h (operator==(NonDefaultConstructible, NonDefaultConstructible), operator<(NonDefaultConstructible, NonDefaultConstrictible)): Avoid unused parameter warning. From-SVN: r109103
2005-12-28 10:57:57 +01:00
r = i / j;
}
// libstdc++/22203
int main()
{
test_traps<int>();
test_traps<unsigned int>();
test_traps<long>();
test_traps<unsigned long>();
test_traps<long long>();
test_traps<unsigned long long>();
/*
For floating points, trapping is a different, more complicated
story. If is_iecxxx is true, then division by zero would not trap
(infinity). If is_iecxxx is false, we don't know (VAX may trap for
0/0 -- I have to check). For most cases (i.e. IEE-754), trapping
for floating points have to do with whether there is a support for
signaling NaN.
- Gaby.
*/
// test_traps<float>();
// test_traps<double>();
// test_traps<long double>();
return 0;
}