[cxx-abi-dev] Deleted virtual functions

David Vandevoorde daveed at edg.com
Fri May 29 15:21:56 UTC 2009


On May 29, 2009, at 11:07 AM, Sean Perry wrote:

> The C linkage would be a problem on platforms that use a different  
> calling. The compiler is going to generate code that assumes the  
> functions pointed to by the virtual function table have C++ linkage.  
> These functions should have C++ linkage too.
>

That thought crossed my mind, and then I dismissed it because  
__cxa_pure_virtual is already that way.

I think the API functions should keep C linkage, but the vtable should  
be allowed to point to a wrapper for these functions with C++ linkage.

Does that work?

	Daveed


>
> --
> Sean Perry
> Compiler Development
> IBM Canada Lab
> (905)-413-6031 (tie 313-6031), fax (905)-413-4839
>
> <graycol.gif>Dennis Handly <dhandly at cup.hp.com>
>
>
> Dennis Handly <dhandly at cup.hp.com>
> 05/28/2009 10:07 PM
>
> <ecblank.gif>
> To
> <ecblank.gif>
> jason at redhat.com, mark at codesourcery.com
> <ecblank.gif>
> cc
> <ecblank.gif>
> cxx-abi-dev at codesourcery.com, daveed at edg.com
> <ecblank.gif>
> Subject
> <ecblank.gif>
> Re: [cxx-abi-dev] Deleted virtual functions
> <ecblank.gif>	<ecblank.gif>
>
> Looks good.
>
> >From: David Vandevoorde <daveed at edg.com>
> >I noticed that there isn't actually a requirement to point virtual
> >table entried for pure virtual functions at __cxa_pure_virtual.  Is
> >that intentional or just sloppy wording?
>
> Well, why have __cxa_pure_virtual without using it?  ;-)
>
> I have a suggestion for the signature for __cxa_pure_virtual and the  
> new
> __cxa_deleted_virtual:
>
> extern "C" void __cxa_deleted_virtual(void *this_ptr);
> extern "C" void __cxa_pure_virtual(void *this_ptr);
>
> Where this_ptr can be cast to a dummy polymorphic class to get the  
> class
> name to print a nicer message:
>
> // A dummy polymorphic class to make typeid() do the work below.
> class pv_dummy {
> public:
>    virtual void dummy_func();
> };
> extern "C" {
> extern void abort();
> void __cxa_pure_virtual (void *this_ptr)
> {
>    pv_dummy *obj = (pv_dummy*)this_ptr;
>    const char *mangled_name = typeid(*obj).name();
>    const char *demangled_name = abi::__cxa_demangle(mangled_name, 0,  
> 0, 0);
>    if (!demangled_name)  // out of space?
>        demangled_name = mangled_name;
>    fprintf(stderr, "aCC runtime: pure virtual function called for  
> class \"%s\".
> \n", demangled_name);
>    abort();
> }
> }
>
> --Apple-Mail-17--1051914877
> filename=deleted_funcs.diffs
> + <li>If C::f is a pure virtual function, the corresponding virtual  
> table
> + entry may point to __cxa_pure_virtual
>
> Did you want to explain why you used "may"?
> Is this the case of declaring it pure but still having a definition?
> (for the destructor)
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20090529/08b9897d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic05484.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20090529/08b9897d/attachment.gif>


More information about the cxx-abi-dev mailing list