From: Jonathan Wakely Date: Wed, 25 Nov 2015 13:49:06 +0000 (+0000) Subject: Improve tests for valid values of iostream bitmask types X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=75837d7b135b23fa6d8a5cb349501914be8e34bc;p=gcc.git 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2236cfb86c0..58a196f174c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2015-11-25 Jonathan Wakely + + * 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 * acinclude.m4 (GLIBCXX_ENABLE_VTABLE_VERIFY) : 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 e8820c5e84a..3475fd333a4 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) == 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 4e4e4f5e623..a72a7748ce2 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) == 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 8c6672f65ce..f621d213a2a 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) == sizeof(int), + "underlying type has same range of values as int"); }