From: Eli Zaretskii <eliz@gnu.org>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Add printf format specifier for printing enumerator
Date: Fri, 05 Feb 2016 14:53:00 -0000 [thread overview]
Message-ID: <8337t7us3k.fsf@gnu.org> (raw)
In-Reply-To: <1454681876-17628-1-git-send-email-simon.marchi@polymtl.ca> (message from Simon Marchi on Fri, 5 Feb 2016 09:17:56 -0500)
> From: Simon Marchi <simon.marchi@polymtl.ca>
> Cc: Simon Marchi <simon.marchi@polymtl.ca>
> Date: Fri, 5 Feb 2016 09:17:56 -0500
>
> This patch adds a format specifier to gdb's printf command, to print the
> enumerator (the text label) of an enum value. It's currently possible
> to display that value using the print command, but not as part of a
> formatted string.
>
> For example, assuming we have the following enum definition:
>
> enum NodeType {
> ...
> NODE_INTEGER,
> ...
> };
>
> enum NodeType node = NODE_INTEGER;
>
> we can display it this way:
>
> (gdb) printf "Visiting node of type %q\n", node
> Visiting node of type NODE_INTEGER
>
> All the letters of "enum" are already used as format specifiers.
What about upper-case letters?
> +@code{printf} supports the @samp{q} conversion letter to print the textual
> +label (enumerator) of a C enumeration value.
This sentence will look awkward because it starts with a lower-case
letter. How about starting with "Also, "?
I think an example here will be good, as the text does not make it
crystal clear what will be printed.
Other than that, the documentation parts look good to me, thanks.
next prev parent reply other threads:[~2016-02-05 14:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-05 14:18 Simon Marchi
2016-02-05 14:51 ` Pedro Alves
2016-02-05 15:03 ` Simon Marchi
2016-02-05 15:08 ` Pedro Alves
2016-02-05 14:53 ` Eli Zaretskii [this message]
2016-02-05 19:58 ` Simon Marchi
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=8337t7us3k.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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