Skip to content
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

[libc++] Remove workaround which allows setting _LIBCPP_OVERRIDABLE_FUNC_VIS externally #113139

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

philnik777
Copy link
Contributor

@philnik777 philnik777 commented Oct 21, 2024

-fvisibility-global-new-delete has been added in Clang 18, so there is no more need to specify the visibility of new/delete via libc++-internal macros.

Some people used a custom new/delete, which requires them to have default visibility, but didn't want to leak any symbols otherwise. Since the new/delete visibility can now be controlled by a compiler flag, there is no reason to set it with out macro.

https://reviews.llvm.org/D128007 originally tried to remove the option to override the macro, but was partially reverted because people actually set this specific macro.

@philnik777 philnik777 requested a review from a team as a code owner October 21, 2024 09:35
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 21, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 21, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

-fvisibility-global-new-delete has been added in Clang 18, so there is no more need to specify the visibility of new/delete via libc++-internal macros.


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

1 Files Affected:

  • (modified) libcxx/include/__config (+1-5)
diff --git a/libcxx/include/__config b/libcxx/include/__config
index fcba56f7e3d5b1..4155fd33dabc44 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -408,11 +408,7 @@ typedef __char32_t char32_t;
 #    define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")
 #    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")
 #    define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
-
-// TODO: Make this a proper customization point or remove the option to override it.
-#    ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
-#      define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
-#    endif
+#    define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
 
 #    if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
 // The inline should be removed once PR32114 is resolved

@philnik777
Copy link
Contributor Author

CC @rnk

@ldionne
Copy link
Member

ldionne commented Oct 21, 2024

CC @llvm/libcxx-vendors

@philnik777 Can you please add a short explanation of the history of this flag? I think you removed it and that broke a use case, and now it can be removed. What broke when you originally removed it?

@philnik777
Copy link
Contributor Author

CC @llvm/libcxx-vendors

@philnik777 Can you please add a short explanation of the history of this flag? I think you removed it and that broke a use case, and now it can be removed. What broke when you originally removed it?

Some people used a custom new/delete, which requires them to have default visibility, but didn't want to leak any symbols otherwise. Since the new/delete visibility can now be controlled by a compiler flag, there is no reason to set it with out macro.

@rnk
Copy link
Collaborator

rnk commented Oct 23, 2024

I think Louis is asking for more context links, which would be helpful for reviewers and future readers. My best efforts to find the history turned up https://reviews.llvm.org/D129768, but I couldn't find any more useful history on the Chromium side. It looks like Chromium no longer users this macro, but I can't figure out if it ever did or when that changed.

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

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

LGTM, but please make sure to include the explanation for the history of this change in the PR description (i.e. the commit message once landed).

@philnik777 philnik777 merged commit 2e686d6 into llvm:main Oct 24, 2024
64 checks passed
@philnik777 philnik777 deleted the remove_new_delete_workaround branch October 24, 2024 14:11
@frobtech frobtech mentioned this pull request Oct 25, 2024
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