mirror of
https://git.proxmox.com/git/llvm-toolchain
synced 2025-06-14 20:00:43 +00:00
revert the mbstate-revert-issue-62523.patch
This commit is contained in:
parent
57b722ea4a
commit
2f8cbb7e18
211
debian/patches/mbstate-revert-issue-62523.patch
vendored
Normal file
211
debian/patches/mbstate-revert-issue-62523.patch
vendored
Normal file
@ -0,0 +1,211 @@
|
||||
commit a595b931f1f91897317a4257df313bddfeb029a6
|
||||
Author: Ian Anderson <iana@apple.com>
|
||||
Date: Mon Apr 17 09:38:38 2023 -0700
|
||||
|
||||
[libc++] cuchar redeclares ::mbstate_t when it's in its own clang module
|
||||
|
||||
When cuchar is compiled independently on platforms that don't have <uchar.h>, it doesn't get a declaration of mbstate_t, and so makes an empty declaration for ::mbstate_t. That conflicts with the declarations in __mbstate_t.h and cwchar since both of those headers do get mbstate_t before making ::mbstate_t.
|
||||
|
||||
Change `__mbstate_t.h` to just get the underlying declaration for mbstate_t and not make a declaration for ::mbstate_t. Include __mbstate_t.h in uchar.h and wchar.h when their next headers aren't available so that at least mbstate_t gets defined.
|
||||
|
||||
Add __std_mbstate_t.h to declare ::mbstate_t for headers that need that when cuchar or cwchar aren't available (because either _LIBCPP_HAS_NO_WIDE_CHARACTERS or _LIBCPP_CXX03_LANG).
|
||||
|
||||
Reviewed By: ldionne, Mordante, #libc, philnik
|
||||
|
||||
Differential Revision: https://reviews.llvm.org/D148542
|
||||
|
||||
diff --git b/libcxx/include/CMakeLists.txt a/libcxx/include/CMakeLists.txt
|
||||
index 356af6db8f6c..fa64cec327e6 100644
|
||||
--- b/libcxx/include/CMakeLists.txt
|
||||
+++ a/libcxx/include/CMakeLists.txt
|
||||
@@ -614,7 +614,6 @@ set(files
|
||||
__ranges/views.h
|
||||
__ranges/zip_view.h
|
||||
__split_buffer
|
||||
- __std_mbstate_t.h
|
||||
__string/char_traits.h
|
||||
__string/constexpr_c_functions.h
|
||||
__string/extern_template_lists.h
|
||||
diff --git b/libcxx/include/__locale a/libcxx/include/__locale
|
||||
index a812427acba4..994613083cdf 100644
|
||||
--- b/libcxx/include/__locale
|
||||
+++ a/libcxx/include/__locale
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
|
||||
# include <cwchar>
|
||||
-#else
|
||||
-# include <__std_mbstate_t.h>
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_MSVCRT_LIKE)
|
||||
diff --git b/libcxx/include/__mbstate_t.h a/libcxx/include/__mbstate_t.h
|
||||
index d793787fa0cd..487a6d092c71 100644
|
||||
--- b/libcxx/include/__mbstate_t.h
|
||||
+++ a/libcxx/include/__mbstate_t.h
|
||||
@@ -16,27 +16,29 @@
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
-// The goal of this header is to provide mbstate_t without requiring all of
|
||||
-// <uchar.h> or <wchar.h>. It's also used by the libc++ versions of <uchar.h>
|
||||
-// and <wchar.h> to get mbstate_t when the C library doesn't provide <uchar.h>
|
||||
-// or <wchar.h>, hence the #include_next of those headers instead of #include.
|
||||
-// (e.g. if <wchar.h> isn't present in the C library, the libc++ <wchar.h>
|
||||
-// will include this header. This header needs to not turn around and cyclically
|
||||
-// include <wchar.h>, but fall through to <uchar.h>.)
|
||||
+// TODO(ldionne):
|
||||
+// The goal of this header is to provide mbstate_t without having to pull in
|
||||
+// <wchar.h> or <uchar.h>. This is necessary because we need that type even
|
||||
+// when we don't have (or try to provide) support for wchar_t, because several
|
||||
+// types like std::fpos are defined in terms of mbstate_t.
|
||||
//
|
||||
-// This does not define std::mbstate_t -- this only brings in the declaration
|
||||
-// in the global namespace.
|
||||
+// This is a gruesome hack, but I don't know how to make it cleaner for
|
||||
+// the time being.
|
||||
|
||||
-#if __has_include(<bits/types/mbstate_t.h>)
|
||||
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
|
||||
+# include <wchar.h> // for mbstate_t
|
||||
+#elif __has_include(<bits/types/mbstate_t.h>)
|
||||
# include <bits/types/mbstate_t.h> // works on most Unixes
|
||||
#elif __has_include(<sys/_types/_mbstate_t.h>)
|
||||
# include <sys/_types/_mbstate_t.h> // works on Darwin
|
||||
-#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
|
||||
-# include_next <wchar.h> // fall back to the C standard provider of mbstate_t
|
||||
-#elif __has_include_next(<uchar.h>)
|
||||
-# include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible
|
||||
#else
|
||||
-# error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
|
||||
+# error "The library was configured without support for wide-characters, but we don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
|
||||
#endif
|
||||
|
||||
+_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
+
|
||||
+using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
|
||||
+
|
||||
+_LIBCPP_END_NAMESPACE_STD
|
||||
+
|
||||
#endif // _LIBCPP___MBSTATE_T_H
|
||||
diff --git b/libcxx/include/__std_mbstate_t.h a/libcxx/include/__std_mbstate_t.h
|
||||
deleted file mode 100644
|
||||
index e79cc789fddf..000000000000
|
||||
--- b/libcxx/include/__std_mbstate_t.h
|
||||
+++ /dev/null
|
||||
@@ -1,29 +0,0 @@
|
||||
-// -*- C++ -*-
|
||||
-//===----------------------------------------------------------------------===//
|
||||
-//
|
||||
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
-// See https://llvm.org/LICENSE.txt for license information.
|
||||
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
-//
|
||||
-//===----------------------------------------------------------------------===//
|
||||
-
|
||||
-#ifndef _LIBCPP___STD_MBSTATE_T_H
|
||||
-#define _LIBCPP___STD_MBSTATE_T_H
|
||||
-
|
||||
-#include <__config>
|
||||
-#include <__mbstate_t.h>
|
||||
-
|
||||
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
-# pragma GCC system_header
|
||||
-#endif
|
||||
-
|
||||
-// The goal of this header is to provide std::mbstate_t without requiring all
|
||||
-// of <cuchar> or <cwchar>.
|
||||
-
|
||||
-_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
-
|
||||
-using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
|
||||
-
|
||||
-_LIBCPP_END_NAMESPACE_STD
|
||||
-
|
||||
-#endif // _LIBCPP___STD_MBSTATE_T_H
|
||||
diff --git b/libcxx/include/iosfwd a/libcxx/include/iosfwd
|
||||
index e3cd9faa70b7..0af7df30d8fd 100644
|
||||
--- b/libcxx/include/iosfwd
|
||||
+++ a/libcxx/include/iosfwd
|
||||
@@ -103,7 +103,7 @@ using u32streampos = fpos<char_traits<char32_t>::state_type>;
|
||||
#include <__fwd/sstream.h>
|
||||
#include <__fwd/streambuf.h>
|
||||
#include <__fwd/string.h>
|
||||
-#include <__std_mbstate_t.h>
|
||||
+#include <__mbstate_t.h>
|
||||
#include <version>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
diff --git b/libcxx/include/module.modulemap.in a/libcxx/include/module.modulemap.in
|
||||
index 99907787132b..01f763d764e6 100644
|
||||
--- b/libcxx/include/module.modulemap.in
|
||||
+++ a/libcxx/include/module.modulemap.in
|
||||
@@ -1735,7 +1735,6 @@ module std [system] {
|
||||
module __mbstate_t { private header "__mbstate_t.h" export * }
|
||||
module __node_handle { private header "__node_handle" export * }
|
||||
module __split_buffer { private header "__split_buffer" export * }
|
||||
- module __std_mbstate_t { private header "__std_mbstate_t.h" export * }
|
||||
module __threading_support { header "__threading_support" export * }
|
||||
module __tree { header "__tree" export * }
|
||||
module __undef_macros { header "__undef_macros" export * }
|
||||
diff --git b/libcxx/include/uchar.h a/libcxx/include/uchar.h
|
||||
index 546113f7eab4..3a51bb7a9f61 100644
|
||||
--- b/libcxx/include/uchar.h
|
||||
+++ a/libcxx/include/uchar.h
|
||||
@@ -42,12 +42,10 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps);
|
||||
|
||||
// Some platforms don't implement <uchar.h> and we don't want to give a hard
|
||||
// error on those platforms. When the platform doesn't provide <uchar.h>, at
|
||||
-// least include <stddef.h> so we get the declaration for size_t, and try to
|
||||
-// get the declaration of mbstate_t too.
|
||||
+// least include <stddef.h> so we get the declaration for size_t.
|
||||
#if __has_include_next(<uchar.h>)
|
||||
# include_next <uchar.h>
|
||||
#else
|
||||
-# include <__mbstate_t.h>
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
diff --git b/libcxx/include/wchar.h a/libcxx/include/wchar.h
|
||||
index db624cea2bee..c684508dc2cc 100644
|
||||
--- b/libcxx/include/wchar.h
|
||||
+++ a/libcxx/include/wchar.h
|
||||
@@ -122,8 +122,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
||||
|
||||
# if __has_include_next(<wchar.h>)
|
||||
# include_next <wchar.h>
|
||||
-# else
|
||||
-# include <__mbstate_t.h> // make sure we have mbstate_t regardless of the existence of <wchar.h>
|
||||
# endif
|
||||
|
||||
// Determine whether we have const-correct overloads for wcschr and friends.
|
||||
diff --git b/libcxx/test/libcxx/private_headers.verify.cpp a/libcxx/test/libcxx/private_headers.verify.cpp
|
||||
index 0720e1f72a77..48b9a7f8c574 100644
|
||||
--- b/libcxx/test/libcxx/private_headers.verify.cpp
|
||||
+++ a/libcxx/test/libcxx/private_headers.verify.cpp
|
||||
@@ -614,7 +614,6 @@ END-SCRIPT
|
||||
#include <__ranges/views.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/views.h'}}
|
||||
#include <__ranges/zip_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/zip_view.h'}}
|
||||
#include <__split_buffer> // expected-error@*:* {{use of private header from outside its module: '__split_buffer'}}
|
||||
-#include <__std_mbstate_t.h> // expected-error@*:* {{use of private header from outside its module: '__std_mbstate_t.h'}}
|
||||
#include <__string/char_traits.h> // expected-error@*:* {{use of private header from outside its module: '__string/char_traits.h'}}
|
||||
#include <__string/constexpr_c_functions.h> // expected-error@*:* {{use of private header from outside its module: '__string/constexpr_c_functions.h'}}
|
||||
#include <__string/extern_template_lists.h> // expected-error@*:* {{use of private header from outside its module: '__string/extern_template_lists.h'}}
|
||||
diff --git b/libcxx/utils/generate_iwyu_mapping.py a/libcxx/utils/generate_iwyu_mapping.py
|
||||
index f8377a976f08..cb27d4677395 100644
|
||||
--- b/libcxx/utils/generate_iwyu_mapping.py
|
||||
+++ a/libcxx/utils/generate_iwyu_mapping.py
|
||||
@@ -56,12 +56,11 @@ def generate_map(include):
|
||||
elif i == '__pstl_memory': continue
|
||||
elif i == '__pstl_numeric': continue
|
||||
elif i == '__split_buffer': public = ['deque', 'vector']
|
||||
- elif i == '__std_mbstate_t.h': continue
|
||||
elif i == '__threading_support': public = ['atomic', 'mutex', 'semaphore', 'thread']
|
||||
elif i == '__tree': public = ['map', 'set']
|
||||
elif i == '__undef_macros': continue
|
||||
elif i == '__verbose_abort': continue
|
||||
- else: panic(i)
|
||||
+ else: panic()
|
||||
|
||||
for p in public:
|
||||
result.append(f'{generate(f"<{i}>", p)},')
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -148,3 +148,4 @@ unwind-force-pthread-dl.diff
|
||||
force-sse2-compiler-rt.diff
|
||||
bolt-disable-emit-relocs.patch
|
||||
link-grpc.diff
|
||||
mbstate-revert-issue-62523.patch
|
||||
|
Loading…
Reference in New Issue
Block a user