This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Patch: implement missing macro functions


>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:

Pedro> You'll need someone else to comment on the big picture -- I'll
Pedro> comment on a few strokes, below,

Thanks for taking the time to do this.

>> + Âcleanup_chain = make_my_cleanup (&cleanup_chain, free_current_contents,
>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ Â &name);

Pedro> That is a big nop to write + with 2 leaks attached.  The new cleanup is
Pedro> being discarded and leaked, so NAME isn't being free'd at all.

Pedro> Don't call make_my_cleanup directly.  Instead, call
Pedro> make_cleanup and discard its result:

Ok, thanks.  I forgot to mention in my note that I wanted someone to
look at this.  I don't actually understand the cleanup mechanism... I
looked a bit but didn't see any documentation on how to use it.

>> + Âgdb_flush (gdb_stdout);

Pedro> Did you really need a gdb_flush here?

Probably not.  I'll remove it and see.

>> Â
>> +/* Helper function for macro_for_each. Â*/
>> +static int
>> +foreach_macro (splay_tree_node node, void *fnp)
>> +{
>> + Âmacro_callback_fn fn = (macro_callback_fn) fnp;

Pedro> (Hmmm, can we assume casting void* <-> func pointers is safe on all
Pedro> supported hosts/compilers?  Posix and Windows do require it to
Pedro> be safe.  I actually have no idea how much GDB common code relies
Pedro> on it today.)

I'll just fix it.

Pedro> Would it make sense to have a test with macro arguments, and
Pedro> a test where a user macro overrides a source macro?

Yeah.  Lazy me!  I will add those.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]