[libcxx-commits] [libcxx] [libc++] Properly guard flat_map includes based on C++ version (PR #119227)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 10 07:17:43 PST 2024


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/119227

>From f919276949bf62362ee2354d79e77d3122d33ee1 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 9 Dec 2024 10:45:11 -0500
Subject: [PATCH] [libc++] Properly guard flat_map includes based on C++
 version

That's what we (try to) do consistently for all other umbrella headers.
---
 libcxx/include/flat_map                       | 12 ++++++----
 .../test/libcxx/transitive_includes/cxx03.csv | 22 -------------------
 .../test/libcxx/transitive_includes/cxx11.csv | 22 -------------------
 .../test/libcxx/transitive_includes/cxx14.csv | 22 -------------------
 .../test/libcxx/transitive_includes/cxx17.csv | 22 -------------------
 .../test/libcxx/transitive_includes/cxx20.csv | 22 -------------------
 6 files changed, 8 insertions(+), 114 deletions(-)

diff --git a/libcxx/include/flat_map b/libcxx/include/flat_map
index b99eebfa9fc538..1f2c204e2ef215 100644
--- a/libcxx/include/flat_map
+++ b/libcxx/include/flat_map
@@ -38,11 +38,15 @@ namespace std {
 */
 
 #if 0
-#else                 // 0
-#  include <__assert> // all public C++ headers provide the assertion handler
+#else // 0
 #  include <__config>
-#  include <__flat_map/flat_map.h>
-#  include <__flat_map/sorted_unique.h>
+
+#  if _LIBCPP_STD_VER >= 23
+#    include <__flat_map/flat_map.h>
+#    include <__flat_map/sorted_unique.h>
+#  endif
+
+// for feature-test macros
 #  include <version>
 
 // standard required includes
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index 72fccfd3649325..801f6cbf9060f8 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -674,35 +674,13 @@ filesystem typeinfo
 filesystem utility
 filesystem variant
 filesystem version
-flat_map atomic
-flat_map cctype
-flat_map climits
 flat_map cmath
 flat_map compare
-flat_map concepts
 flat_map cstddef
 flat_map cstdint
-flat_map cstdio
-flat_map cstdlib
-flat_map cstring
-flat_map ctime
-flat_map cwchar
-flat_map cwctype
-flat_map exception
 flat_map initializer_list
-flat_map iosfwd
-flat_map iterator
 flat_map limits
-flat_map memory
-flat_map new
-flat_map optional
-flat_map ratio
-flat_map stdexcept
-flat_map tuple
 flat_map type_traits
-flat_map typeinfo
-flat_map utility
-flat_map variant
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index 72fccfd3649325..801f6cbf9060f8 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -674,35 +674,13 @@ filesystem typeinfo
 filesystem utility
 filesystem variant
 filesystem version
-flat_map atomic
-flat_map cctype
-flat_map climits
 flat_map cmath
 flat_map compare
-flat_map concepts
 flat_map cstddef
 flat_map cstdint
-flat_map cstdio
-flat_map cstdlib
-flat_map cstring
-flat_map ctime
-flat_map cwchar
-flat_map cwctype
-flat_map exception
 flat_map initializer_list
-flat_map iosfwd
-flat_map iterator
 flat_map limits
-flat_map memory
-flat_map new
-flat_map optional
-flat_map ratio
-flat_map stdexcept
-flat_map tuple
 flat_map type_traits
-flat_map typeinfo
-flat_map utility
-flat_map variant
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index fd36dace19c76c..9146a7079ee1e9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -692,35 +692,13 @@ filesystem typeinfo
 filesystem utility
 filesystem variant
 filesystem version
-flat_map atomic
-flat_map cctype
-flat_map climits
 flat_map cmath
 flat_map compare
-flat_map concepts
 flat_map cstddef
 flat_map cstdint
-flat_map cstdio
-flat_map cstdlib
-flat_map cstring
-flat_map ctime
-flat_map cwchar
-flat_map cwctype
-flat_map exception
 flat_map initializer_list
-flat_map iosfwd
-flat_map iterator
 flat_map limits
-flat_map memory
-flat_map new
-flat_map optional
-flat_map ratio
-flat_map stdexcept
-flat_map tuple
 flat_map type_traits
-flat_map typeinfo
-flat_map utility
-flat_map variant
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index eaec25f81e5821..a3518f7f62ecb9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -701,35 +701,13 @@ filesystem utility
 filesystem variant
 filesystem vector
 filesystem version
-flat_map atomic
-flat_map cctype
-flat_map climits
 flat_map cmath
 flat_map compare
-flat_map concepts
 flat_map cstddef
 flat_map cstdint
-flat_map cstdio
-flat_map cstdlib
-flat_map cstring
-flat_map ctime
-flat_map cwchar
-flat_map cwctype
-flat_map exception
 flat_map initializer_list
-flat_map iosfwd
-flat_map iterator
 flat_map limits
-flat_map memory
-flat_map new
-flat_map optional
-flat_map ratio
-flat_map stdexcept
-flat_map tuple
 flat_map type_traits
-flat_map typeinfo
-flat_map utility
-flat_map variant
 flat_map version
 format algorithm
 format array
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 89c28e49d6c9de..6de95139279471 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -697,35 +697,13 @@ filesystem utility
 filesystem variant
 filesystem vector
 filesystem version
-flat_map atomic
-flat_map cctype
-flat_map climits
 flat_map cmath
 flat_map compare
-flat_map concepts
 flat_map cstddef
 flat_map cstdint
-flat_map cstdio
-flat_map cstdlib
-flat_map cstring
-flat_map ctime
-flat_map cwchar
-flat_map cwctype
-flat_map exception
 flat_map initializer_list
-flat_map iosfwd
-flat_map iterator
 flat_map limits
-flat_map memory
-flat_map new
-flat_map optional
-flat_map ratio
-flat_map stdexcept
-flat_map tuple
 flat_map type_traits
-flat_map typeinfo
-flat_map utility
-flat_map variant
 flat_map version
 format algorithm
 format array



More information about the libcxx-commits mailing list