This is an archive of the discontinued LLVM Phabricator instance.

[libc++] [test] Remove epicyclic workarounds for vector/span; use T[] or std::array
ClosedPublic

Authored by Quuxplusone on Apr 20 2021, 11:42 AM.

Details

Summary

Simplify the test code, and drive-by also test that these algorithms return the right iterator as their return value.

This came, obliquely, out of D100866. Fixing this test now will remove the dependency on <span>, which means I won't have to mark it XFAILed in debug mode because it no longer fails.

Diff Detail

Event Timeline

Quuxplusone requested review of this revision.Apr 20 2021, 11:42 AM
Quuxplusone created this revision.
Herald added a reviewer: Restricted Project. · View Herald TranscriptApr 20 2021, 11:42 AM
ldionne accepted this revision.Apr 20 2021, 11:45 AM

LGTM. I should really have requested that we go down that route in https://reviews.llvm.org/D90569 instead of adding a FIXME. I think this is better.

This revision is now accepted and ready to land.Apr 20 2021, 11:45 AM
zoecarver accepted this revision.Apr 20 2021, 11:47 AM

This LGTM. Thanks for the cleanup!

(Feel free to approve as libc++ yourself, then land it!)

Oh, I guess Louis beat me to it :)

My automatically bisecting cron job identified this commit as the source of a regression on Fedora 34 (x86-64). It seems like a few dozen libc++ tests are now failing with errors like this:

FAIL: libc++ :: std/utilities/optional/iterator_concept_conformance.compile.pass.cpp (76809 of 82588)
******************** TEST 'libc++ :: std/utilities/optional/iterator_concept_conformance.compile.pass.cpp' FAILED ********************
Script:
--
: 'COMPILED WITH';  /usr/bin/clang++ /home/dave/ro_s/lp/libcxx/test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp -v --target=x86_64-unknown-linux-gnu -include /home/dave/ro_s/lp/libcxx/test/support/nasty_macros.h -nostdinc++ -I/tmp/_update_lc/r/include/c++/v1 -I/tmp/_update_lc/r/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/dave/ro_s/lp/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -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=/tmp/_update_lc/r/projects/libcxx/test/std/utilities/optional/Output/iterator_concept_conformance.compile.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1  -fsyntax-only
--
Exit Code: 1

Command Output (stderr):
--
clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/11
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/11
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 (in-process)
 "/usr/bin/clang-12" -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name iterator_concept_conformance.compile.pass.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -v -nostdinc++ -resource-dir /usr/lib64/clang/12.0.0 -include /home/dave/ro_s/lp/libcxx/test/support/nasty_macros.h -I /tmp/_update_lc/r/include/c++/v1 -I /tmp/_update_lc/r/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/dave/ro_s/lp/libcxx/test/support -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D _LIBCPP_DISABLE_AVAILABILITY -D _LIBCPP_HAS_THREAD_API_PTHREAD -D _LIBCPP_ABI_VERSION=1 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror -Wall -Wextra -Wshadow -Wundef -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 -Werror=thread-safety -Wuser-defined-warnings -Wno-macro-redefined -Wno-macro-redefined -std=c++2b -fdeprecated-macro -fdebug-compilation-dir /tmp/_update_lc/r/projects/libcxx/test/std/utilities/optional -ferror-limit 19 -fcoroutines-ts -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -faddrsig -x c++ /home/dave/ro_s/lp/libcxx/test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp
clang -cc1 version 12.0.0 based upon LLVM 12.0.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /tmp/_update_lc/r/include/c++/v1
 /tmp/_update_lc/r/projects/libcxx/include/c++build
 /home/dave/ro_s/lp/libcxx/test/support
 /usr/local/include
 /usr/lib64/clang/12.0.0/include
 /usr/include
End of search list.
/home/dave/ro_s/lp/libcxx/test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp:19:21: error: no member named 'indirectly_readable' in namespace 'std'
static_assert(!std::indirectly_readable<std::optional<int> >);
               ~~~~~^
/home/dave/ro_s/lp/libcxx/test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp:19:60: error: expected '(' for function-style cast or type construction
static_assert(!std::indirectly_readable<std::optional<int> >);
                                        ~~~~~~~~~~~~~~~~~~ ^
/home/dave/ro_s/lp/libcxx/test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp:19:61: error: expected expression
static_assert(!std::indirectly_readable<std::optional<int> >);
                                                            ^
/home/dave/ro_s/lp/libcxx/test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp:20:21: error: no member named 'indirectly_writable' in namespace 'std'
static_assert(!std::indirectly_writable<std::optional<int>, int>);
               ~~~~~^
/home/dave/ro_s/lp/libcxx/test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp:20:59: error: expected '(' for function-style cast or type construction
static_assert(!std::indirectly_writable<std::optional<int>, int>);
                                        ~~~~~~~~~~~~~~~~~~^
5 errors generated.

My mistake. The bisect tripped over a unreliable test. The real problem was 04733181b5136e2b3df2b37c6bdd9e25f8afecd0 and people are already piling onto that as being broken.