public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers
@ 2021-06-04 15:01 Jonathan Wakely
  2021-06-04 17:10 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2021-06-04 15:01 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]

Also update the C++20 status docs.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2020.xml:
	* doc/html/*: Regenerate.
	* include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup):
	Define.
	* include/std/version (__cpp_lib_generic_unordered_lookup):
	Define.
	* testsuite/23_containers/unordered_map/operations/1.cc: Check
	feature test macro.
	* testsuite/23_containers/unordered_set/operations/1.cc:
	Likewise.

Tested powerpc64le-linux. Committed to trunk.

I'll also add a note to the GCC 11 release notes, and I've updated the
compiler support page at cppreference.com


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 5912 bytes --]

commit f78f25f43864f38ae5a6a9fcce8f26c94fe45bcd
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jun 4 15:59:37 2021

    libstdc++: Add feature test macro for heterogeneous lookup in unordered containers
    
    Also update the C++20 status docs.
    
    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
    
    libstdc++-v3/ChangeLog:
    
            * doc/xml/manual/status_cxx2020.xml:
            * doc/html/*: Regenerate.
            * include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup):
            Define.
            * include/std/version (__cpp_lib_generic_unordered_lookup):
            Define.
            * testsuite/23_containers/unordered_map/operations/1.cc: Check
            feature test macro.
            * testsuite/23_containers/unordered_set/operations/1.cc:
            Likewise.

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
index b62a432eed1..ca12d8023f1 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
@@ -429,13 +429,12 @@ or any notes about the implementation.
     </row>
 
     <row>
-      <?dbhtml bgcolor="#C8B0B0" ?>
       <entry> Atomic waiting and notifying, std::semaphore, std::latch and std::barrier </entry>
       <entry>
         <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1135r6.html">
         P1135R6 </link>
       </entry>
-      <entry align="center"> </entry>
+      <entry align="center"> 11.1 </entry>
       <entry>
         <informaltable colsep="0" rowsep="0" rowheader="norowheader" frame="none"><tgroup cols="1"><tbody>
         <row><entry> <code>__cpp_lib_atomic_lock_free_type_aliases &gt;= 201907L</code> </entry></row>
@@ -803,16 +802,25 @@ or any notes about the implementation.
     </row>
 
     <row>
-      <?dbhtml bgcolor="#C8B0B0" ?>
       <entry>  Heterogeneous lookup for unordered containers </entry>
       <entry>
         <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0919r3.html">
         P0919R3 </link>
       </entry>
-      <entry align="center"> </entry>
+      <entry align="center"> 11.1 </entry>
       <entry> <code>__cpp_lib_generic_unordered_lookup &gt;= 201811</code> </entry>
     </row>
 
+    <row>
+      <entry> Refinement Proposal for P0919 </entry>
+      <entry>
+        <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1690r1.html">
+        P1690R1 </link>
+      </entry>
+      <entry align="center"> 11.1 </entry>
+      <entry/>
+    </row>
+
     <row>
       <entry>  Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20 </entry>
       <entry>
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index 4bdbe7dd9cc..dfc2a2a7800 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -735,7 +735,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::pair<const_iterator, const_iterator>
       equal_range(const key_type& __k) const;
 
-#if __cplusplus > 201702L
+#if __cplusplus >= 202002L
+#define __cpp_lib_generic_unordered_lookup 201811L
+
       template<typename _Kt,
 	       typename = __has_is_transparent_t<_Hash, _Kt>,
 	       typename = __has_is_transparent_t<_Equal, _Kt>>
@@ -765,7 +767,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       typename = __has_is_transparent_t<_Equal, _Kt>>
 	pair<const_iterator, const_iterator>
 	_M_equal_range_tr(const _Kt& __k) const;
-#endif
+#endif // C++20
 
     private:
       // Bucket index computation helpers.
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index ea0e18a3f9d..8d0b2b95f34 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -169,7 +169,7 @@
 #define __cpp_lib_variant 201606L
 #endif
 
-#if __cplusplus > 201703L
+#if __cplusplus >= 202002L
 // c++20
 #define __cpp_lib_atomic_flag_test 201907L
 #define __cpp_lib_atomic_float 201711L
@@ -225,6 +225,7 @@
 #define __cpp_lib_constexpr_tuple 201811L
 #define __cpp_lib_constexpr_utility 201811L
 #define __cpp_lib_erase_if 202002L
+#define __cpp_lib_generic_unordered_lookup 201811L
 #define __cpp_lib_interpolate 201902L
 #ifdef _GLIBCXX_HAS_GTHREADS
 # define __cpp_lib_jthread 201911L
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc
index 4f2df728ebb..f310a8a55ed 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc
@@ -18,6 +18,13 @@
 // { dg-do run { target c++20 } }
 
 #include <unordered_map>
+
+#ifndef __cpp_lib_generic_unordered_lookup
+# error "Feature-test macro for generic lookup missing in <unordered_map>"
+#elif __cpp_lib_generic_unordered_lookup < 201811L
+# error "Feature-test macro for generic lookup has wrong value in <unordered_map>"
+#endif
+
 #include <testsuite_hooks.h>
 
 struct Equal
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc
index 34414d2434a..66826dc33ec 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc
@@ -18,6 +18,13 @@
 // { dg-do run { target c++20 } }
 
 #include <unordered_set>
+
+#ifndef __cpp_lib_generic_unordered_lookup
+# error "Feature-test macro for generic lookup missing in <unordered_set>"
+#elif __cpp_lib_generic_unordered_lookup < 201811L
+# error "Feature-test macro for generic lookup has wrong value in <unordered_set>"
+#endif
+
 #include <testsuite_hooks.h>
 
 struct Equal

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [committed] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers
  2021-06-04 15:01 [committed] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers Jonathan Wakely
@ 2021-06-04 17:10 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2021-06-04 17:10 UTC (permalink / raw)
  To: libstdc++, gcc-patches

On 04/06/21 16:01 +0100, Jonathan Wakely wrote:
>Also update the C++20 status docs.
>
>Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
>
>libstdc++-v3/ChangeLog:
>
>	* doc/xml/manual/status_cxx2020.xml:
>	* doc/html/*: Regenerate.
>	* include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup):
>	Define.
>	* include/std/version (__cpp_lib_generic_unordered_lookup):
>	Define.
>	* testsuite/23_containers/unordered_map/operations/1.cc: Check
>	feature test macro.
>	* testsuite/23_containers/unordered_set/operations/1.cc:
>	Likewise.
>
>Tested powerpc64le-linux. Committed to trunk.
>
>I'll also add a note to the GCC 11 release notes, and I've updated the
>compiler support page at cppreference.com

Oh, and this should be backported to gcc-11 too.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-04 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 15:01 [committed] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers Jonathan Wakely
2021-06-04 17:10 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).