Skip to content

[libc++][modules] Add using_if_exists attribute (#77559) #78909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2024
Merged

[libc++][modules] Add using_if_exists attribute (#77559) #78909

merged 1 commit into from
Jan 22, 2024

Conversation

gwllx
Copy link
Contributor

@gwllx gwllx commented Jan 21, 2024

libc on macOS does not provide at_quick_exit or quick_exit. This allows modules to build on macOS and defer any errors to usage site of these symbols.

Fixes: #77559

libc on macOS does not provide at_quick_exit or quick_exit. This allows
modules to build on macOS and defer any errors to usage site of these
symbols.
@gwllx gwllx requested a review from a team as a code owner January 21, 2024 19:45
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 21, 2024
@llvmbot
Copy link
Member

llvmbot commented Jan 21, 2024

@llvm/pr-subscribers-libcxx

Author: Gareth Williamson (gwllx)

Changes

libc on macOS does not provide at_quick_exit or quick_exit. This allows modules to build on macOS and defer any errors to usage site of these symbols.

CC: @mordante


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

1 Files Affected:

  • (modified) libcxx/modules/std.compat/cstdlib.inc (+2-2)
diff --git a/libcxx/modules/std.compat/cstdlib.inc b/libcxx/modules/std.compat/cstdlib.inc
index 9333d848707103..a45a0a1caf8ba9 100644
--- a/libcxx/modules/std.compat/cstdlib.inc
+++ b/libcxx/modules/std.compat/cstdlib.inc
@@ -16,10 +16,10 @@ export {
   // [support.start.term], start and termination
   using ::_Exit;
   using ::abort;
-  using ::at_quick_exit;
+  using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
   using ::atexit;
   using ::exit;
-  using ::quick_exit;
+  using ::quick_exit _LIBCPP_USING_IF_EXISTS;
 
   using ::getenv;
   using ::system;

Copy link
Member

@mordante mordante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for testing and supplying this patch! I expect the CI passes once it does I'll land the patch.

@mordante mordante merged commit 9a90aa0 into llvm:main Jan 22, 2024
@gwllx gwllx deleted the libcxx-modules-77559 branch January 23, 2024 09:24
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.

Try to compile Modules in libc++, failed
4 participants