auxhelper.cc revision 227825
1/**
2 * aux.cc - Compiler helper functions.
3 *
4 * The functions declared in this file are intended to be called only by code
5 * that is automatically generated by C++ compilers for some common cases.
6 */
7
8#include <stdlib.h>
9#include "stdexcept.h"
10
11/**
12 * Called to generate a bad cast exception.  This function is intended to allow
13 * compilers to insert code generating this exception without needing to
14 * duplicate the code for throwing the exception in every call site.
15 */
16extern "C" void __cxa_bad_cast()
17{
18    throw std::bad_cast();
19}
20
21/**
22 * Called to generate a bad typeid exception.  This function is intended to
23 * allow compilers to insert code generating this exception without needing to
24 * duplicate the code for throwing the exception in every call site.
25 */
26extern "C" void __cxa_bad_typeid()
27{
28    throw std::bad_typeid();
29}
30
31/**
32 * Compilers may (but are not required to) set any pure-virtual function's
33 * vtable entry to this function.  This makes debugging slightly easier, as
34 * users can add a breakpoint on this function to tell if they've accidentally
35 * called a pure-virtual function.
36 */
37extern "C" void __cxa_pure_virtual()
38{
39    abort();
40}
41
42