[libcxx-commits] [PATCH] D118620: [SystemZ][z/OS] Build several exception derived classes as a separate library
Fanbo Meng via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 9 06:34:15 PST 2022
fanbo-meng added inline comments.
================
Comment at: libcxx/include/__config:801-804
+# else
+# define _LIBCPP_BEGIN_NAMESPACE_STD_EXCEPTION _LIBCPP_BEGIN_NAMESPACE_STD
+# define _LIBCPP_END_NAMESPACE_STD_EXCEPTION _LIBCPP_END_NAMESPACE_STD
+# endif
----------------
ldionne wrote:
> It seems to me that we *always* want the namespace for exceptions to be `namespace std` only, without the ABI namespace.
>
> I think it only falls down for `bad_weak_ptr`, which we seem to have defined in `std::__1` instead of `std::`. Is that correct?
That's correct, in our case we want them to have `std::` namespace only so we define `_LIBCPP_BEGIN_NAMESPACE_STD_EXCEPTION` for `bad_weak_ptr `.
For the other three classes they are already using only `std::` namespace, that's why we kept their existing `std::` namespace in the new files to avoid inconsistency.
================
Comment at: libcxx/src/CMakeLists.txt:296
+if (LIBCXX_EXCEPTION_ZOS_BUILD)
+ add_library(cxx_exception SHARED ${exclude_from_all} ${LIBCXX_EXCEPTION_SOURCES} ${LIBCXX_HEADERS})
----------------
ldionne wrote:
> I think there's something greater trying to emerge here. We already define some exception types inside libc++abi in namespace `std`. We should have a consistent approach with all those. In fact, perhaps what we want is to create either a static archive or a shared library with all those exception types, from libc++ and libc++abi. The default configuration would be to statically link that library into libc++, but other configurations could be possible, like leaving it be its own dylib (your use case).
Our initial approach was to move all exception symbols from libc++ to libc++abi, but then we discovered some exception classes have dependencies on libcxx symbols, for example `runtime_error(const string& msg)` requires access to string methods. Therefore they have to be left in libc++ so I don't think it would be possible to move everything into a unified library.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118620/new/
https://reviews.llvm.org/D118620
More information about the libcxx-commits
mailing list