1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Optimize Object::cast_to by assuming no virtual and multiple inheritance, gaining 8x throughput over dynamic_cast.

Add `-Wvirtual-inheritance` to compiler warnings as a sanity check.
This commit is contained in:
Lukas Tenbrink
2025-03-27 15:39:53 +01:00
parent 594d64ec24
commit dd9dc75a83
3 changed files with 33 additions and 3 deletions

View File

@@ -860,7 +860,12 @@ else: # GCC, Clang
common_warnings = []
if methods.using_gcc(env):
common_warnings += ["-Wshadow", "-Wno-misleading-indentation"]
common_warnings += [
"-Wshadow",
"-Wno-misleading-indentation",
# For optimized Object::cast_to / object.inherits_from()
"-Wvirtual-inheritance",
]
if cc_version_major < 11:
# Regression in GCC 9/10, spams so much in our variadic templates
# that we need to outright disable it.