[all-commits] [llvm/llvm-project] 333255: [libc++][modules] Refactor poisoned_hash_helper (#...

Louis Dionne via All-commits all-commits at lists.llvm.org
Thu Sep 12 12:08:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33325524f5e80a898a7ae875e208a54af132001b
      https://github.com/llvm/llvm-project/commit/33325524f5e80a898a7ae875e208a54af132001b
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2024-09-12 (Thu, 12 Sep 2024)

  Changed paths:
    M libcxx/include/type_traits
    M libcxx/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp
    M libcxx/test/std/diagnostics/syserr/syserr.hash/enabled_hash.pass.cpp
    M libcxx/test/std/experimental/memory/memory.observer.ptr/hash.pass.cpp
    M libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
    M libcxx/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp
    M libcxx/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp
    M libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/enabled_hashes.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
    M libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp
    M libcxx/test/std/utilities/template.bitset/bitset.hash/enabled_hash.pass.cpp
    M libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp
    M libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp
    M libcxx/test/support/poisoned_hash_helper.h
    R libcxx/test/support/test.support/test_poisoned_hash_helper.pass.cpp

  Log Message:
  -----------
  [libc++][modules] Refactor poisoned_hash_helper (#108296)

The poisoned_hash_helper header was relying on an implicit forward
declaration of std::hash located in <type_traits>. When we improve the
modularization of the library, that causes issues, in addition to being
a fundamentally non-portable assumption in the test suite.

It turns out that the reason for relying on a forward declaration is to
be able to test that std::hash is *not* provided if we don't include any
header that provides it. But testing that is actually both non-portable
and not really useful.

Indeed, what harm does it make if additional headers provide std::hash
specializations? That would certainly be conforming -- the Standard
never requires an implementation to avoid providing a declaration when a
given header is included, instead it mandates what *must* be provided
for sure. In that spirit, it would be conforming for e.g. `<cstddef>` to
define the hash specializations if that was our desire. I also don't
read https://wg21.link/P0513R0 as going against that statement. Hence,
this patch just removes that test which doesn't carry its weight.

Fixes #56938



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list