[libcxx-commits] [PATCH] D121123: [libc++] Add a way to enable lightweight assertions independent of the debug mode

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 7 08:05:38 PST 2022


ldionne created this revision.
Herald added subscribers: arichardson, mgorny.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This is a (IMO superior) alternative to https://reviews.llvm.org/D119969.
This patch is more involved than D119969 <https://reviews.llvm.org/D119969>, but it has the benefit of being
cleaner in the long run, especially since we know our current Debug mode
doesn't work -- so perhaps we shouldn't try to reuse too many of its
mechanisms.

In particular, this is better than reusing the existing debug mode because
we now have the ability to set the assertion handler at compile-time,
which means that assertions can be enabled even in code that targets
platforms on which the debug mode support had not been shipped yet.

As-is, this patch provides backwards compatibility with any user that
might have been setting _LIBCPP_DEBUG=0 in order to get basic assertions
in their code. Hence, this patch should be entirely backwards compatible.

However, given that our debug mode has been broken since day 1, I think
we'll need a discussion around either fixing it or removing it, since the
status quo is good for nobody. In particular, an immediate next step to
simplify the library would be to remove `__libcpp_debug_info` and friends.
We can keep the symbols in the dylib to avoid linker errors, but we should
not support two distinct ways of setting an assertion handler.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121123

Files:
  libcxx/CMakeLists.txt
  libcxx/cmake/caches/Generic-assertions.cmake
  libcxx/docs/BuildingLibcxx.rst
  libcxx/docs/ReleaseNotes.rst
  libcxx/docs/UsingLibcxx.rst
  libcxx/include/__assert
  libcxx/include/__availability
  libcxx/include/__config_site.in
  libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.debug.incomplete.abilist
  libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.nodebug.noincomplete.abilist
  libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.debug.incomplete.abilist
  libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.debug.noincomplete.abilist
  libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.nodebug.incomplete.abilist
  libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.debug.incomplete.abilist
  libcxx/src/CMakeLists.txt
  libcxx/src/assert.cpp
  libcxx/src/debug.cpp
  libcxx/test/libcxx/assertion_handler.pass.cpp
  libcxx/utils/libcxx/test/params.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121123.413487.patch
Type: text/x-patch
Size: 24309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220307/38ce6633/attachment-0001.bin>


More information about the libcxx-commits mailing list