[cxx-abi-dev] Deleted virtual functions

Sean Perry perry at ca.ibm.com
Fri May 29 15:07:26 UTC 2009


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.

--
Sean Perry
Compiler Development
IBM Canada Lab
(905)-413-6031 (tie 313-6031), fax (905)-413-4839



                                                                           
             Dennis Handly                                                 
             <dhandly at cup.hp.c                                             
             om>                                                        To 
                                       jason at redhat.com,                   
             05/28/2009 10:07          mark at codesourcery.com               
             PM                                                         cc 
                                       cxx-abi-dev at codesourcery.com,       
                                       daveed at edg.com                      
                                                                   Subject 
                                       Re: [cxx-abi-dev] Deleted virtual   
                                       functions                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




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/05640969/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20090529/05640969/attachment.gif>
-------------- 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/05640969/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20090529/05640969/attachment-0002.gif>


More information about the cxx-abi-dev mailing list