This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [2/3] RFC: merge symbol "ops" and "aclass" fields
- From: Tom Tromey <tromey at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 04 Feb 2013 09:43:59 -0700
- Subject: Re: [2/3] RFC: merge symbol "ops" and "aclass" fields
- References: <8738y1hzzz.fsf@fleche.redhat.com> <20130203092001.GD16948@host2.jankratochvil.net>
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> These three fields could be union.
I suppose, but that complicates the accessors to save a tiny bit of
memory. It may even be a net loss with the code growth.
Jan> And these accessors could gdb_assert impl->ACLASS. Currently if
Jan> ACLASS does not match it returns NULL, which would (correctly)
Jan> crash on dereferencing a method but such coding bug would not be
Jan> noticed during accesses like: if (SYMBOL_COMPUTED_OPS (sym) ==
Jan> &dwarf2_loclist_funcs)
I know this code exists, but I find it pretty ugly. It is "anti OO" in
the sense that it is checking the object class rather than just calling
a method and letting the class handle itself. Probably I should have
instead made the DWARF "datum" approach use another function vector...
Adding an assertion in the macro would conflict with patch #3, which
checks the various ops unconditionally.
Tom