|
10 | 10 | #define LLVM_LIBC_SRC___SUPPORT_WCTYPE_UTILS_H |
11 | 11 |
|
12 | 12 | #include "hdr/types/wchar_t.h" |
13 | | -#include "hdr/types/wint_t.h" |
14 | | -#include "src/__support/CPP/optional.h" |
15 | 13 | #include "src/__support/macros/attributes.h" // LIBC_INLINE |
16 | 14 | #include "src/__support/macros/config.h" |
17 | 15 |
|
@@ -584,30 +582,6 @@ is_char_or_wchar(wchar_t ch, [[maybe_unused]] char, wchar_t wc_value) { |
584 | 582 | return (ch == wc_value); |
585 | 583 | } |
586 | 584 |
|
587 | | -// ------------------------------------------------------ |
588 | | -// Rationale: Since these classification functions are |
589 | | -// called in other functions, we will avoid the overhead |
590 | | -// of a function call by inlining them. |
591 | | -// ------------------------------------------------------ |
592 | | - |
593 | | -LIBC_INLINE cpp::optional<int> wctob(wint_t c) { |
594 | | - // This needs to be translated to EOF at the callsite. This is to avoid |
595 | | - // including stdio.h in this file. |
596 | | - // The standard states that wint_t may either be an alias of wchar_t or |
597 | | - // an alias of an integer type, different platforms define this type with |
598 | | - // different signedness. This is equivalent to `(c > 127) || (c < 0)` but also |
599 | | - // works without -Wtype-limits warnings when `wint_t` is unsigned. |
600 | | - if ((c & ~127) != 0) |
601 | | - return cpp::nullopt; |
602 | | - return static_cast<int>(c); |
603 | | -} |
604 | | - |
605 | | -LIBC_INLINE cpp::optional<wint_t> btowc(int c) { |
606 | | - if (c > 127 || c < 0) |
607 | | - return cpp::nullopt; |
608 | | - return static_cast<wint_t>(c); |
609 | | -} |
610 | | - |
611 | 585 | } // namespace internal |
612 | 586 | } // namespace LIBC_NAMESPACE_DECL |
613 | 587 |
|
|
0 commit comments