From: Matt Rice <ratmice@gmail.com>
To: pmuldoon@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/7] [python] API for macros: abort or continuing macro iterators.
Date: Thu, 01 Sep 2011 21:48:00 -0000 [thread overview]
Message-ID: <CACTLOFqW4kW9CUCEBJRyvrZRLyMeu08pHPkS15JEEyn5ZhGyXw@mail.gmail.com> (raw)
In-Reply-To: <m31uw3w3yf.fsf@redhat.com>
On Tue, Aug 30, 2011 at 4:09 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
> matt rice <ratmice@gmail.com> writes:
>
>> diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
>> index d1ac7fa..e929fe0 100644
>> --- a/gdb/macrocmd.c
>> +++ b/gdb/macrocmd.c
>> @@ -220,13 +220,15 @@ info_macro_command (char *name, int from_tty)
>> Otherwise USER_DATA is considered to be a string, printing
>> only macros who's NAME matches USER_DATA. Other arguments are
>> routed to print_macro_definition. */
>> -static void
>> +static enum macro_walk_status
>> print_macro_callback (const char *name, const struct macro_definition *macro,
>> struct macro_source_file *source, int line,
>> void *user_data)
>> {
>> if (! user_data || strcmp (user_data, name) == 0)
>> print_macro_definition (name, macro, source, line);
>> +
>> + return macro_walk_continue;
>> }
>
> Is the unconditional return here due to it being part of a recursive
> call chain? I'm not sure what value the unconditional return of an enum
> constant over the previous "void" gets us? Why return anything at all?
> The previous version assumed the callers knew how to deal with the void
> return, but I am not sure what your version achieves by unconditionally
> returning macro_walk_continue?
This is just matching pre-existing behavior from before macro
iteration could abort/continue.
the 'void' return was hard coded as 'return 0', in foreach_macro and
foreach_macro_in_scope
where now they return 'status == macro_walk_abort'
where 0 means continue and != 0 abort as interpreted by
src/libiberty/splay-tree.c:splay_tree_foreach_helper
>> /* Implementation of the "info definitions" command. */
>> @@ -435,7 +437,7 @@ macro_undef_command (char *exp, int from_tty)
>> }
>>
>>
>> -static void
>> +static enum macro_walk_status
>> print_one_macro (const char *name, const struct macro_definition *macro,
>> struct macro_source_file *source, int line,
>> void *ignore)
>> @@ -452,6 +454,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
>> fprintf_filtered (gdb_stdout, ")");
>> }
>> fprintf_filtered (gdb_stdout, " %s\n", macro->replacement);
>> + return macro_walk_continue;
>> }
>
> Same as above. If you decide to keep them please update the comment
> headers with a description of the return value. This function, and
> numerous other places too.
will do, though, these are documented in macrotab.h:macro_callback_fn,
i should at least
mention they are implementations of those, and arguments/return values
are documented there.
does that sound alright?
next prev parent reply other threads:[~2011-09-01 21:33 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-24 15:11 [PATCH 0/7] [python] API for macros matt rice
2011-08-24 15:11 ` [PATCH 1/7] [python] API for macros: abort or continuing macro iterators matt rice
2011-08-26 20:23 ` Tom Tromey
2011-08-30 11:10 ` Phil Muldoon
2011-09-01 21:48 ` Matt Rice [this message]
2011-08-24 15:11 ` [PATCH 5/7] [python] API for macros: gdb.Objfile symtabs method matt rice
2011-08-30 13:08 ` Phil Muldoon
2011-09-01 23:18 ` Matt Rice
2011-09-02 1:07 ` Paul_Koning
2011-08-30 17:34 ` Tom Tromey
2011-09-02 0:56 ` Matt Rice
2011-08-24 15:11 ` [PATCH 2/7] [python] API for macros: memory management quirks matt rice
2011-08-26 20:40 ` Tom Tromey
2011-08-30 11:47 ` Phil Muldoon
2011-09-01 22:46 ` Matt Rice
2011-08-24 15:12 ` [PATCH 7/7] [python] API for macros: Add tests matt rice
2011-08-30 13:12 ` Phil Muldoon
2011-08-30 15:54 ` Tom Tromey
2011-08-24 15:12 ` [PATCH 6/7] [python] API for macros: Add docs matt rice
2011-08-24 20:10 ` Eli Zaretskii
2011-08-25 12:33 ` Matt Rice
2011-08-25 17:36 ` Eli Zaretskii
2011-08-26 8:04 ` Matt Rice
2011-08-26 10:42 ` Eli Zaretskii
2011-08-26 11:17 ` Matt Rice
2011-08-26 12:08 ` Eli Zaretskii
2011-08-26 14:06 ` Matt Rice
2011-08-26 15:05 ` Eli Zaretskii
2011-08-24 15:12 ` [PATCH 4/7] [python] API for macros: Add methods to get a gdb.Macro matt rice
2011-08-30 13:04 ` Phil Muldoon
2011-08-30 17:41 ` Tom Tromey
2011-08-30 20:28 ` Phil Muldoon
2011-08-30 20:35 ` Phil Muldoon
2011-09-01 23:13 ` Matt Rice
2011-09-02 1:15 ` Paul_Koning
2011-09-02 10:04 ` Paul_Koning
2011-09-02 12:04 ` Phil Muldoon
2011-08-30 20:38 ` Tom Tromey
2011-08-30 20:58 ` Phil Muldoon
2011-08-24 15:12 ` [PATCH 3/7] [python] API for macros: Add gdb.Macro class matt rice
2011-08-30 12:45 ` Phil Muldoon
2011-09-01 22:57 ` Matt Rice
2011-08-30 9:44 ` [PATCH 0/7] [python] API for macros Phil Muldoon
2011-09-01 21:33 ` Matt Rice
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=CACTLOFqW4kW9CUCEBJRyvrZRLyMeu08pHPkS15JEEyn5ZhGyXw@mail.gmail.com \
--to=ratmice@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@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