Extend valid values of iostream bitmask types
authorJonathan Wakely <jwakely@redhat.com>
Thu, 12 Nov 2015 17:08:42 +0000 (17:08 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 12 Nov 2015 17:08:42 +0000 (17:08 +0000)
PR libstdc++/56158
* include/bits/ios_base.h (_Ios_Fmtflags, _Ios_Openmode, _Ios_Iostate):
Define enumerators to ensure all values of type int are valid values
of the enumeration type.
* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Add new cases.
* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.

From-SVN: r230267

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/ios_base.h
libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc

index 2222b572d03b38a135b628a731b5ea959dfa0a5e..e1cc38ff1ef650abd922294dc90c89873f7d2a5e 100644 (file)
@@ -1,5 +1,13 @@
 2015-11-12  Jonathan Wakely  <jwakely@redhat.com>
 
+       PR libstdc++/56158
+       * include/bits/ios_base.h (_Ios_Fmtflags, _Ios_Openmode, _Ios_Iostate):
+       Define enumerators to ensure all values of type int are valid values
+       of the enumeration type.
+       * testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Add new cases.
+       * testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
+       * testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
+
        * include/std/thread: Include <cerrno> for EINTR.
 
 2015-11-12  Ville Voutilainen  <ville.voutilainen@gmail.com>
index 44029ad2ce632fba12b4d9d9a2445e0be8d1ce6a..908ba7c7e4ee547ddc2338f1eb4f474d9334eece 100644 (file)
@@ -74,7 +74,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _S_adjustfield   = _S_left | _S_right | _S_internal,
       _S_basefield     = _S_dec | _S_oct | _S_hex,
       _S_floatfield    = _S_scientific | _S_fixed,
-      _S_ios_fmtflags_end = 1L << 16 
+      _S_ios_fmtflags_end = 1L << 16,
+      _S_ios_fmtflags_max = __INT_MAX__,
+      _S_ios_fmtflags_min = ~__INT_MAX__
     };
 
   inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
@@ -114,7 +116,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _S_in            = 1L << 3,
       _S_out           = 1L << 4,
       _S_trunc                 = 1L << 5,
-      _S_ios_openmode_end = 1L << 16 
+      _S_ios_openmode_end = 1L << 16,
+      _S_ios_openmode_max = __INT_MAX__,
+      _S_ios_openmode_min = ~__INT_MAX__
     };
 
   inline _GLIBCXX_CONSTEXPR _Ios_Openmode
@@ -152,7 +156,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _S_badbit                = 1L << 0,
       _S_eofbit                = 1L << 1,
       _S_failbit               = 1L << 2,
-      _S_ios_iostate_end = 1L << 16 
+      _S_ios_iostate_end = 1L << 16,
+      _S_ios_iostate_max = __INT_MAX__,
+      _S_ios_iostate_min = ~__INT_MAX__
     };
 
   inline _GLIBCXX_CONSTEXPR _Ios_Iostate
index 591e3714366479b47c0c445d1cb91145010f6001..e8820c5e84a9cf00795cc56e328f0248669cc307 100644 (file)
@@ -70,5 +70,9 @@ case_labels(bitmask_type b)
       break;
     case std::_S_ios_fmtflags_end:
       break;
+    case std::_S_ios_fmtflags_min:
+      break;
+    case std::_S_ios_fmtflags_max:
+      break;
     }
 }
index 44fb44e7a8a3158194ed9d845dd9b23fc1698b04..4e4e4f5e6234e4697d06ddb0e9984d22d109fbcf 100644 (file)
@@ -42,5 +42,9 @@ case_labels(bitmask_type b)
       break;
     case std::_S_ios_iostate_end:
       break;
+    case std::_S_ios_iostate_min:
+      break;
+    case std::_S_ios_iostate_max:
+      break;
     }
 }
index 267f8a228b41d944270e27b03b564c1e93a8e333..8c6672f65cec332f007444de9ee6337af5d99431 100644 (file)
@@ -46,5 +46,9 @@ case_labels(bitmask_type b)
       break;
     case std::_S_ios_openmode_end:
       break;
+    case std::_S_ios_openmode_min:
+      break;
+    case std::_S_ios_openmode_max:
+      break;
     }
 }