From: Simon Marchi <simon.marchi@polymtl.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Add printf format specifier for printing enumerator
Date: Fri, 05 Feb 2016 19:58:00 -0000 [thread overview]
Message-ID: <5c55e304fe3d8cd610d663a103b42190@simark.ca> (raw)
In-Reply-To: <8337t7us3k.fsf@gnu.org>
On 2016-02-05 09:52, Eli Zaretskii wrote:
>> 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.
Thanks for the doc review. The code will probably change a lot, so the
doc will as well. I'll keep your comments in mind when I have to re-do
it.
Simon
prev parent reply other threads:[~2016-02-05 19:58 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
2016-02-05 19:58 ` Simon Marchi [this message]
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=5c55e304fe3d8cd610d663a103b42190@simark.ca \
--to=simon.marchi@polymtl.ca \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.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