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: [2/3] RFC: merge symbol "ops" and "aclass" fields


>>>>> "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


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