public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "drepper.fsp+rhbz at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/65230] pretty-print inconsistent output for similar objects
Date: Thu, 04 Aug 2022 11:44:59 +0000	[thread overview]
Message-ID: <bug-65230-4-YzDuppewal@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65230-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65230

Ulrich Drepper <drepper.fsp+rhbz at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drepper.fsp+rhbz at gmail dot com

--- Comment #2 from Ulrich Drepper <drepper.fsp+rhbz at gmail dot com> ---
Let's go through the details.  I like the idea of a common format but there
also
shouldn't be any information lost.

Here's some test code, similar to what Martin has:

#include <tuple>
#include <array>
#include <vector>
#include <bitset>
#include <memory>

int main()
{
  std::tuple<> t1;
  std::tuple<int> t2;
  std::tuple<int,int> t3;
  std::vector<int> v1;
  std::vector<int> v2 { 0 };
  std::vector<int> v3 { 0, 0 };
  std::array<int,0> a1;
  std::array<int,1> a2 { 0 };
  std::array<int,2> a3 { 0, 0 };
  std::pair<int,int> p1;
  std::bitset<0> b1;
  std::bitset<1> b2("0");
  std::bitset<2> b3("00");
  return 0;
}


The output as of gcc-12.1.1 (and gdb-12.1, what a coincidence) is:

(gdb) info locals 
t1 = empty std::tuple
t2 = std::tuple containing = {[0] = 0}
t3 = std::tuple containing = {[0] = 0, [1] = 0}
v1 = std::vector of length 0, capacity 0
v2 = std::vector of length 1, capacity 1 = {0}
v3 = std::vector of length 2, capacity 2 = {0, 0}
a1 = {_M_elems = {<No data fields>}}
a2 = {_M_elems = {0}}
a3 = {_M_elems = {0, 0}}
p1 = {first = 0, second = 0}
b1 = std::bitset
b2 = std::bitset
b3 = std::bitset

This is just my opinion, but I would like to see the following output (NB, this
already uses the tuple pretty printer change I committed):

(gdb) info locals 
t1 = std::tuple<> = { }
t2 = std::tuple<int> = {[0] = 0}
t3 = std::tuple<int,int> = {[0] = 0, [1] = 0}
v1 = std::vector<int> of length 0, capacity 0
v2 = std::vector<int> of length 1, capacity 1 = {0}
v3 = std::vector<int> of length 2, capacity 2 = {0, 0}
a1 = std::array<int,0> = { }
a2 = std::array<int,1> = {0}
a3 = std::array<int,2> = {0, 0}
p1 = {first = 0, second = 0}
b1 = std::bitset<0> = { }
b2 = std::bitset<1> = {0}
b3 = std::bitset<2> = {0, 0}

This means several changes but it corrects the rather ad-hoc nature of the
current output to be more uniform.

  parent reply	other threads:[~2022-08-04 11:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27  6:46 [Bug libstdc++/65230] New: " msebor at gcc dot gnu.org
2015-02-27  8:53 ` [Bug libstdc++/65230] " redi at gcc dot gnu.org
2022-08-04 11:44 ` drepper.fsp+rhbz at gmail dot com [this message]
2022-08-04 11:47 ` drepper.fsp+rhbz at gmail dot com
2022-08-04 11:48 ` drepper.fsp+rhbz at gmail dot com
2022-08-04 11:50 ` drepper.fsp+rhbz at gmail dot com
2022-08-04 18:16 ` drepper.fsp+rhbz at gmail dot com
2022-08-04 18:35 ` redi at gcc dot gnu.org
2022-08-05 16:26 ` drepper.fsp+rhbz at gmail dot com
2022-08-05 16:27 ` drepper.fsp+rhbz at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65230-4-YzDuppewal@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).