Page MenuHomePhabricator

Add std::hash<char8_t> specialization if char8_t is enabled
ClosedPublic

Authored by georgthegreat on Nov 30 2020, 7:45 AM.

Details

Summary

Use _LIBCPP_NO_HAS_CHAR8_T to test if template should be specialized.

Diff Detail

Unit TestsFailed

TimeTest
1,250 mslibcxx CI -fno-exceptions > libc++.libcxx/extensions/hash::specializations.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++ /home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/libcxx/test/libcxx/extensions/hash/specializations.pass.cpp -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/build/generic-noexceptions/projects/libcxx/__config_site -include /home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/libcxx/include -I/home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/build/generic-noexceptions/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2a -fno-exceptions -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules-cache-path=/home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/build/generic-noexceptions/projects/libcxx/test/libcxx/extensions/hash/Output/specializations.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -L/home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/build/generic-noexceptions/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/31ae3d62404c-1/llvm-project/libcxx-ci/build/generic-noexceptions/./lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic…
1,150 mslibcxx CI ASAN > libc++.libcxx/extensions/hash::specializations.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++ /home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/libcxx/test/libcxx/extensions/hash/specializations.pass.cpp -v --target=x86_64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=address -include /home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/build/generic-asan/projects/libcxx/__config_site -include /home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/libcxx/include -I/home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/build/generic-asan/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -O1 -std=c++2a -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules-cache-path=/home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/build/generic-asan/projects/libcxx/test/libcxx/extensions/hash/Output/specializations.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -L/home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/build/generic-asan/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/7c8046f1aaf0-1/llvm-project/libcxx-ci/build/generic-asan/./lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic -lpthread -lrt…
1,290 mslibcxx CI Apple back-deployment macosx10.9 > libc++.libcxx/extensions/hash::specializations.pass.cpp
Script: -- : 'COMPILED WITH'; /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ /private/tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/libcxx/test/libcxx/extensions/hash/specializations.pass.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -v --target=x86_64-apple-macosx10.9 -include /tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-backdeployment-10.9/projects/libcxx/__config_site -include /tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/libcxx/include -I/tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-backdeployment-10.9/projects/libcxx/include/c++build -I/tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2a -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules-cache-path=/private/tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-backdeployment-10.9/projects/libcxx/test/libcxx/extensions/hash/Output/specializations.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -L/tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-backdeployment-10.9/./lib -Wl,-rpath,/private/tmp/buildkite-builds/ldionne-13-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-backdeployment-10.9/macos-roots/macOS/libc++/10.9 -L/private/tmp/buildkite-builds/ldionne-13-local…
810 mslibcxx CI Apple system > libc++.libcxx/extensions/hash::specializations.pass.cpp
Script: -- : 'COMPILED WITH'; /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ /private/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/test/libcxx/extensions/hash/specializations.pass.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -v --target=x86_64-apple-darwin19.6.0 -include /tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system/projects/libcxx/__config_site -include /tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/include -I/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system/projects/libcxx/include/c++build -I/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2a -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules-cache-path=/private/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system/projects/libcxx/test/libcxx/extensions/hash/Output/specializations.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -L/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system/./lib -Wl,-rpath,/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system/./lib -nodefaultlibs -lc++ -lSystem -o /private/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm…
810 mslibcxx CI Apple system -fno-exceptions > libc++.libcxx/extensions/hash::specializations.pass.cpp
Script: -- : 'COMPILED WITH'; /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ /private/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/test/libcxx/extensions/hash/specializations.pass.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -v --target=x86_64-apple-darwin19.6.0 -include /tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-noexceptions/projects/libcxx/__config_site -include /tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/include -I/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-noexceptions/projects/libcxx/include/c++build -I/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2a -fno-exceptions -Werror -Wall -Wextra -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -fmodules-cache-path=/private/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-noexceptions/projects/libcxx/test/libcxx/extensions/hash/Output/specializations.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -L/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-noexceptions/./lib -Wl,-rpath,/tmp/buildkite-agent/builds/libcxx-mbp-local-1/llvm-project/libcxx-ci/build/x86_64-apple-system-noexceptions/./lib -nodefaultlibs…
View Full Test Results (15 Failed)

Event Timeline

georgthegreat created this revision.Nov 30 2020, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2020, 7:45 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
georgthegreat requested review of this revision.Nov 30 2020, 7:45 AM
mclow.lists added inline comments.Nov 30 2020, 8:12 AM
libcxx/include/utility
1367

I think this should be #ifndef _LIBCPP_NO_HAS_CHAR8_T

libcxx/test/libcxx/extensions/hash/specializations.pass.cpp
26

Here too.

georgthegreat added a comment.EditedNov 30 2020, 8:19 AM

There is a chance that _LIBCPP_NO_HAS_CHAR8_T should be removed in the course of https://reviews.llvm.org/D92212

Could you please, take a look and share you thoughts?

Commented there.
For the record, the link is https://reviews.llvm.org/D92212 (without the trailing slash.
Alternately, you can just write D92212 and Phab will figure it out.

Use libc++-specific macro to rest if hashing should be enabled.

Continue using standard defined macro in tests.

georgthegreat added inline comments.Dec 1 2020, 2:13 AM
libcxx/test/libcxx/extensions/hash/specializations.pass.cpp
26

I think test (due to being a library client) should continue checking the flag defined by the standard __cpp_lib_char8_t.

I have fixed it to check the value of the macro,

georgthegreat planned changes to this revision.Dec 1 2020, 12:49 PM

I am waiting for D92212 to land, then I will rebase the diff to make it consistent with the changes proposed by @ldionne.

mclow.lists added inline comments.Dec 2 2020, 9:17 AM
libcxx/test/libcxx/extensions/hash/specializations.pass.cpp
26

Since the test is libc++-specific (it's in the test/libcxx hierarchy, as opposed to test/std), it *could* use _LIBCPP_NO_HAS_CHAR8_T. However, this is fine.

ldionne accepted this revision.Dec 3 2020, 9:39 AM

We can still proceed with this even though we're keeping _LIBCPP_NO_HAS_CHAR8_T.

This LGTM.

ldionne set the repository for this revision to rG LLVM Github Monorepo.Dec 3 2020, 9:40 AM

@georgthegreat Can you please rebase and resubmit, that will trigger CI.

georgthegreat edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Dec 3 2020, 11:30 AM
georgthegreat marked 3 inline comments as done.Dec 3 2020, 11:30 AM
ldionne accepted this revision.Dec 3 2020, 11:31 AM

Let's wait for CI to complete, and if it pass, you're good to commit this. Thanks!

The attempt to test std::hash via _gnu_cxx was just wrong.
I can not find any place to put individual hash tests anywhere, so I am removing the test completely.

The final revision is buildable and can be merged.
@ldionne, could you merge it?