* [APPROVE] __cxa_pure_virtual()
@ 2003-03-27 17:56 Bart Veer
2003-03-27 18:07 ` Jonathan Larmour
0 siblings, 1 reply; 5+ messages in thread
From: Bart Veer @ 2003-03-27 17:56 UTC (permalink / raw)
To: ecos-maintainers
I have just committed a patch to CYGPKG_INFRA to provide an
implementation of __cxa_pure_virtual() that is appropriate for eCos,
overriding the one in libsupc++.
http://sources.redhat.com/ml/ecos-patches/2003-03/msg00209.html
Without this patch any C++ code that uses pure virtual functions will
fail to link. The patch adds a single new function
__cxa_pure_virtual() which will never get called in normal operation,
but which does get referenced by the compiled C++ code. The only time
this function may get called is if the application calls a virtual
function while the object is still being created, which gives
undefined behaviour. Hence the risk is small.
Bart
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [APPROVE] __cxa_pure_virtual()
2003-03-27 17:56 [APPROVE] __cxa_pure_virtual() Bart Veer
@ 2003-03-27 18:07 ` Jonathan Larmour
2003-03-27 18:32 ` John Dallaway
2003-03-27 18:57 ` Bart Veer
0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Larmour @ 2003-03-27 18:07 UTC (permalink / raw)
To: Bart Veer; +Cc: ecos-maintainers
Bart Veer wrote:
> I have just committed a patch to CYGPKG_INFRA to provide an
> implementation of __cxa_pure_virtual() that is appropriate for eCos,
> overriding the one in libsupc++.
>
> http://sources.redhat.com/ml/ecos-patches/2003-03/msg00209.html
No objection in principle, although I think you could add a diag_printf
after the CYG_FAIL saying the same thing so there is some potential
diagnostic if people don't have asserts enabled.
Perhaps even
#ifdef CYGDBG_USE_ASSERTS
CYG_FAIL
#else
diag_printf
#endif
Whatever the specific implementation, the patch is worth including in 2.0.
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [APPROVE] __cxa_pure_virtual()
2003-03-27 18:07 ` Jonathan Larmour
@ 2003-03-27 18:32 ` John Dallaway
2003-03-27 18:57 ` Bart Veer
1 sibling, 0 replies; 5+ messages in thread
From: John Dallaway @ 2003-03-27 18:32 UTC (permalink / raw)
To: ecos-maintainers
I have no objection to this patch for the eCos 2.0 branch.
John Dallaway
-----Original Message-----
From: Jonathan Larmour
Date: Thursday 27 Mar 2003 18:07
Subject: Re: [APPROVE] __cxa_pure_virtual()
> Bart Veer wrote:
> > I have just committed a patch to CYGPKG_INFRA to provide an
> > implementation of __cxa_pure_virtual() that is appropriate for eCos,
> > overriding the one in libsupc++.
> >
> > http://sources.redhat.com/ml/ecos-patches/2003-03/msg00209.html
>
> No objection in principle, although I think you could add a diag_printf
> after the CYG_FAIL saying the same thing so there is some potential
> diagnostic if people don't have asserts enabled.
>
> Perhaps even
> #ifdef CYGDBG_USE_ASSERTS
> CYG_FAIL
> #else
> diag_printf
> #endif
>
> Whatever the specific implementation, the patch is worth including in
> 2.0.
>
> Jifl
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [APPROVE] __cxa_pure_virtual()
2003-03-27 18:07 ` Jonathan Larmour
2003-03-27 18:32 ` John Dallaway
@ 2003-03-27 18:57 ` Bart Veer
2003-03-27 19:58 ` Jonathan Larmour
1 sibling, 1 reply; 5+ messages in thread
From: Bart Veer @ 2003-03-27 18:57 UTC (permalink / raw)
To: jifl; +Cc: ecos-maintainers
>>>>> "Jifl" == Jonathan Larmour <jifl@eCosCentric.com> writes:
Jifl> Bart Veer wrote:
>> I have just committed a patch to CYGPKG_INFRA to provide an
>> implementation of __cxa_pure_virtual() that is appropriate for eCos,
>> overriding the one in libsupc++.
>>
>> http://sources.redhat.com/ml/ecos-patches/2003-03/msg00209.html
Jifl> No objection in principle, although I think you could add a
Jifl> diag_printf after the CYG_FAIL saying the same thing so
Jifl> there is some potential diagnostic if people don't have
Jifl> asserts enabled.
Jifl> Perhaps even
Jifl> #ifdef CYGDBG_USE_ASSERTS
Jifl> CYG_FAIL
Jifl> #else
Jifl> diag_printf
Jifl> #endif
No. __cxa_pure_virtual() should never get called. Even when still
debugging, there are very few applications sufficiently broken that
__cxa_pure_virtual() would get called. In non-debug builds we want a
minimal implementation, and having a diag_printf() in there would be a
waste of code space.
Arguably we should go even further and in non-debug builds alias this
to cyg_assert_fail() or some other dummy function, saving a couple
more bytes.
Bart
--
Bart Veer eCos Configuration Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [APPROVE] __cxa_pure_virtual()
2003-03-27 18:57 ` Bart Veer
@ 2003-03-27 19:58 ` Jonathan Larmour
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Larmour @ 2003-03-27 19:58 UTC (permalink / raw)
To: Bart Veer; +Cc: ecos-maintainers
Bart Veer wrote:
>>>>>>"Jifl" == Jonathan Larmour <jifl@eCosCentric.com> writes:
>
>
> Jifl> Bart Veer wrote:
> >> I have just committed a patch to CYGPKG_INFRA to provide an
> >> implementation of __cxa_pure_virtual() that is appropriate for eCos,
> >> overriding the one in libsupc++.
> >>
> >> http://sources.redhat.com/ml/ecos-patches/2003-03/msg00209.html
>
> Jifl> No objection in principle, although I think you could add a
> Jifl> diag_printf after the CYG_FAIL saying the same thing so
> Jifl> there is some potential diagnostic if people don't have
> Jifl> asserts enabled.
>
> Jifl> Perhaps even
> Jifl> #ifdef CYGDBG_USE_ASSERTS
> Jifl> CYG_FAIL
> Jifl> #else
> Jifl> diag_printf
> Jifl> #endif
>
> No. __cxa_pure_virtual() should never get called. Even when still
> debugging, there are very few applications sufficiently broken that
> __cxa_pure_virtual() would get called. In non-debug builds we want a
> minimal implementation, and having a diag_printf() in there would be a
> waste of code space.
Fair point.
> Arguably we should go even further and in non-debug builds alias this
> to cyg_assert_fail() or some other dummy function, saving a couple
> more bytes.
Well, in the future we should have a general way to deal with program
termination/abort whatever. abort() has too many existing semantic
requirements, but to achieve that sort of effect, particularly when a ROM
monitor is present and you want to return to it, or whatever other
(configurable) behaviour. But for much later (beyond 2.1 probably in
practice).
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-03-27 19:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-27 17:56 [APPROVE] __cxa_pure_virtual() Bart Veer
2003-03-27 18:07 ` Jonathan Larmour
2003-03-27 18:32 ` John Dallaway
2003-03-27 18:57 ` Bart Veer
2003-03-27 19:58 ` Jonathan Larmour
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).