[libcxx-commits] [libcxx] b5bc528 - [libc++] Guard `__pad_and_output` with `_LIBCPP_HAS_LOCALIZATION` (#116580)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 18 01:03:33 PST 2024


Author: A. Jiang
Date: 2024-11-18T17:03:29+08:00
New Revision: b5bc528c140f6dab6600a64c020cdbf6003e4d35

URL: https://github.com/llvm/llvm-project/commit/b5bc528c140f6dab6600a64c020cdbf6003e4d35
DIFF: https://github.com/llvm/llvm-project/commit/b5bc528c140f6dab6600a64c020cdbf6003e4d35.diff

LOG: [libc++] Guard `__pad_and_output` with `_LIBCPP_HAS_LOCALIZATION` (#116580)

This fixes errors for no-localization builds (possibly introduced by
#116223).

Added: 
    

Modified: 
    libcxx/include/__iterator/ostreambuf_iterator.h
    libcxx/include/__locale_dir/pad_and_output.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__iterator/ostreambuf_iterator.h b/libcxx/include/__iterator/ostreambuf_iterator.h
index 621ffd4f988c31..f00449355e4eb8 100644
--- a/libcxx/include/__iterator/ostreambuf_iterator.h
+++ b/libcxx/include/__iterator/ostreambuf_iterator.h
@@ -65,9 +65,11 @@ class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator
   _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) { return *this; }
   _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; }
 
+#if _LIBCPP_HAS_LOCALIZATION
   template <class _Ch, class _Tr>
   friend _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_Ch, _Tr> __pad_and_output(
       ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl);
+#endif // _LIBCPP_HAS_LOCALIZATION
 };
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__locale_dir/pad_and_output.h b/libcxx/include/__locale_dir/pad_and_output.h
index c35c5df90801ef..a1cb37d0786dab 100644
--- a/libcxx/include/__locale_dir/pad_and_output.h
+++ b/libcxx/include/__locale_dir/pad_and_output.h
@@ -10,11 +10,14 @@
 #define _LIBCPP___LOCALE_DIR_PAD_AND_OUTPUT_H
 
 #include <__config>
-#include <ios>
 
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
+#if _LIBCPP_HAS_LOCALIZATION
+
+#  include <ios>
+
+#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#    pragma GCC system_header
+#  endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -80,4 +83,6 @@ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output(
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif // _LIBCPP_HAS_LOCALIZATION
+
 #endif // _LIBCPP___LOCALE_DIR_PAD_AND_OUTPUT_H


        


More information about the libcxx-commits mailing list