[all-commits] [llvm/llvm-project] f3966e: [libc++] Make the Debug mode a configuration-time ...

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Jun 7 13:34:14 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f3966eaf869b7bdd9113ab9d5b78469eb0f5f028
      https://github.com/llvm/llvm-project/commit/f3966eaf869b7bdd9113ab9d5b78469eb0f5f028
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M libcxx/CMakeLists.txt
    M libcxx/cmake/caches/Apple.cmake
    R libcxx/cmake/caches/Generic-debug-iterators.cmake
    A libcxx/cmake/caches/Generic-debug-mode.cmake
    R libcxx/cmake/caches/Generic-no-debug.cmake
    M libcxx/docs/DesignDocs/DebugMode.rst
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/docs/TestingLibcxx.rst
    M libcxx/docs/UsingLibcxx.rst
    M libcxx/include/__algorithm/comp_ref_type.h
    M libcxx/include/__algorithm/nth_element.h
    M libcxx/include/__algorithm/partial_sort.h
    M libcxx/include/__algorithm/shuffle.h
    M libcxx/include/__algorithm/sort.h
    M libcxx/include/__algorithm/unwrap_iter.h
    M libcxx/include/__assert
    M libcxx/include/__config
    M libcxx/include/__config_site.in
    M libcxx/include/__debug
    M libcxx/include/__format/buffer.h
    M libcxx/include/__hash_table
    M libcxx/include/__iterator/wrap_iter.h
    M libcxx/include/list
    M libcxx/include/locale
    M libcxx/include/span
    M libcxx/include/string
    M libcxx/include/unordered_map
    M libcxx/include/unordered_set
    M libcxx/include/vector
    M libcxx/lib/abi/CMakeLists.txt
    M libcxx/src/CMakeLists.txt
    M libcxx/test/CMakeLists.txt
    M libcxx/test/libcxx/algorithms/alg.modifying.operations/copy.pass.cpp
    M libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
    M libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
    M libcxx/test/libcxx/algorithms/debug_less.inconsistent.pass.cpp
    M libcxx/test/libcxx/algorithms/debug_less.pass.cpp
    M libcxx/test/libcxx/algorithms/nth_element_stability.pass.cpp
    M libcxx/test/libcxx/algorithms/partial_sort_stability.pass.cpp
    M libcxx/test/libcxx/algorithms/sort_stability.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
    M libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/debug.iterator.add.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/debug.iterator.compare.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/debug.iterator.decrement.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/debug.iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/debug.iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/debug.iterator.index.pass.cpp
    M libcxx/test/libcxx/containers/sequences/vector/debug.iterator.subtract.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp
    M libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
    M libcxx/test/libcxx/debug/containers.multithread.pass.cpp
    M libcxx/test/libcxx/debug/containers/associative_containers.pass.cpp
    M libcxx/test/libcxx/debug/containers/sequence_container_iterators.pass.cpp
    M libcxx/test/libcxx/debug/containers/string.pass.cpp
    M libcxx/test/libcxx/debug/containers/unord_containers.pass.cpp
    A libcxx/test/libcxx/debug/debug.assertions-enabled.compile.pass.cpp
    A libcxx/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp
    M libcxx/test/libcxx/debug/extern-templates.sh.cpp
    M libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp
    M libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.add.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.decrement.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.dereference.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.increment.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.index.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp
    M libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
    M libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
    M libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
    M libcxx/test/support/container_debug_tests.h
    M libcxx/utils/ci/buildkite-pipeline.yml
    M libcxx/utils/ci/run-buildbot
    M libcxx/utils/libcxx/test/features.py
    M libcxx/utils/libcxx/test/params.py

  Log Message:
  -----------
  [libc++] Make the Debug mode a configuration-time only option

The debug mode has been broken pretty much ever since it was shipped
because it was possible to enable the debug mode in user code without
actually enabling it in the dylib, leading to ODR violations that
caused various kinds of failures.

This commit makes the debug mode a knob that is configured when
building the library and which can't be changed afterwards. This is
less flexible for users, however it will actually work as intended
and it will allow us, in the future, to add various kinds of checks
that do not assume the same ABI as the normal library. Furthermore,
this will make the debug mode more robust, which means that vendors
might be more tempted to support it properly, which hasn't been the
case with the current debug mode.

This patch shouldn't break any user code, except folks who are building
against a library that doesn't have the debug mode enabled and who try
to enable the debug mode in their code. Such users will get a compile-time
error explaining that this configuration isn't supported anymore.

In the future, we should further increase the granularity of the debug
mode checks so that we can cherry-pick which checks to enable, like we
do for unspecified behavior randomization.

Differential Revision: https://reviews.llvm.org/D122941




More information about the All-commits mailing list