[libcxx-commits] [libcxx] [libc++] Remove a few incorrect _LIBCPP_EXPORTED_FROM_ABI annotations (PR #132602)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 23 04:55:36 PDT 2025


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/132602

>From 74f2fa2a5404183a244ac6540fcb2f4e50cc140d Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sun, 23 Mar 2025 10:09:38 +0100
Subject: [PATCH] [libc++] Remove a few incorrect _LIBCPP_EXPORTED_FROM_ABI
 annotations

---
 libcxx/docs/DesignDocs/VisibilityMacros.rst     | 4 +++-
 libcxx/include/__charconv/from_chars_result.h   | 2 +-
 libcxx/include/__charconv/to_chars_result.h     | 2 +-
 libcxx/include/__filesystem/file_status.h       | 2 +-
 libcxx/include/__filesystem/path.h              | 2 +-
 libcxx/include/__filesystem/space_info.h        | 2 +-
 libcxx/include/__format/formatter_output.h      | 2 +-
 libcxx/include/__memory_resource/pool_options.h | 2 +-
 libcxx/include/__mutex/tag_types.h              | 6 +++---
 libcxx/include/__new/nothrow_t.h                | 2 +-
 libcxx/include/__system_error/error_category.h  | 2 +-
 libcxx/include/__thread/id.h                    | 2 +-
 libcxx/include/__tuple/sfinae_helpers.h         | 2 +-
 libcxx/include/__utility/in_place.h             | 2 +-
 14 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/libcxx/docs/DesignDocs/VisibilityMacros.rst b/libcxx/docs/DesignDocs/VisibilityMacros.rst
index e9f88118b7ef3..f71ab314d5f55 100644
--- a/libcxx/docs/DesignDocs/VisibilityMacros.rst
+++ b/libcxx/docs/DesignDocs/VisibilityMacros.rst
@@ -31,7 +31,9 @@ Visibility Macros
   Mark a symbol as being part of our ABI. This includes functions that are part
   of the libc++ library, type information and other symbols. On Windows,
   this macro applies `dllimport`/`dllexport` to the symbol, and on other
-  platforms it gives the symbol default visibility.
+  platforms it gives the symbol default visibility. This macro should never be
+  used on class templates. On classes it should only be used if the vtable
+  should be in the shared library.
 
 **_LIBCPP_OVERRIDABLE_FUNC_VIS**
   Mark a symbol as being exported by the libc++ library, but allow it to be
diff --git a/libcxx/include/__charconv/from_chars_result.h b/libcxx/include/__charconv/from_chars_result.h
index a7bfd6530a8a0..b4ecea3d11451 100644
--- a/libcxx/include/__charconv/from_chars_result.h
+++ b/libcxx/include/__charconv/from_chars_result.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if _LIBCPP_STD_VER >= 17
 
-struct _LIBCPP_EXPORTED_FROM_ABI from_chars_result {
+struct from_chars_result {
   const char* ptr;
   errc ec;
 #  if _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__charconv/to_chars_result.h b/libcxx/include/__charconv/to_chars_result.h
index 41dea4ab14723..a3cd4e28d0175 100644
--- a/libcxx/include/__charconv/to_chars_result.h
+++ b/libcxx/include/__charconv/to_chars_result.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if _LIBCPP_STD_VER >= 17
 
-struct _LIBCPP_EXPORTED_FROM_ABI to_chars_result {
+struct to_chars_result {
   char* ptr;
   errc ec;
 #  if _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__filesystem/file_status.h b/libcxx/include/__filesystem/file_status.h
index da316c8b02746..eecaf3c492f03 100644
--- a/libcxx/include/__filesystem/file_status.h
+++ b/libcxx/include/__filesystem/file_status.h
@@ -22,7 +22,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-class _LIBCPP_EXPORTED_FROM_ABI file_status {
+class file_status {
 public:
   // constructors
   _LIBCPP_HIDE_FROM_ABI file_status() noexcept : file_status(file_type::none) {}
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index 381e5678a5855..7f5121020275e 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -861,7 +861,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
   }
 
   // iterators
-  class _LIBCPP_EXPORTED_FROM_ABI iterator;
+  class iterator;
   typedef iterator const_iterator;
 
   iterator begin() const;
diff --git a/libcxx/include/__filesystem/space_info.h b/libcxx/include/__filesystem/space_info.h
index 3fa57d33096fc..28f7ced40d27d 100644
--- a/libcxx/include/__filesystem/space_info.h
+++ b/libcxx/include/__filesystem/space_info.h
@@ -21,7 +21,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-struct _LIBCPP_EXPORTED_FROM_ABI space_info {
+struct space_info {
   uintmax_t capacity;
   uintmax_t free;
   uintmax_t available;
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index cc74e3858a401..d53b6cec707d8 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -45,7 +45,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace __formatter {
 
-struct _LIBCPP_EXPORTED_FROM_ABI __padding_size_result {
+struct __padding_size_result {
   size_t __before_;
   size_t __after_;
 };
diff --git a/libcxx/include/__memory_resource/pool_options.h b/libcxx/include/__memory_resource/pool_options.h
index 324b8aaa8502b..fd20ced56795f 100644
--- a/libcxx/include/__memory_resource/pool_options.h
+++ b/libcxx/include/__memory_resource/pool_options.h
@@ -24,7 +24,7 @@ namespace pmr {
 
 // [mem.res.pool.options]
 
-struct _LIBCPP_EXPORTED_FROM_ABI pool_options {
+struct pool_options {
   size_t max_blocks_per_chunk        = 0;
   size_t largest_required_pool_block = 0;
 };
diff --git a/libcxx/include/__mutex/tag_types.h b/libcxx/include/__mutex/tag_types.h
index 2b2dd58ee4e80..36b1a3d92b14e 100644
--- a/libcxx/include/__mutex/tag_types.h
+++ b/libcxx/include/__mutex/tag_types.h
@@ -17,15 +17,15 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-struct _LIBCPP_EXPORTED_FROM_ABI defer_lock_t {
+struct defer_lock_t {
   explicit defer_lock_t() = default;
 };
 
-struct _LIBCPP_EXPORTED_FROM_ABI try_to_lock_t {
+struct try_to_lock_t {
   explicit try_to_lock_t() = default;
 };
 
-struct _LIBCPP_EXPORTED_FROM_ABI adopt_lock_t {
+struct adopt_lock_t {
   explicit adopt_lock_t() = default;
 };
 
diff --git a/libcxx/include/__new/nothrow_t.h b/libcxx/include/__new/nothrow_t.h
index a286bf7af628f..a099772123934 100644
--- a/libcxx/include/__new/nothrow_t.h
+++ b/libcxx/include/__new/nothrow_t.h
@@ -19,7 +19,7 @@
 #  include <new.h>
 #else
 _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
-struct _LIBCPP_EXPORTED_FROM_ABI nothrow_t {
+struct nothrow_t {
   explicit nothrow_t() = default;
 };
 extern _LIBCPP_EXPORTED_FROM_ABI const nothrow_t nothrow;
diff --git a/libcxx/include/__system_error/error_category.h b/libcxx/include/__system_error/error_category.h
index 7233e22110447..191f4d83a90c0 100644
--- a/libcxx/include/__system_error/error_category.h
+++ b/libcxx/include/__system_error/error_category.h
@@ -20,7 +20,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-class _LIBCPP_EXPORTED_FROM_ABI error_condition;
+class error_condition;
 class _LIBCPP_EXPORTED_FROM_ABI error_code;
 
 class _LIBCPP_HIDDEN __do_message;
diff --git a/libcxx/include/__thread/id.h b/libcxx/include/__thread/id.h
index c9c86c80c8599..14a51fc9ee880 100644
--- a/libcxx/include/__thread/id.h
+++ b/libcxx/include/__thread/id.h
@@ -23,7 +23,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if _LIBCPP_HAS_THREADS
-class _LIBCPP_EXPORTED_FROM_ABI __thread_id;
+class __thread_id;
 
 namespace this_thread {
 
diff --git a/libcxx/include/__tuple/sfinae_helpers.h b/libcxx/include/__tuple/sfinae_helpers.h
index 9fe5e84e2f3ca..bd8fb3a915c82 100644
--- a/libcxx/include/__tuple/sfinae_helpers.h
+++ b/libcxx/include/__tuple/sfinae_helpers.h
@@ -62,7 +62,7 @@ struct tuple_element<_Ip, tuple<_Tp...> > {
   using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, __tuple_types<_Tp...> >::type;
 };
 
-struct _LIBCPP_EXPORTED_FROM_ABI __check_tuple_constructor_fail {
+struct __check_tuple_constructor_fail {
   static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; }
   static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; }
   template <class...>
diff --git a/libcxx/include/__utility/in_place.h b/libcxx/include/__utility/in_place.h
index ade4b6685a116..c5bfa947058fb 100644
--- a/libcxx/include/__utility/in_place.h
+++ b/libcxx/include/__utility/in_place.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if _LIBCPP_STD_VER >= 17
 
-struct _LIBCPP_EXPORTED_FROM_ABI in_place_t {
+struct in_place_t {
   explicit in_place_t() = default;
 };
 inline constexpr in_place_t in_place{};



More information about the libcxx-commits mailing list