Skip to content

[libc++] Properly guard flat_map includes based on C++ version #119227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Dec 9, 2024

That's what we (try to) do consistently for all other umbrella headers.

As a drive-by, remove the <__assert> header which is not mandated anymore.

@ldionne ldionne requested a review from a team as a code owner December 9, 2024 16:12
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 9, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

That's what we (try to) do consistently for all other umbrella headers.


Full diff: https://github.com/llvm/llvm-project/pull/119227.diff

1 Files Affected:

  • (modified) libcxx/include/flat_map (+7-2)
diff --git a/libcxx/include/flat_map b/libcxx/include/flat_map
index 15d79dd1ddca34..870dd2e26a2379 100644
--- a/libcxx/include/flat_map
+++ b/libcxx/include/flat_map
@@ -39,8 +39,13 @@ namespace std {
 
 #include <__assert> // all public C++ headers provide the assertion handler
 #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

@ldionne ldionne force-pushed the review/flat-map-includes branch from 34d4444 to f0651c4 Compare December 9, 2024 16:41
That's what we (try to) do consistently for all other umbrella headers.
@ldionne ldionne force-pushed the review/flat-map-includes branch from 0542e60 to f919276 Compare December 10, 2024 15:17
@ldionne ldionne merged commit 4b8bf6a into llvm:main Dec 11, 2024
63 checks passed
@ldionne ldionne deleted the review/flat-map-includes branch December 11, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants