public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: What should a std::error_code pretty printer show?
Date: Mon, 16 Aug 2021 13:11:18 +0100	[thread overview]
Message-ID: <CAH6eHdTL=oub+39OEsOhMxayZbbh=wcQGgDE2g=aF83QKnX_1g@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdS++Q=RHf=6Gu-LXjwj12s5zgo1QFKxkmAmjZ+jRGm1uQ@mail.gmail.com>

On Mon, 16 Aug 2021, 12:55 Jonathan Wakely, <jwakely.gcc@gmail.com> wrote:

> I'm adding a GDB printer for std::error_code.What I have now prints
> the category name as a quoted string, followed by the error value:
>
> {"system": 0}
> {"system": 1234}
>
> If the category is std::generic_category() then it also shows the
> strerror description:
>

I should probably extend this special case for the generic category to also
apply to the system category when the OS is POSIX-based. For POSIX systems,
the system error numbers are generic errno values.



> {"generic": 13 "Permission denied"}
>
> But I'd also like it to show the errno macro, but I'm not sure what's
> the best way to show it.
>
> Does this seem OK?
>
> {"generic": 13 EACCES "Permission denied"}
>
> I think that's a bit too verbose.
>
> Would {"generic": EACCES} be better? You can always use ec.value() to
> get the numeric value, and strerror to get the description if you want
> those.
>

  reply	other threads:[~2021-08-16 12:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 11:55 Jonathan Wakely
2021-08-16 12:11 ` Jonathan Wakely [this message]
2021-08-16 16:51   ` Jonathan Wakely
2021-08-16 19:30     ` Jonathan Wakely

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='CAH6eHdTL=oub+39OEsOhMxayZbbh=wcQGgDE2g=aF83QKnX_1g@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=libstdc++@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).