Add setting to disable usage of internal GCC abi to check rtti stuff

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2011-08-07 16:51:57 +01:00
1 parent 811470ae34
commit f3e00b1ecb
2 files changed
+32

No files matched your search

+22
View File
@@ -1240,6 +1240,10 @@ public:
m_map[std::string(cpp_type_info.name())] = python_wrapper;
}
''')
if settings.gcc_rtti_abi_complete:
code_sink.writeln('''
PyTypeObject * lookup_wrapper(const std::type_info &cpp_type_info, PyTypeObject *fallback_wrapper)
{
@@ -1286,6 +1290,24 @@ public:
}
''')
else:
code_sink.writeln('''
PyTypeObject * lookup_wrapper(const std::type_info &cpp_type_info, PyTypeObject *fallback_wrapper)
{
#if PBG_TYPEMAP_DEBUG
std::cerr << "lookup_wrapper(this=" << this << ", type_name=" << cpp_type_info.name() << ")" << std::endl;
#endif
PyTypeObject *python_wrapper = m_map[cpp_type_info.name()];
return python_wrapper? python_wrapper : fallback_wrapper;
}
};
}
''')
if self.import_from_module:
code_sink.writeln("\nextern pybindgen::TypeMap *_%s;\n" % self.typeid_map_name)
code_sink.writeln("#define %s (*_%s)\n" % (self.typeid_map_name, self.typeid_map_name))
+10
View File
@@ -65,6 +65,16 @@ behaviour. But this is really deprecated; newer code should set
deprecated_virtuals to False.
"""
gcc_rtti_abi_complete = True
"""
If True, and GCC >= 3 is detected at compile time, pybindgen will try
to use abi::__si_class_type_info to determine the closest registered
type for pointers to objects of unknown type. Notably, Mac OS X Lion
has GCC > 3 but which breaks this internal API, in which case it
should be disabled (set this option to False).
"""
def _get_deprecated_virtuals():
if deprecated_virtuals is None:
import warnings