Page MenuHomePhabricator

Various minor fixes for python 3
ClosedPublic

Authored by saugustine on Feb 5 2021, 11:47 AM.

Details

Reviewers
mgorny
ldionne
Group Reviewers
Restricted Project
Commits
rGa34b8b879e34: Various minor fixes for python 3
Summary

Switch StdTuple printer from python 2-style "next" to python 3.

Nested iteration changed enough to make the original bitset iteration
code a bit trickier than it needs to be, so unnest.

The end node of a map iterator is sometimes hard to detect in isolation,
don't fail in that case.

Diff Detail

Event Timeline

saugustine created this revision.Feb 5 2021, 11:47 AM
saugustine requested review of this revision.Feb 5 2021, 11:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2021, 11:47 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Feb 5 2021, 11:56 AM

LGTM once CI passes. Thanks!

This revision is now accepted and ready to land.Feb 5 2021, 11:56 AM

I haven't tested it on main but on top of 12.0.0-rc1:

+ /usr/lib/ccache/bin/x86_64-pc-linux-gnu-clang -v --target=x86_64-pc-linux-gnu /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp -o /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp.exe -include /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/__config_site -include /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/support/nasty_macros.h -nostdinc++ -I/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/include -I/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/support -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -std=c++2b -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=/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp/ModuleCache -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -g -L/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/lib64 -Wl,-rpath,/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/lib64 -nodefaultlibs -lc++ -lc++abi -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic -lc++experimental
clang version 12.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/12/bin
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/usr/lib/llvm/12/bin/clang-12" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name gdb_pretty_printer_test.sh.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 -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -v -nostdinc++ -resource-dir /usr/lib/llvm/12/bin/../../../../lib/clang/12.0.0 -include /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/__config_site -include /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/support/nasty_macros.h -I /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/include -I /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/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/lib/llvm/12/bin/../../../../lib/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -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 -Werror=thread-safety -Wuser-defined-warnings -Wno-macro-redefined -Wno-macro-redefined -std=c++2b -fdeprecated-macro -fdebug-compilation-dir /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/test/libcxx/gdb -ferror-limit 19 -fcoroutines-ts -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -o /tmp/portage/sys-libs/libcxx-12.0.0_rc1/temp/gdb_pretty_printer_test-62e7f0.o -x c++ /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
clang -cc1 version 12.0.0 based upon LLVM 12.0.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/include
 /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx-12.0.0_rc1_build-abi_x86_64.amd64/include/c++build
 /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/support
 /usr/lib/llvm/12/bin/../../../../lib/clang/12.0.0/include
 /usr/include
End of search list.
/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:494:20: error: use of undeclared identifier 'R'
      "not_found", R "(std::__map_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error "
                   ^
1 error generated.

--

********************

Undo an auto-lint fix that breaks the string.

I haven't tested it on main but on top of 12.0.0-rc1:

/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:494:20: error: use of undeclared identifier 'R'

"not_found", R "(std::__map_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error "
             ^

1 error generated.

That's what I get for trusting the linter that automatically runs at arc diff time. Surely a bug there. I've undone its fix, so we should be good to go.

ldionne accepted this revision.Feb 5 2021, 12:24 PM

I haven't tested it on main but on top of 12.0.0-rc1:

/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:494:20: error: use of undeclared identifier 'R'

"not_found", R "(std::__map_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error "
             ^

1 error generated.

That's what I get for trusting the linter that automatically runs at arc diff time. Surely a bug there. I've undone its fix, so we should be good to go.

I always use arc diff --nolint. LGTM again once CI is green.

mgorny accepted this revision.Feb 5 2021, 12:26 PM

Ok, now it's a definite improvement.

Still 4 sub-tests fail for me:

FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:611
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 2, weak 0 containing = {__ptr_ = 0x[a-f0-9]+}'
FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:616
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 3, weak 0 containing = {__ptr_ = 0x[a-f0-9]+}'
FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:622
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 3, weak 1 containing = {__ptr_ = 0x[a-f0-9]+}'
FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:627
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 3, weak 0 containing = {__ptr_ = 0x[a-f0-9]+}'

Ok, now it's a definite improvement.

Still 4 sub-tests fail for me:

FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:611
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 2, weak 0 containing = {__ptr_ = 0x[a-f0-9]+}'
FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:616
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 3, weak 0 containing = {__ptr_ = 0x[a-f0-9]+}'
FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:622
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 3, weak 1 containing = {__ptr_ = 0x[a-f0-9]+}'
FAIL: /tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:627
GDB printed:
   'Traceback (most recent call last):\n  File "/tmp/portage/sys-libs/libcxx-12.0.0_rc1/work/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py", line 315, in to_string\n    usecount = refcount["__shared_owners_"] + 1\ngdb.error: There is no member named __shared_owners_.\n'
Value should match:
   'std::shared_ptr<int> count 3, weak 0 containing = {__ptr_ = 0x[a-f0-9]+}'

I don't see these. Will submit this, and dig a bit further.

This revision was landed with ongoing or failed builds.Feb 5 2021, 1:02 PM
This revision was automatically updated to reflect the committed changes.
mgorny added a comment.Feb 5 2021, 1:15 PM

Thanks. If you have any idea what I could try to help, please let me know.