[libcxx-commits] [PATCH] D113133: [libc++] Improve no wide characters configuration.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 4 10:26:43 PDT 2021


Mordante marked an inline comment as done.
Mordante added a comment.

Thanks for the review. I'll give it another CI run before committing.



================
Comment at: libcxx/src/locale.cpp:4546
 
+#ifdef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+static bool is_narrow_non_breaking_space(const char* ptr) {
----------------
Note I could have used an `#else` here. But since this `#ifdef` isn't related to the `#ifndef` above using an `#else` feels wrong.


================
Comment at: libcxx/src/locale.cpp:4588-4594
+static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t __loc) {
+  if (*ptr == '\0')
+    return false;
+  if (!ptr[1]) {
+    dest = *ptr;
+    return true;
+  }
----------------
ldionne wrote:
> This appears to be the same as the `checked_string_to_char_convert ` function above -- could we hoist it out of the `#if` to avoid duplication?
I was doubting between an `#else` in the original function or a copy. I now switched to the `#else` which addresses your issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113133/new/

https://reviews.llvm.org/D113133



More information about the libcxx-commits mailing list