Re: [cxx-abi-dev] Deleted virtual functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cxx-abi-dev] Deleted virtual functions



<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 29, 2009, at 11:07 AM, Sean Perry wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><p>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.<br></p></div></blockquote><div><br></div><div>That thought crossed my mind, and then I dismissed it because __cxa_pure_virtual is already that way.</div><div><br></div><div>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.</div><div><br></div><div>Does that work?</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">	</span>Daveed<br></div><div><br></div><br><blockquote type="cite"><div><p> <br> --<br> Sean Perry<br> Compiler Development<br> IBM Canada Lab<br> (905)-413-6031 (tie 313-6031), fax (905)-413-4839<br> <br> <span>&lt;graycol.gif&gt;</span>Dennis Handly &lt;<a href="mailto:dhandly@xxxxxxxxxx";>dhandly@xxxxxxxxxx</a>&gt;<br> <br> <br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr valign="top"><td style="background-image:url(cid:2__=0ABBFF56DFC106858f9e8a93df938@ca.ibm.com); background-repeat: no-repeat; " width="40%"> <ul> <ul> <ul> <ul><b><font size="2">Dennis Handly &lt;<a href="mailto:dhandly@xxxxxxxxxx";>dhandly@xxxxxxxxxx</a>&gt;</font></b><font size="2"> </font> <p><font size="2">05/28/2009 10:07 PM</font></p></ul> </ul> </ul> </ul> </td><td width="60%"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr valign="top"><td width="1%"><span>&lt;ecblank.gif&gt;</span><br> <div align="right"><font size="2">To</font></div></td><td width="100%"><span>&lt;ecblank.gif&gt;</span><br> <font size="2"><a href="mailto:jason@xxxxxxxxxx";>jason@xxxxxxxxxx</a>, <a href="mailto:mark@xxxxxxxxxxxxxxxx";>mark@xxxxxxxxxxxxxxxx</a></font></td></tr> <tr valign="top"><td width="1%"><span>&lt;ecblank.gif&gt;</span><br> <div align="right"><font size="2">cc</font></div></td><td width="100%"><span>&lt;ecblank.gif&gt;</span><br> <font size="2"><a href="mailto:cxx-abi-dev@xxxxxxxxxxxxxxxx";>cxx-abi-dev@xxxxxxxxxxxxxxxx</a>, <a href="mailto:daveed@xxxxxxx";>daveed@xxxxxxx</a></font></td></tr> <tr valign="top"><td width="1%"><span>&lt;ecblank.gif&gt;</span><br> <div align="right"><font size="2">Subject</font></div></td><td width="100%"><span>&lt;ecblank.gif&gt;</span><br> <font size="2">Re: [cxx-abi-dev] Deleted virtual functions</font></td></tr> </tbody></table> <table border="0" cellspacing="0" cellpadding="0"> <tbody><tr valign="top"><td width="58"><span>&lt;ecblank.gif&gt;</span></td><td width="336"><span>&lt;ecblank.gif&gt;</span></td></tr> </tbody></table> </td></tr> </tbody></table> <br> <tt>Looks good.<br> <br> &gt;From: David Vandevoorde &lt;<a href="mailto:daveed@xxxxxxx";>daveed@xxxxxxx</a>&gt;<br> &gt;I noticed that there isn't actually a requirement to point virtual &nbsp;<br> &gt;table entried for pure virtual functions at __cxa_pure_virtual. &nbsp;Is &nbsp;<br> &gt;that intentional or just sloppy wording?<br> <br> Well, why have __cxa_pure_virtual without using it? &nbsp;;-)<br> <br> I have a suggestion for the signature for __cxa_pure_virtual and the new<br> __cxa_deleted_virtual:<br> <br> extern "C" void __cxa_deleted_virtual(void *this_ptr);<br> extern "C" void __cxa_pure_virtual(void *this_ptr);<br> <br> Where this_ptr can be cast to a dummy polymorphic class to get the class<br> name to print a nicer message:<br> <br> // A dummy polymorphic class to make typeid() do the work below.<br> class pv_dummy {<br> public:<br> &nbsp; &nbsp;virtual void dummy_func();<br> };<br> extern "C" {<br> extern void abort();<br> void __cxa_pure_virtual (void *this_ptr)<br> {<br> &nbsp; &nbsp;pv_dummy *obj = (pv_dummy*)this_ptr;<br> &nbsp; &nbsp;const char *mangled_name = typeid(*obj).name();<br> &nbsp; &nbsp;const char *demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, 0);<br> &nbsp; &nbsp;if (!demangled_name) &nbsp;// out of space?<br> &nbsp; &nbsp; &nbsp; &nbsp;demangled_name = mangled_name;<br> &nbsp; &nbsp;fprintf(stderr, "aCC runtime: pure virtual function called for class \"%s\".<br> \n", demangled_name);<br> &nbsp; &nbsp;abort();<br> }<br> }<br> <br> --Apple-Mail-17--1051914877<br> 		 filename=deleted_funcs.diffs<br> + &lt;li&gt;If C::f is a pure virtual function, the corresponding virtual table<br> + entry may point to __cxa_pure_virtual<br> <br> Did you want to explain why you used "may"?<br> Is this the case of declaring it pure but still having a definition?<br> (for the destructor)<br> </tt><br> </p></div></blockquote></div><br></body></html>

GIF image