[libcxx-commits] [PATCH] D146397: [libc++] Make bsd_locale_fallbacks.h modular and move it into __support/xlocale

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 30 08:46:29 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/include/CMakeLists.txt:217
   __bit/blsr.h
   __bit/byteswap.h
   __bit/countl.h
----------------
Granularization patches are usually pretty mechanical because the organization of our headers already makes sense. However, the organization in <locale> makes little sense (at least to me). There's clearly some design trying to emerge, but it seems to have grown in weird ways with time. So I think it is worth designing how we want the organization to look like. I suggest:

```
__locale_dir/
    locale_base_api/
        bsd_locale_defaults.h   // 
        bsd_locale_fallbacks.h  // These headers are meant to be included by the per-platform
        locale_guard.h          // shims to provide the BSD-like API that we expect
 
        android.h
        solaris.h
        [...]
        freebsd.h
    locale_base_api.h           // This header would contain an #if-else chain that includes the
                                // appropriate shims for the current platform. It would also document 
                                // what base API a new platform has to support for libc++ to support 
                                // <locale>, which is kind of missing right now.
    scan_keyword.h
    [...]
```

Then, in `<locale>` we would include `<__locale_dir/shims.h>` and we would be guaranteed to have a BSD-like API available.

This patch doesn't have to go all the way, but once we agree on the end organization, I would move stuff around in a way that's consistent with where we want to end up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146397



More information about the libcxx-commits mailing list