[libcxx-commits] [libcxx] [libc++][hardening] Rework macros for enabling the hardening mode. (PR #70575)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Sat Oct 28 14:45:53 PDT 2023


================
@@ -269,38 +272,32 @@
 //
 // - `_LIBCPP_ASSERT_UNCATEGORIZED` -- for assertions that haven't been properly classified yet.
 
-#  ifndef _LIBCPP_ENABLE_HARDENED_MODE
-#    define _LIBCPP_ENABLE_HARDENED_MODE _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT
-#  endif
-#  if _LIBCPP_ENABLE_HARDENED_MODE != 0 && _LIBCPP_ENABLE_HARDENED_MODE != 1
-#    error "_LIBCPP_ENABLE_HARDENED_MODE must be set to 0 or 1."
-#  endif
-
-#  ifndef _LIBCPP_ENABLE_SAFE_MODE
-#    define _LIBCPP_ENABLE_SAFE_MODE _LIBCPP_ENABLE_SAFE_MODE_DEFAULT
-#  endif
-#  if _LIBCPP_ENABLE_SAFE_MODE != 0 && _LIBCPP_ENABLE_SAFE_MODE != 1
-#    error "_LIBCPP_ENABLE_SAFE_MODE must be set to 0 or 1."
-#  endif
+// clang-format off
+#  define _LIBCPP_HARDENING_MODE_UNCHECKED  (1 << 1)
----------------
var-const wrote:

An interesting question is whether we want `_LIBCPP_HARDENING_MODE_UNCHECKED` to have a non-zero value.

https://github.com/llvm/llvm-project/pull/70575


More information about the libcxx-commits mailing list