[libcxx-commits] [PATCH] D158823: [libc++][hardening] Add back the safe mode.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 28 07:44:52 PDT 2023
ldionne added inline comments.
================
Comment at: libcxx/docs/Hardening.rst:58
+in libc++ is in the headers, so the user-selected value for
+``_LIBCPP_ENABLE_HARDENED_MODE`` (or ``_LIBCPP_ENABLE_HARDENED_MODE``, or
+``_LIBCPP_ENABLE_DEBUG_MODE``), if any, will usually be respected.
----------------
================
Comment at: libcxx/docs/ReleaseNotes/17.rst:112
enabled on a per translation unit basis using the ``-D_LIBCPP_ENABLE_HARDENED_MODE=1`` macro. See
``libcxx/docs/Hardening.rst`` for more details.
----------------
We should replace all these references to `libcxx/docs/Hardening.rst` by an internal link to the rst page so that people can actually click on it.
================
Comment at: libcxx/docs/ReleaseNotes/17.rst:120
+
- The library now provides a debug mode which is a superset of the hardened mode, additionally enabling more expensive
checks that are not suitable to be used in production. This replaces the legacy debug mode that was removed in this
----------------
================
Comment at: libcxx/docs/ReleaseNotes/17.rst:137-140
- The "safe" mode is replaced by the hardened mode in this release. The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable is
deprecated and setting it will trigger an error; use ``LIBCXX_HARDENING_MODE`` instead. Similarly, the
``_LIBCPP_ENABLE_ASSERTIONS`` macro is deprecated and setting it to ``1`` now enables the hardened mode. See
``libcxx/docs/Hardening.rst`` for more details.
----------------
================
Comment at: libcxx/include/__config:287-289
+# if (_LIBCPP_ENABLE_HARDENED_MODE && _LIBCPP_ENABLE_SAFE_MODE) || \
+ (_LIBCPP_ENABLE_HARDENED_MODE && _LIBCPP_ENABLE_DEBUG_MODE) || \
+ (_LIBCPP_ENABLE_SAFE_MODE && _LIBCPP_ENABLE_DEBUG_MODE)
----------------
No strong preference, but we could also do `#if HARDENED_MODE + SAFE_MODE + DEBUG_MODE > 1`.
================
Comment at: libcxx/test/libcxx/assertions/modes/debug_mode_disabled_in_tu.pass.cpp:11
-// UNSUPPORTED: libcpp-hardening-mode=hardened
+// REQUIRES: libcpp-hardening-mode=unchecked || libcpp-hardening-mode=debug
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_DEBUG_MODE=0
----------------
I don't really understand this `REQUIRES` anymore. Can you explain?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158823/new/
https://reviews.llvm.org/D158823
More information about the libcxx-commits
mailing list