Merge pull request #66804 from akien-mga/core-remove-NO_SAFE_CAST
Remove unsupported `NO_SAFE_CAST`/`-fno-rtti` from Android build
This commit is contained in:
commit
cd7f172cf8
5 changed files with 5 additions and 58 deletions
|
@ -733,34 +733,12 @@ public:
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static T *cast_to(Object *p_object) {
|
static T *cast_to(Object *p_object) {
|
||||||
#ifndef NO_SAFE_CAST
|
|
||||||
return dynamic_cast<T *>(p_object);
|
return dynamic_cast<T *>(p_object);
|
||||||
#else
|
|
||||||
if (!p_object) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
if (p_object->is_class_ptr(T::get_class_ptr_static())) {
|
|
||||||
return static_cast<T *>(p_object);
|
|
||||||
} else {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static const T *cast_to(const Object *p_object) {
|
static const T *cast_to(const Object *p_object) {
|
||||||
#ifndef NO_SAFE_CAST
|
|
||||||
return dynamic_cast<const T *>(p_object);
|
return dynamic_cast<const T *>(p_object);
|
||||||
#else
|
|
||||||
if (!p_object) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
if (p_object->is_class_ptr(T::get_class_ptr_static())) {
|
|
||||||
return static_cast<const T *>(p_object);
|
|
||||||
} else {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -335,15 +335,8 @@ public:
|
||||||
|
|
||||||
~RID_Alloc() {
|
~RID_Alloc() {
|
||||||
if (alloc_count) {
|
if (alloc_count) {
|
||||||
if (description) {
|
print_error(vformat("ERROR: %d RID allocations of type '%s' were leaked at exit.",
|
||||||
print_error("ERROR: " + itos(alloc_count) + " RID allocations of type '" + description + "' were leaked at exit.");
|
alloc_count, description ? description : typeid(T).name()));
|
||||||
} else {
|
|
||||||
#ifdef NO_SAFE_CAST
|
|
||||||
print_error("ERROR: " + itos(alloc_count) + " RID allocations of type 'unknown' were leaked at exit.");
|
|
||||||
#else
|
|
||||||
print_error("ERROR: " + itos(alloc_count) + " RID allocations of type '" + typeid(T).name() + "' were leaked at exit.");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < max_alloc; i++) {
|
for (size_t i = 0; i < max_alloc; i++) {
|
||||||
uint64_t validator = validator_chunks[i / elements_in_chunk][i % elements_in_chunk];
|
uint64_t validator = validator_chunks[i / elements_in_chunk][i % elements_in_chunk];
|
||||||
|
|
|
@ -2036,11 +2036,7 @@ void Collada::_merge_skeletons(VisualScene *p_vscene, Node *p_node) {
|
||||||
|
|
||||||
ERR_CONTINUE(!state.scene_map.has(nodeid)); //weird, it should have it...
|
ERR_CONTINUE(!state.scene_map.has(nodeid)); //weird, it should have it...
|
||||||
|
|
||||||
#ifdef NO_SAFE_CAST
|
|
||||||
NodeJoint *nj = static_cast<NodeJoint *>(state.scene_map[nodeid]);
|
|
||||||
#else
|
|
||||||
NodeJoint *nj = dynamic_cast<NodeJoint *>(state.scene_map[nodeid]);
|
NodeJoint *nj = dynamic_cast<NodeJoint *>(state.scene_map[nodeid]);
|
||||||
#endif
|
|
||||||
ERR_CONTINUE(!nj); //broken collada
|
ERR_CONTINUE(!nj); //broken collada
|
||||||
ERR_CONTINUE(!nj->owner); //weird, node should have a skeleton owner
|
ERR_CONTINUE(!nj->owner); //weird, node should have a skeleton owner
|
||||||
|
|
||||||
|
@ -2197,11 +2193,7 @@ bool Collada::_move_geometry_to_skeletons(VisualScene *p_vscene, Node *p_node, L
|
||||||
String nodeid = ng->skeletons[0];
|
String nodeid = ng->skeletons[0];
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!state.scene_map.has(nodeid), false); //weird, it should have it...
|
ERR_FAIL_COND_V(!state.scene_map.has(nodeid), false); //weird, it should have it...
|
||||||
#ifdef NO_SAFE_CAST
|
|
||||||
NodeJoint *nj = static_cast<NodeJoint *>(state.scene_map[nodeid]);
|
|
||||||
#else
|
|
||||||
NodeJoint *nj = dynamic_cast<NodeJoint *>(state.scene_map[nodeid]);
|
NodeJoint *nj = dynamic_cast<NodeJoint *>(state.scene_map[nodeid]);
|
||||||
#endif
|
|
||||||
ERR_FAIL_COND_V(!nj, false);
|
ERR_FAIL_COND_V(!nj, false);
|
||||||
ERR_FAIL_COND_V(!nj->owner, false); //weird, node should have a skeleton owner
|
ERR_FAIL_COND_V(!nj->owner, false); //weird, node should have a skeleton owner
|
||||||
|
|
||||||
|
|
|
@ -48,20 +48,10 @@ class CSharpScript;
|
||||||
class CSharpInstance;
|
class CSharpInstance;
|
||||||
class CSharpLanguage;
|
class CSharpLanguage;
|
||||||
|
|
||||||
#ifdef NO_SAFE_CAST
|
|
||||||
template <typename TScriptInstance, typename TScriptLanguage>
|
|
||||||
TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
|
|
||||||
if (!p_inst) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return p_inst->get_language() == TScriptLanguage::get_singleton() ? static_cast<TScriptInstance *>(p_inst) : nullptr;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template <typename TScriptInstance, typename TScriptLanguage>
|
template <typename TScriptInstance, typename TScriptLanguage>
|
||||||
TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
|
TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
|
||||||
return dynamic_cast<TScriptInstance *>(p_inst);
|
return dynamic_cast<TScriptInstance *>(p_inst);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CAST_CSHARP_INSTANCE(m_inst) (cast_script_instance<CSharpInstance, CSharpLanguage>(m_inst))
|
#define CAST_CSHARP_INSTANCE(m_inst) (cast_script_instance<CSharpInstance, CSharpLanguage>(m_inst))
|
||||||
|
|
||||||
|
|
|
@ -156,15 +156,9 @@ def configure(env: "Environment"):
|
||||||
env["RANLIB"] = compiler_path + "/llvm-ranlib"
|
env["RANLIB"] = compiler_path + "/llvm-ranlib"
|
||||||
env["AS"] = compiler_path + "/clang"
|
env["AS"] = compiler_path + "/clang"
|
||||||
|
|
||||||
# Disable exceptions and rtti on non-tools (template) builds
|
# Disable exceptions on template builds
|
||||||
if env.editor_build:
|
if not env.editor_build:
|
||||||
env.Append(CXXFLAGS=["-frtti"])
|
env.Append(CXXFLAGS=["-fno-exceptions"])
|
||||||
elif env["builtin_icu"]:
|
|
||||||
env.Append(CXXFLAGS=["-frtti", "-fno-exceptions"])
|
|
||||||
else:
|
|
||||||
env.Append(CXXFLAGS=["-fno-rtti", "-fno-exceptions"])
|
|
||||||
# Don't use dynamic_cast, necessary with no-rtti.
|
|
||||||
env.Append(CPPDEFINES=["NO_SAFE_CAST"])
|
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
CCFLAGS=(
|
CCFLAGS=(
|
||||||
|
|
Loading…
Reference in a new issue