Re: [Crystal-cvs] SF.net SVN: crystal:[38394] CS/trunk/include/csutil/vararg.h
"res" <[email protected]>
| Newsgroups | gmane.comp.graphics.crystalspace.devel |
|---|---|
| Message-ID | <[email protected]> |
> Revision: 38394 > http://crystal.svn.sourceforge.net/crystal/?rev=38394&view=rev > Author: sunshine > Date: 2012-07-17 06:57:13 +0000 (Tue, 17 Jul 2012) > Log Message: > ----------- > vararg: Add CS::va_call() utility. > > The llvm-gcc compiler shipped by Apple with Xcode is incompletely > implemented. In particular, when it encounters a vararg virtual method > in a virtual base class, it aborts with error "generic thunk code fails > for method foo::bar() which uses '...'". This is particularly > problematic in CS since virtual inheritance is employed heavily by the > SCF facility, and it is not entirely uncommon for vararg methods to be > declared in SCF interfaces. There are at least two possible ways to > work around this shortcoming. I have a third suggestion: Only keep the methods taking a va_list virtual. Keep the ‘real’ vararg methods unconditionally defined, however have (force) them to be inline and non-virtual; they just call the va_list variant. 1. Just forwarding to the va_list variant is what most implementations of vararg methods do anyway. 2. Having the vararg methods (forced) inline and non-virtual should work around the code generation issues as well - the need for a thunk comes from the method being virtual. The (forced) inline ensures the actual method machine code is generated at it's call site, as it should be for any interface method. 3. Being able to call the vararg methods “naturally” is more readable than CS::callv(), compatible with existing code (esp. external code) and less prone to errors – the CS::callv() is easily forgotten, or may seem unnecessary if you're not familiar with the particular llvm shortcoming. Thoughts, comments? -f.r. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Crystal-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/crystal-develop