-  Couldn't load subscription status. 
- Fork 15k
 Revert "[libcxx] Define _LIBCPP_HAS_C8RTOMB_MBRTOC8 to true if compiling with clang" #165268 
 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  
  philnik777 merged 1 commit into main from revert-152724-picolibc-_LIBCPP_HAS_C8RTOMB_MBRTOC8        Oct 27, 2025  
    Merged  
   Revert "[libcxx] Define _LIBCPP_HAS_C8RTOMB_MBRTOC8 to true if compiling with clang"  #165268 
  philnik777 merged 1 commit into main from revert-152724-picolibc-_LIBCPP_HAS_C8RTOMB_MBRTOC8        Oct 27, 2025  
    +41   −70      
  Conversation
   This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters   
     …iling wi…" This reverts commit d522b1b.
| @vhscampos Please make sure the pre-commit CI is happy before merging patches next time. | 
| @llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesReverts llvm/llvm-project#152724 The PR was merged with broken pre-commit CI. Full diff: https://github.com/llvm/llvm-project/pull/165268.diff 7 Files Affected: 
 diff --git a/libcxx/include/__config b/libcxx/include/__config index 5971a3c5407b9..b4c081dcdff1b 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1021,9 +1021,7 @@ typedef __char32_t char32_t; // the latter depends on internal GNU libc details that are not appropriate // to depend on here, so any declarations present when __cpp_char8_t is not // defined are ignored. -# if defined(__clang__) -# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1 -# elif defined(_LIBCPP_GLIBC_PREREQ) +# if defined(_LIBCPP_GLIBC_PREREQ) # if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t) # define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1 # else diff --git a/libcxx/test/std/depr/depr.c.headers/uchar_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/uchar_h.compile.pass.cpp index c448ba83f4b38..a1560c8ee5853 100644 --- a/libcxx/test/std/depr/depr.c.headers/uchar_h.compile.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/uchar_h.compile.pass.cpp @@ -23,6 +23,11 @@ // __STDC_UTF_16__ may or may not be defined by the C standard library // __STDC_UTF_32__ may or may not be defined by the C standard library +#if !defined(TEST_HAS_NO_C8RTOMB_MBRTOC8) +ASSERT_SAME_TYPE(size_t, decltype(mbrtoc8((char8_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0))); +ASSERT_SAME_TYPE(size_t, decltype(c8rtomb((char*)0, (char8_t)0, (mbstate_t*)0))); +#endif + ASSERT_SAME_TYPE(size_t, decltype(mbrtoc16((char16_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0))); ASSERT_SAME_TYPE(size_t, decltype(c16rtomb((char*)0, (char16_t)0, (mbstate_t*)0))); diff --git a/libcxx/test/std/depr/depr.c.headers/uchar_h_char8_t.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/uchar_h_char8_t.compile.pass.cpp deleted file mode 100644 index 34b512f9c5959..0000000000000 --- a/libcxx/test/std/depr/depr.c.headers/uchar_h_char8_t.compile.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// The following platforms do not provide mbrtoc8 and c8rtomb so the tests fail -// XFAIL: target={{.+}}-aix{{.*}} -// XFAIL: android -// XFAIL: darwin -// XFAIL: freebsd -// XFAIL: windows -// XFAIL: glibc-no-char8_t-support -// XFAIL: LIBCXX-PICOLIBC-FIXME - -// <uchar.h> - -#include <uchar.h> - -ASSERT_SAME_TYPE(size_t, decltype(mbrtoc8((char8_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0))); -ASSERT_SAME_TYPE(size_t, decltype(c8rtomb((char*)0, (char8_t)0, (mbstate_t*)0))); diff --git a/libcxx/test/std/strings/c.strings/cuchar.compile.pass.cpp b/libcxx/test/std/strings/c.strings/cuchar.compile.pass.cpp index 96b394a9934f8..2076384deb2b2 100644 --- a/libcxx/test/std/strings/c.strings/cuchar.compile.pass.cpp +++ b/libcxx/test/std/strings/c.strings/cuchar.compile.pass.cpp @@ -23,6 +23,11 @@ // __STDC_UTF_16__ may or may not be defined by the C standard library // __STDC_UTF_32__ may or may not be defined by the C standard library +#if !defined(TEST_HAS_NO_C8RTOMB_MBRTOC8) +ASSERT_SAME_TYPE(std::size_t, decltype(std::mbrtoc8((char8_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0))); +ASSERT_SAME_TYPE(std::size_t, decltype(std::c8rtomb((char*)0, (char8_t)0, (mbstate_t*)0))); +#endif + ASSERT_SAME_TYPE(std::size_t, decltype(std::mbrtoc16((char16_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0))); ASSERT_SAME_TYPE(std::size_t, decltype(std::c16rtomb((char*)0, (char16_t)0, (mbstate_t*)0))); diff --git a/libcxx/test/std/strings/c.strings/cuchar_char8_t.compile.pass.cpp b/libcxx/test/std/strings/c.strings/cuchar_char8_t.compile.pass.cpp deleted file mode 100644 index 019265b534c5c..0000000000000 --- a/libcxx/test/std/strings/c.strings/cuchar_char8_t.compile.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// The following platforms do not provide mbrtoc8 and c8rtomb so the tests fail -// XFAIL: target={{.+}}-aix{{.*}} -// XFAIL: android -// XFAIL: darwin -// XFAIL: freebsd -// XFAIL: windows -// XFAIL: glibc-no-char8_t-support -// XFAIL: LIBCXX-PICOLIBC-FIXME - -// <cuchar> - -#include <cuchar> - -ASSERT_SAME_TYPE(std::size_t, decltype(std::mbrtoc8((char8_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0))); -ASSERT_SAME_TYPE(std::size_t, decltype(std::c8rtomb((char*)0, (char8_t)0, (mbstate_t*)0))); diff --git a/libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp b/libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp new file mode 100644 index 0000000000000..1d4a225668d80 --- /dev/null +++ b/libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03 + +#include <uchar.h> + +#include "test_macros.h" + +// When C++ char8_t support is not enabled, definitions of these functions that +// match the C2X declarations may still be present in the global namespace with +// a char8_t typedef substituted for the C++ char8_t type. If so, these are not +// the declarations we are looking for, so don't test for them. +#if !defined(TEST_HAS_NO_CHAR8_T) +using U = decltype(::c8rtomb); +using V = decltype(::mbrtoc8); +# if !_LIBCPP_HAS_C8RTOMB_MBRTOC8 +// expected-error@-3 {{no member named 'c8rtomb' in the global namespace}} +// expected-error@-3 {{no member named 'mbrtoc8' in the global namespace}} +# else +// expected-no-diagnostics +# endif +#else +// expected-no-diagnostics +#endif diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py index 1668e4ab01d75..7d6e78de343c5 100644 --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -293,23 +293,6 @@ def _mingwSupportsModules(cfg): """, ), ), - # Check for Glibc < 2.36, where there was no support for char8_t functions - Feature( - name="glibc-no-char8_t-support", - when=lambda cfg: "__GLIBC__" in compilerMacros(cfg) - and not sourceBuilds( - cfg, - """ - #include <uchar.h> - #include <wchar.h> - int main(void) { - char8_t c; - mbstate_t s = {0}; - return mbrtoc8(&c, "", 0, &s); - } - """, - ), - ), Feature( name="has-unix-headers", when=lambda cfg: sourceBuilds(  | 
 dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request  Oct 27, 2025          
 …iling with clang" (llvm#165268) Reverts llvm#152724 The PR was merged with broken pre-commit CI.
 Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request  Oct 29, 2025          
 …iling with clang" (llvm#165268) Reverts llvm#152724 The PR was merged with broken pre-commit CI.
 Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment 
  Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.    
 
Reverts #152724
The PR was merged with broken pre-commit CI.