This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/2] make the c++ pretty printer inherit from the C one instead of include it
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Trevor Saunders <tsaunders at mozilla dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 31 Jul 2013 22:48:39 -0500
- Subject: Re: [PATCH 1/2] make the c++ pretty printer inherit from the C one instead of include it
- References: <1375319690-12939-1-git-send-email-tsaunders at mozilla dot com> <1375319690-12939-2-git-send-email-tsaunders at mozilla dot com> <CAAiZkiDQ1=0XdKhOtNT0RXTiF+Bs-Aa4wAdLfjpOj86psFCEBA at mail dot gmail dot com> <20130801031620 dot GA13749 at tsaunders-iceball dot corp dot tor1 dot mozilla dot com>
On Wed, Jul 31, 2013 at 10:16 PM, Trevor Saunders <tsaunders@mozilla.com> wrote:
> On Wed, Jul 31, 2013 at 10:02:29PM -0500, Gabriel Dos Reis wrote:
>> On Wed, Jul 31, 2013 at 8:14 PM, Trevor Saunders <tsaunders@mozilla.com> wrote:
>> > bootstrapped and same test results on x86_64-linux-gnu against r201084
>> >
>> > gcc/cp/
>> > * cxx-pretty-print.h (cxx_pretty_printer): inherit from c_pretty_printer
>> > instead of include it.
>> > * (cxx_pretty_print.c): adjust accordingly.
>>
>> This is on my todo stack; thanks for looking into it.
>>
>> The way to handle this is:
>>
>> * yes, use inheritance -- that is what I simulated with the C abstractions
>> * declare the "pointer to function fields" as virtual functions --
>> that is what I meant
>> with the (necessarily poor) emulation through the casts.
>> * override those that needed to be overridden in cxx_pretty_printer.
>> * adjust the macros.
>> * Have the associated constructors do the right thing.
>
> I agree with all of that, I was just trying to keep patches small but if
> you prefer I guess I could do one giant patch that redoes all of this.
At the minimum, the inheritance and the virtual functions should go together.
-- Gaby