Page MenuHomePhabricator

[libc++] Make sure __bit_iterator does not use deprecated SMF generation
ClosedPublic

Authored by Quuxplusone on Apr 23 2021, 10:17 AM.

Details

Summary

This allows us to turn -Wdeprecated-copy back on, which a recent Clang
commit broke when the warning became more stringent.

Diff Detail

Unit TestsFailed

TimeTest
2,130 mslibcxx CI C++11 > libc++.libcxx::double_include.sh.cpp
Script: -- : 'RUN: at line 12'; /usr/bin/clang++ -c /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/libcxx/double_include.sh.cpp -o /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/test/libcxx/Output/double_include.sh.cpp.dir/t.tmp.first.o -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/include/c++/v1 -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++11 -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=/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/test/libcxx/Output/double_include.sh.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1
2,190 mslibcxx CI C++11 > libc++.libcxx::min_max_macros.compile.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++ /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/libcxx/min_max_macros.compile.pass.cpp -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/include/c++/v1 -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++11 -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=/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/test/libcxx/Output/min_max_macros.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
2,180 mslibcxx CI C++11 > libc++.libcxx::no_assert_include.compile.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++ /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/libcxx/no_assert_include.compile.pass.cpp -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/include/c++/v1 -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++11 -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=/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/test/libcxx/Output/no_assert_include.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
1,050 mslibcxx CI C++11 > libc++.libcxx/debug::extern-templates.sh.cpp
Script: -- : 'RUN: at line 19'; /usr/bin/clang++ -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/include/c++/v1 -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++11 -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=/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/test/libcxx/debug/Output/extern-templates.sh.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/libcxx/debug/extern-templates.sh.cpp -lc++experimental -L/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib -L/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib -nodefaultlibs -lc++…
1,110 mslibcxx CI C++11 > libc++.libcxx/depr/depr_c_headers::complex.h.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++ /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp -v --target=x86_64-unknown-linux-gnu -include /home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/include/c++/v1 -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++11 -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=/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/test/libcxx/depr/depr.c.headers/Output/complex.h.pass.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -L/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib -L/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/93493ef088f9-1/llvm-project/libcxx-ci/build/generic-cxx11/./lib…
View Full Test Results (1,444 Failed)

Event Timeline

ldionne created this revision.Apr 23 2021, 10:17 AM
ldionne requested review of this revision.Apr 23 2021, 10:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2021, 10:17 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
xbolva00 accepted this revision.Apr 23 2021, 10:36 AM

Thanks for the fix

Quuxplusone requested changes to this revision.EditedApr 23 2021, 12:21 PM

You probably saw my Slack, but for the record, I think we want this:

public:
    _LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
    : __seg_(nullptr), __ctz_(0)
#endif
    {}

    // When _IsConst=false, this is the copy constructor.
    // It is non-trivial. We maintain this for ABI purposes.
    _LIBCPP_INLINE_VISIBILITY
    __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
        : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}

    // When _IsConst=false, we have a user-provided copy constructor,
    // so we must also provide a copy assignment operator because
    // the implicit generation of a defaulted one is deprecated.
    _LIBCPP_INLINE_VISIBILITY
    __bit_iterator& operator=(const _If<_IsConst, struct __private_nat, __bit_iterator>& __it) {
        __seg_ = __it.__seg_;
        __ctz_ = __it.__ctz_;
        return *this;
    }

    _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
        {return reference(__seg_, __storage_type(1) << __ctz_);}
This revision now requires changes to proceed.Apr 23 2021, 12:21 PM
Quuxplusone commandeered this revision.Apr 24 2021, 5:22 AM
Quuxplusone edited reviewers, added: ldionne; removed: Quuxplusone.

Previous (failing) buildkite run is in https://buildkite.com/llvm-project/libcxx-ci/builds/2759 . I'm about to update this PR with my suggested patch.

Apply my suggested patch instead. Let's see what buildkite thinks of this. (I think it'll pass, but let's see.)

Stupid question... but what's SMF?

ldionne accepted this revision.Apr 26 2021, 5:42 AM
ldionne added inline comments.
libcxx/include/__bit_reference
1118

Maybe mention the obvious:

When _IsConst=true, the copy-constructor is the default compiler-generated one, which is trivial.

This revision is now accepted and ready to land.Apr 26 2021, 5:42 AM