[gcc(refs/users/marxin/heads/pgo-reproducibility-test)] libstdc++: Simplify construction of comparison category types

Martin Liska marxin@gcc.gnu.org
Mon Jan 27 08:40:00 GMT 2020


https://gcc.gnu.org/g:482eeff5f114c7635c1a06edb2deee3e5433c3f3

commit 482eeff5f114c7635c1a06edb2deee3e5433c3f3
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jan 24 17:07:01 2020 +0000

    libstdc++: Simplify construction of comparison category types
    
    The _Eq and _Ord enumerations can be combined into one, reducing the
    number of constructors needed for the comparison category types. The
    redundant equal enumerator can be removed and equivalent used in its
    place. The _Less and _Greater enumerators can be renamed because 'less'
    and 'greater' are already reserved names anyway.
    
    	* libsupc++/compare (__cmp_cat::_Eq): Remove enumeration type.
    	(__cmp_cat::_Ord::equivalent): Add enumerator.
    	(__cmp_cat::_Ord::_Less, __cmp_cat::_Ord::_Greater): Rename to less
    	and greater.
    	(partial_ordering, weak_ordering, strong_ordering): Remove
    	constructors taking __cmp_cat::_Eq parameters. Use renamed
    	enumerators.

Diff:
---
 libstdc++-v3/ChangeLog         | 10 ++++++++++
 libstdc++-v3/libsupc++/compare | 39 +++++++++++----------------------------
 2 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2e96d56..0067e58 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-24  Jonathan Wakely  <jwakely@redhat.com>
+
+	* libsupc++/compare (__cmp_cat::_Eq): Remove enumeration type.
+	(__cmp_cat::_Ord::equivalent): Add enumerator.
+	(__cmp_cat::_Ord::_Less, __cmp_cat::_Ord::_Greater): Rename to less
+	and greater.
+	(partial_ordering, weak_ordering, strong_ordering): Remove
+	constructors taking __cmp_cat::_Eq parameters. Use renamed
+	enumerators.
+
 2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
 
 	* acinclude.m4: Handle `--with-toolexeclibdir='.
diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index 98a592c..117340f 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -48,10 +48,7 @@ namespace std
 
   namespace __cmp_cat
   {
-    enum class _Eq
-    { equal = 0, equivalent = equal, nonequal = 1, nonequivalent = nonequal };
-
-    enum class _Ord { _Less = -1, _Greater = 1 };
+    enum class _Ord { equivalent = 0, less = -1, greater = 1 };
 
     enum class _Ncmp { _Unordered = -127 };
 
@@ -67,11 +64,6 @@ namespace std
     bool _M_is_ordered;
 
     constexpr explicit
-    partial_ordering(__cmp_cat::_Eq __v) noexcept
-    : _M_value(int(__v)), _M_is_ordered(true)
-    { }
-
-    constexpr explicit
     partial_ordering(__cmp_cat::_Ord __v) noexcept
     : _M_value(int(__v)), _M_is_ordered(true)
     { }
@@ -146,13 +138,13 @@ namespace std
 
   // valid values' definitions
   inline constexpr partial_ordering
-  partial_ordering::less(__cmp_cat::_Ord::_Less);
+  partial_ordering::less(__cmp_cat::_Ord::less);
 
   inline constexpr partial_ordering
-  partial_ordering::equivalent(__cmp_cat::_Eq::equivalent);
+  partial_ordering::equivalent(__cmp_cat::_Ord::equivalent);
 
   inline constexpr partial_ordering
-  partial_ordering::greater(__cmp_cat::_Ord::_Greater);
+  partial_ordering::greater(__cmp_cat::_Ord::greater);
 
   inline constexpr partial_ordering
   partial_ordering::unordered(__cmp_cat::_Ncmp::_Unordered);
@@ -162,10 +154,6 @@ namespace std
     int _M_value;
 
     constexpr explicit
-    weak_ordering(__cmp_cat::_Eq __v) noexcept : _M_value(int(__v))
-    { }
-
-    constexpr explicit
     weak_ordering(__cmp_cat::_Ord __v) noexcept : _M_value(int(__v))
     { }
 
@@ -243,24 +231,19 @@ namespace std
 
   // valid values' definitions
   inline constexpr weak_ordering
-  weak_ordering::less(__cmp_cat::_Ord::_Less);
+  weak_ordering::less(__cmp_cat::_Ord::less);
 
   inline constexpr weak_ordering
-  weak_ordering::equivalent(__cmp_cat::_Eq::equivalent);
+  weak_ordering::equivalent(__cmp_cat::_Ord::equivalent);
 
   inline constexpr weak_ordering
-  weak_ordering::greater(__cmp_cat::_Ord::_Greater);
+  weak_ordering::greater(__cmp_cat::_Ord::greater);
 
   class strong_ordering
   {
     int _M_value;
 
     constexpr explicit
-    strong_ordering(__cmp_cat::_Eq __v) noexcept
-    : _M_value(int(__v))
-    { }
-
-    constexpr explicit
     strong_ordering(__cmp_cat::_Ord __v) noexcept
     : _M_value(int(__v))
     { }
@@ -350,16 +333,16 @@ namespace std
 
   // valid values' definitions
   inline constexpr strong_ordering
-  strong_ordering::less(__cmp_cat::_Ord::_Less);
+  strong_ordering::less(__cmp_cat::_Ord::less);
 
   inline constexpr strong_ordering
-  strong_ordering::equal(__cmp_cat::_Eq::equal);
+  strong_ordering::equal(__cmp_cat::_Ord::equivalent);
 
   inline constexpr strong_ordering
-  strong_ordering::equivalent(__cmp_cat::_Eq::equivalent);
+  strong_ordering::equivalent(__cmp_cat::_Ord::equivalent);
 
   inline constexpr strong_ordering
-  strong_ordering::greater(__cmp_cat::_Ord::_Greater);
+  strong_ordering::greater(__cmp_cat::_Ord::greater);
 
 
   // named comparison functions



More information about the Libstdc++-cvs mailing list