[libcxx-commits] [PATCH] D111265: [libc++] Add an option to disable wide character support in libc++

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 13 10:33:10 PDT 2021


Mordante added inline comments.


================
Comment at: libcxx/include/wchar.h:113
+#   error "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
+#endif
+
----------------
Quuxplusone wrote:
> thakis wrote:
> > """
> > I know it's not my job to judge, but these lines might lead to unnecessary problems:
> > I assume there's quite a few build scripts that look at this and say, "hey, I've got wchar.h, why not include it"
> > ... this is not just an assumption. libc++ does the same thing with locale.h and ncurses's c++ example files greedily include it if they find it
> > """
> +1 in that this is also inconsistent with how we treat `#include <ranges>` in pre-C++20 modes, and so on. For better or worse, the precedent is pretty consistently "when a header isn't supported, including it should be a no-op."
I know we discussed this for the incomplete ranges and format header and decided not to do an error.

However there are more CMake options that turn including a specific header in an error. For example when disabling `_LIBCPP_HAS_NO_LOCALIZATION` including `locale.h` will result in an error. I don't have a strong opinion on whether or not we should remove the `#error` in `wchar.h`, but if we remove it I think we should evaluate the other `#error`s in libc++.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111265



More information about the libcxx-commits mailing list