Skip to content

Commit 3b14ce9

Browse files
philnik777dvbuka
authored andcommitted
Revert "[libcxx] Define _LIBCPP_HAS_C8RTOMB_MBRTOC8 to true if compiling with clang" (llvm#165268)
Reverts llvm#152724 The PR was merged with broken pre-commit CI.
1 parent adfcb81 commit 3b14ce9

File tree

7 files changed

+41
-70
lines changed

7 files changed

+41
-70
lines changed

libcxx/include/__config

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,9 +1021,7 @@ typedef __char32_t char32_t;
10211021
// the latter depends on internal GNU libc details that are not appropriate
10221022
// to depend on here, so any declarations present when __cpp_char8_t is not
10231023
// defined are ignored.
1024-
# if defined(__clang__)
1025-
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
1026-
# elif defined(_LIBCPP_GLIBC_PREREQ)
1024+
# if defined(_LIBCPP_GLIBC_PREREQ)
10271025
# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
10281026
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
10291027
# else

libcxx/test/std/depr/depr.c.headers/uchar_h.compile.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
// __STDC_UTF_16__ may or may not be defined by the C standard library
2424
// __STDC_UTF_32__ may or may not be defined by the C standard library
2525

26+
#if !defined(TEST_HAS_NO_C8RTOMB_MBRTOC8)
27+
ASSERT_SAME_TYPE(size_t, decltype(mbrtoc8((char8_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0)));
28+
ASSERT_SAME_TYPE(size_t, decltype(c8rtomb((char*)0, (char8_t)0, (mbstate_t*)0)));
29+
#endif
30+
2631
ASSERT_SAME_TYPE(size_t, decltype(mbrtoc16((char16_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0)));
2732
ASSERT_SAME_TYPE(size_t, decltype(c16rtomb((char*)0, (char16_t)0, (mbstate_t*)0)));
2833

libcxx/test/std/depr/depr.c.headers/uchar_h_char8_t.compile.pass.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

libcxx/test/std/strings/c.strings/cuchar.compile.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
// __STDC_UTF_16__ may or may not be defined by the C standard library
2424
// __STDC_UTF_32__ may or may not be defined by the C standard library
2525

26+
#if !defined(TEST_HAS_NO_C8RTOMB_MBRTOC8)
27+
ASSERT_SAME_TYPE(std::size_t, decltype(std::mbrtoc8((char8_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0)));
28+
ASSERT_SAME_TYPE(std::size_t, decltype(std::c8rtomb((char*)0, (char8_t)0, (mbstate_t*)0)));
29+
#endif
30+
2631
ASSERT_SAME_TYPE(std::size_t, decltype(std::mbrtoc16((char16_t*)0, (const char*)0, (size_t)0, (mbstate_t*)0)));
2732
ASSERT_SAME_TYPE(std::size_t, decltype(std::c16rtomb((char*)0, (char16_t)0, (mbstate_t*)0)));
2833

libcxx/test/std/strings/c.strings/cuchar_char8_t.compile.pass.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// UNSUPPORTED: c++03
10+
11+
#include <uchar.h>
12+
13+
#include "test_macros.h"
14+
15+
// When C++ char8_t support is not enabled, definitions of these functions that
16+
// match the C2X declarations may still be present in the global namespace with
17+
// a char8_t typedef substituted for the C++ char8_t type. If so, these are not
18+
// the declarations we are looking for, so don't test for them.
19+
#if !defined(TEST_HAS_NO_CHAR8_T)
20+
using U = decltype(::c8rtomb);
21+
using V = decltype(::mbrtoc8);
22+
# if !_LIBCPP_HAS_C8RTOMB_MBRTOC8
23+
// expected-error@-3 {{no member named 'c8rtomb' in the global namespace}}
24+
// expected-error@-3 {{no member named 'mbrtoc8' in the global namespace}}
25+
# else
26+
// expected-no-diagnostics
27+
# endif
28+
#else
29+
// expected-no-diagnostics
30+
#endif

libcxx/utils/libcxx/test/features.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -293,23 +293,6 @@ def _mingwSupportsModules(cfg):
293293
""",
294294
),
295295
),
296-
# Check for Glibc < 2.36, where there was no support for char8_t functions
297-
Feature(
298-
name="glibc-no-char8_t-support",
299-
when=lambda cfg: "__GLIBC__" in compilerMacros(cfg)
300-
and not sourceBuilds(
301-
cfg,
302-
"""
303-
#include <uchar.h>
304-
#include <wchar.h>
305-
int main(void) {
306-
char8_t c;
307-
mbstate_t s = {0};
308-
return mbrtoc8(&c, "", 0, &s);
309-
}
310-
""",
311-
),
312-
),
313296
Feature(
314297
name="has-unix-headers",
315298
when=lambda cfg: sourceBuilds(

0 commit comments

Comments
 (0)