[libcxx-commits] [libcxx] [libc++][hardening] Enable comparator checks for safe mode too (PR #66458)

Jordan Rupprecht via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 15 10:33:21 PDT 2023


rupprecht wrote:

@nico or @zmodem, do you have any input on whether this would affect Chromium's use of this build mode?

> Is there a reason why you want these (very expensive) checks enabled in production?

I don't think we're using this in production -- IIUC we only use the hardening subset of checks there. But for certain test modes, we're using this as a set of "extra asserts as long as they don't make the test timeout" type of build mode. In practice for us it seems that the extra runtime from more comparisons is not significant enough to notice a difference.

If adding this to safe mode by default is not desired, could we make this a separate knob defaulting to debug mode but allows us to still override it? e.g.

```c++
#ifndef _LIBCPP_ENABLE_DEBUG_LESS_CHECK
#  define _LIBCPP_ENABLE_DEBUG_LESS_CHECK _LIBCPP_ENABLE_DEBUG_MODE
#endif
```

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


More information about the libcxx-commits mailing list