diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2015-11-25 13:49:06 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2015-11-25 13:49:06 +0000 |
commit | 75837d7b135b23fa6d8a5cb349501914be8e34bc (patch) | |
tree | 943e7d861e79466faf4e13a1b55ccac89bd405e2 /libstdc++-v3 | |
parent | 7f085cafa420d8a90b8d1585d54c1c87c589e12e (diff) | |
download | gcc-75837d7b135b23fa6d8a5cb349501914be8e34bc.zip gcc-75837d7b135b23fa6d8a5cb349501914be8e34bc.tar.gz gcc-75837d7b135b23fa6d8a5cb349501914be8e34bc.tar.bz2 |
Improve tests for valid values of iostream bitmask types
* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Explicitly
check minimum and maximum values, and size of underlying type.
* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
From-SVN: r230868
Diffstat (limited to 'libstdc++-v3')
4 files changed, 19 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2236cfb..58a196f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2015-11-25 Jonathan Wakely <jwakely@redhat.com> + + * testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Explicitly + check minimum and maximum values, and size of underlying type. + * testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise. + * testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise. + 2015-11-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * acinclude.m4 (GLIBCXX_ENABLE_VTABLE_VERIFY) <solaris2*>: Use diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc index e8820c5..3475fd3 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc @@ -70,9 +70,11 @@ case_labels(bitmask_type b) break; case std::_S_ios_fmtflags_end: break; - case std::_S_ios_fmtflags_min: + case __INT_MAX__: break; - case std::_S_ios_fmtflags_max: + case ~__INT_MAX__: break; } + static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int), + "underlying type has same range of values as int"); } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc index 4e4e4f5..a72a774 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc @@ -42,9 +42,11 @@ case_labels(bitmask_type b) break; case std::_S_ios_iostate_end: break; - case std::_S_ios_iostate_min: + case __INT_MAX__: break; - case std::_S_ios_iostate_max: + case ~__INT_MAX__: break; } + static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int), + "underlying type has same range of values as int"); } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc index 8c6672f6..f621d21 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc @@ -46,9 +46,11 @@ case_labels(bitmask_type b) break; case std::_S_ios_openmode_end: break; - case std::_S_ios_openmode_min: + case __INT_MAX__: break; - case std::_S_ios_openmode_max: + case ~__INT_MAX__: break; } + static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int), + "underlying type has same range of values as int"); } |