Skip to content

Conversation

@izaakschroeder
Copy link
Contributor

@izaakschroeder izaakschroeder commented Jul 3, 2024

libcxx companion to #97494 and #97191

More or less adds __LLVM_LIBC__ in the same places as __Fuchsia__ as fuchsia itself relies on parts of LLVM libc this seems like the most reasonable choice.

@izaakschroeder izaakschroeder requested a review from a team as a code owner July 3, 2024 03:08
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jul 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 3, 2024

@llvm/pr-subscribers-libcxx

Author: Izaak Schroeder (izaakschroeder)

Changes

libcxx companion to #97494 and #97191


Full diff: https://github.com/llvm/llvm-project/pull/97508.diff

3 Files Affected:

  • (modified) libcxx/include/__config (+1-1)
  • (modified) libcxx/include/locale (+1-1)
  • (modified) libcxx/src/locale.cpp (+1-1)
diff --git a/libcxx/include/__config b/libcxx/include/__config
index dfb14fd6a380c..f3dbb8079a1e8 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -914,7 +914,7 @@ typedef __char32_t char32_t;
 #  endif
 
 #  if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) ||                        \
-      defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
+      defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) || defined(__LLVM_LIBC__)
 #    define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #  endif
 
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 19e81e110b69c..46318683b3cef 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -217,7 +217,7 @@ template <class charT> class messages_byname;
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
 // Most unix variants have catopen.  These are the specific ones that don't.
-#  if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__)
+#  if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) && !defined(__LLVM_LIBC__)
 #    define _LIBCPP_HAS_CATOPEN 1
 #    include <nl_types.h>
 #  endif
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 4efdc63c09661..d114640ab7104 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -34,7 +34,7 @@
 #  define _CTYPE_DISABLE_MACROS
 #endif
 
-#if !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) && !defined(__BIONIC__) && !defined(__NuttX__)
+#if !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) && !defined(__BIONIC__) && !defined(__NuttX__)  && !defined(__LLVM_LIBC__)
 #  include <langinfo.h>
 #endif
 

@izaakschroeder izaakschroeder mentioned this pull request Jul 3, 2024
39 tasks
@github-actions
Copy link

github-actions bot commented Jul 3, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@philnik777
Copy link
Contributor

Since we plan to have a CI for the LLVM libc and libc++, I'd rather first tackle that instead. As far as I'm aware the only way to get libc + libc++ actually working right now is with some hackery.

@izaakschroeder
Copy link
Contributor Author

izaakschroeder commented Jul 3, 2024

@philnik777 libc + libc++ isn't toooooo bad depending on what flags you want to turn on… if you look at #97191 there's pretty comprehensive documentation about what's required 😄 Is there a plan you'd like for CI to test the various permutations of LIBCXX_ENABLE_*? If so, what is that plan and how can I align with what it is?

@philnik777
Copy link
Contributor

@philnik777 libc + libc++ isn't toooooo bad depending on what flags you want to turn on… if you look at #97191 there's pretty comprehensive documentation about what's required 😄 Is there a plan you'd like for CI to test the various permutations of LIBCXX_ENABLE_*? If so, what is that plan and how can I align with what it is?

There are a few configurations I'd like to have in the CI with the LLVM libc, but the main one is "whatever works". Just so we have a baseline of what's already working and a starting point from where to continue. Any other configurations would be primarily to better test the various configurations libc++ supports.

@izaakschroeder
Copy link
Contributor Author

There are a few configurations I'd like to have in the CI with the LLVM libc, but the main one is "whatever works".

@philnik777 Anything you want from me to help this along? The Dockerfile in that other issue is a pretty reproducible way to build libc + libc++ but I don't know much of LLVMs CI setup.

@ldionne
Copy link
Member

ldionne commented Nov 28, 2024

I think this can be closed since it has been landed in smaller bits. I do want Fuchsia to setup pre-commit CI bots since they are using LLVM libc and that's necessary for us to officially support that configuration, but I reached out to @petrhosek about that separately.

@ldionne ldionne closed this Nov 28, 2024
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Aug 18, 2025
This patch enables building libcxx with LIBCXX_ENABLE_LOCALIZATION=ON
when building against LLVM libc.

This finishes up llvm#97508.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants