From: Tom Tromey <tromey@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: enum pretty-printing support
Date: Tue, 10 Jan 2012 22:19:00 -0000 [thread overview]
Message-ID: <m3d3arb471.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3hb03b53r.fsf@fleche.redhat.com> (Tom Tromey's message of "Tue, 10 Jan 2012 14:49:28 -0700")
Jan> There is the obvious question this may work automatically if all
Jan> the values of enum type are in the form 2^n and fall back to the
Jan> GDB default way otherwise.
Tom> Yeah, that might be nicer.
Tom> I will look into it.
I think the basic code is pretty easy to write.
I have it written, but I can't test it until tomorrow.
I do wonder whether we still want the Python code.
My C implementation works by checking whether the enum values are
disjoint. However, it is not uncommon to see things like:
enum flags {
ONE = 1,
TWO = 2,
HIGHEST = TWO
};
or
enum flags {
ONE = 1,
TWO = 2,
ALL = ONE | TWO
};
... but the Python code would acceptably handle both of these. This was
ok for the Python approach because registration is explicit, not
implicit; I think the C code has to be a bit more careful because it
cannot readily be turned off.
One idea is to have both.
Tom
next prev parent reply other threads:[~2012-01-10 22:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 20:26 Tom Tromey
2012-01-10 20:28 ` Pedro Alves
2012-01-11 16:45 ` Tom Tromey
2012-01-10 21:19 ` Eli Zaretskii
2012-01-10 21:23 ` Jan Kratochvil
2012-01-10 22:00 ` Tom Tromey
2012-01-10 22:19 ` Tom Tromey [this message]
2012-01-10 23:52 ` Jan Kratochvil
2012-01-11 16:46 ` Tom Tromey
2012-01-11 21:03 ` Jan Kratochvil
2012-01-11 21:25 ` Tom Tromey
2012-01-16 18:44 ` Tom Tromey
2012-01-16 18:45 ` Eli Zaretskii
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=m3d3arb471.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/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