[libcxx-commits] [libcxx] [libc++] Guard transitive include of `<locale>` with availability macro (PR #95686)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 15 20:14:53 PDT 2024


https://github.com/var-const created https://github.com/llvm/llvm-project/pull/95686

This is a follow-up to https://github.com/llvm/llvm-project/pull/80282.
The transitive includes of `<locale>` in `<vector>` were all guarded by
the availability macro -- the new include should also be guarded,
otherwise any users who compile with localization disabled will start
getting errors trying to include `<vector>`.


>From ac9c591ae33ae82ddde7aac5596605e3feec85d8 Mon Sep 17 00:00:00 2001
From: Konstantin Varlamov <varconst at apple.com>
Date: Sat, 15 Jun 2024 20:10:17 -0700
Subject: [PATCH] [libc++] Guard transitive include of `<locale>` with
 availability macro

This is a follow-up to https://github.com/llvm/llvm-project/pull/80282.
The transitive includes of `<locale>` in `<vector>` were all guarded by
the availability macro -- the new include should also be guarded,
otherwise any users who compile with localization disabled will start
getting errors trying to include `<vector>`.
---
 libcxx/include/vector | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libcxx/include/vector b/libcxx/include/vector
index cbfc2cefa1fd9..c2f541d3fcdb7 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -2974,7 +2974,9 @@ _LIBCPP_POP_MACROS
 #  include <concepts>
 #  include <cstdlib>
 #  include <iosfwd>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
 #  include <locale>
+#endif
 #  include <tuple>
 #  include <type_traits>
 #  include <typeinfo>



More information about the libcxx-commits mailing list