Skip to content

Commit 1c602f2

Browse files
committed
Simplify preprocessor conditionals in header
1 parent ea4d3ff commit 1c602f2

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

libcxx/include/__text_encoding/te_impl.h

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -525,44 +525,18 @@ struct __te_impl {
525525
}
526526

527527
# if _LIBCPP_HAS_LOCALIZATION
528-
// TODO: Android has <langinfo.h> but not nl_langinfo_l which is required to implement this function.
529-
# if !defined(__ANDROID__)
530-
# if defined(_LIBCPP_WIN32API)
531-
_LIBCPP_HIDDEN static __id __get_win32_acp();
532-
# endif
533528
_LIBCPP_HIDDEN static __te_impl __get_locale_encoding(const char* __name);
534529
_LIBCPP_HIDDEN static __te_impl __get_env_encoding();
530+
# if defined(_LIBCPP_WIN32API)
531+
_LIBCPP_HIDDEN static __id __get_win32_acp();
532+
# endif
535533

536534
[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI static __te_impl __environment();
537535

538536
template <__id _Id>
539537
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static bool __environment_is() {
540538
return __environment() == _Id;
541539
}
542-
543-
# else
544-
_LIBCPP_HIDDEN static __te_impl __get_locale_encoding(const char* __name) = delete;
545-
_LIBCPP_HIDDEN static __te_impl __get_env_encoding() = delete;
546-
547-
[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI static __te_impl __environment();
548-
549-
template <__id _Id>
550-
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static bool __environment_is() {
551-
return false;
552-
}
553-
# endif
554-
555-
# else
556-
557-
# if defined(_LIBCPP_WIN32API)
558-
_LIBCPP_HIDDEN static __id __get_win32_acp() = delete;
559-
# endif
560-
_LIBCPP_HIDDEN static __te_impl __get_locale_encoding(const char* __name) = delete;
561-
_LIBCPP_HIDDEN static __te_impl __get_env_encoding() = delete;
562-
[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI static __te_impl __environment() = delete;
563-
template <__id _Id>
564-
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static bool __environment_is() = delete;
565-
566540
# endif
567541

568542
const __te_data* __encoding_rep_ = __text_encoding_data + 1;

libcxx/src/text_encoding.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ _LIBCPP_HIDDEN __te_impl __te_impl::__get_env_encoding() {
248248
__te_impl __te_impl::__environment() { return __te_impl::__get_env_encoding(); }
249249

250250
#else
251-
// TODO: Android stub which will always return unknown, should be inaccessible from the main text_encoding interface.
251+
252+
// TODO: Stubs for Android that shouldn't be accessible from any public interface.
253+
_LIBCPP_HIDDEN __te_impl __te_impl::__get_locale_encoding(const char* __name [[maybe_unused]]) { return __te_impl(); }
254+
_LIBCPP_HIDDEN __te_impl __te_impl::__get_env_encoding() { return __te_impl(); }
252255
__te_impl __te_impl::__environment() { return __te_impl(); }
253256
#endif
254257
_LIBCPP_END_NAMESPACE_STD

0 commit comments

Comments
 (0)