Commit Graph

3 Commits

Author SHA1 Message Date
Robert Schulze
23fcefadc8
... re-enable only the assertions (not full debug mode) 2024-10-15 21:37:39 +00:00
Robert Schulze
b9b7a1091b
(Re)-enable libcxx debug mode
- We previously compiled libcxx with _LIBCPP_DEBUG=0. In old libcxx
  versions, this (surprisingly) enabled the basic debug mode [1].

- In libcxx 15 (the version we are currently using), _LIBCPP_DEBUG=0
  does nothing [2], the replacement is _LIBCPP_ENABLE_DEBUG_MODE=1.

- The debug mode is only enabled in Debug builds. Their docs say the
  extra check change complexity guarantees + the asserts crash which we
  don't want in Release builds. The debug mode detects issues like in
  [3]. Crashes look like this (for example)

  ```
  /data/ch/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h:99: assertion ::std::__libcpp_is_constant_evaluated() || (__get_const_db()->__dereferenceable(this)) failed: Attempted to increment a non-incrementable iteratorAborted (core dumped)
  ```

- I had to mute some new clang-tidy warnings in places that deal with
  container iterators. They got heavier and copy-by-value now yields a
  warning, e.g.

     for (auto it : iterators) /// <-- warning
         [...]

[1] https://releases.llvm.org/12.0.0/projects/libcxx/docs/DesignDocs/DebugMode.html
[2] https://releases.llvm.org/15.0.0/projects/libcxx/docs/DesignDocs/DebugMode.html
[3] https://github.com/llvm/llvm-project/blob/main/libcxx/test/support/container_debug_tests.h
2024-10-15 13:46:07 +00:00
Azat Khuzhin
3e5ad1a138 Move cmake/find/cxx.cmake -> cmake/cxx.cmake
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-31 16:01:11 +03:00