[libcxx-commits] [PATCH] D106848: [libcxx] Don't define exception types with -fno-exceptions

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 26 22:13:14 PDT 2021


phosek created this revision.
phosek added reviewers: ldionne, mstorsjo.
phosek requested review of this revision.
Herald added projects: libc++, libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

When exceptions are disabled, that is when _HAS_EXCEPTIONS=0, the
vcruntime_exception.h header doesn't define the ABI base class
std::exception which breaks the libc++ build.

This change ifdefs out all subclass of exception/error to avoid
this issue. This can be also beneficial on other platforms that
disable exceptions because we don't need to distribute code that's
never going to be used.

For example, on Fuchsia, we ship both variants of libc++ (with and
without exceptions) and select the correct one using the multilib
mechanism. Since the first party code doesn't use exceptions, this
can reduce binary size and this change can help further in addition
to making libc++ usable on Windows with _HAC_EXCEPTIONS=0.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106848

Files:
  libcxx/include/__format/format_error.h
  libcxx/include/filesystem
  libcxx/include/future
  libcxx/include/ios
  libcxx/include/regex
  libcxx/include/stdexcept
  libcxx/include/system_error
  libcxx/src/filesystem/operations.cpp
  libcxx/src/format.cpp
  libcxx/src/future.cpp
  libcxx/src/ios.cpp
  libcxx/src/optional.cpp
  libcxx/src/regex.cpp
  libcxx/src/string.cpp
  libcxx/src/support/runtime/stdexcept_default.ipp
  libcxx/src/system_error.cpp
  libcxxabi/src/stdlib_stdexcept.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106848.361904.patch
Type: text/x-patch
Size: 9795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210727/d3322b52/attachment.bin>


More information about the libcxx-commits mailing list