[libcxx-commits] [PATCH] D122941: [libc++] Make the Debug mode a configuration-time only option

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 1 22:20:44 PDT 2022


philnik added a comment.

Just as a thought: Do we want to give the debug-enabled library a different name? That way users could use `-stdlib=libc++` for the normal library and `-stdlib=libc++-debug` (or something like that) to build against the debug library. I guess vendors should either ship only a non-debug library or both, since having debug enabled has huge performance implications.

Another thought: Since we don't guarantee ABI-stability for the debug library AFAICT, do we want to enable a few ABI flags? Specifically things like `_LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON` or `_LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION`? These ABI changes don't affect the API, so they shouldn't be observable.



================
Comment at: libcxx/docs/TestingLibcxx.rst:161-167
-.. option:: debug_level=<level>
-
-  **Values**: 0, 1
-
-  Enable the use of debug mode. Level 0 enables assertions and level 1 enables
-  assertions and debugging of iterator misuse.
-
----------------
Is there no way to enable assertions in the tests?


================
Comment at: libcxx/include/__debug:22-24
+#if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE)
+#   error "Enabling the debug mode now requires having configured the library with support for the debug mode"
 #endif
----------------
Maybe we want to add a `#warning` for users who define `_LIBCPP_DEBUG` at all?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122941/new/

https://reviews.llvm.org/D122941



More information about the libcxx-commits mailing list