diff options
Diffstat (limited to 'core/object/object.cpp')
-rw-r--r-- | core/object/object.cpp | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp index 57f8766509..97a3a405b9 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -31,7 +31,6 @@ #include "object.h" #include "object.compat.inc" -#include "core/core_string_names.h" #include "core/extension/gdextension_manager.h" #include "core/io/resource.h" #include "core/object/class_db.h" @@ -237,20 +236,12 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid } if (_extension && _extension->set) { -// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it. -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wignored-qualifiers" -#endif - if (_extension->set(_extension_instance, (const GDExtensionStringNamePtr)&p_name, (const GDExtensionVariantPtr)&p_value)) { + if (_extension->set(_extension_instance, (GDExtensionConstStringNamePtr)&p_name, (GDExtensionConstVariantPtr)&p_value)) { if (r_valid) { *r_valid = true; } return; } -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic pop -#endif } // Try built-in setter. @@ -324,21 +315,12 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const { } } if (_extension && _extension->get) { -// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it. -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wignored-qualifiers" -#endif - - if (_extension->get(_extension_instance, (const GDExtensionStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) { + if (_extension->get(_extension_instance, (GDExtensionConstStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) { if (r_valid) { *r_valid = true; } return ret; } -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic pop -#endif } // Try built-in getter. @@ -576,19 +558,11 @@ bool Object::property_can_revert(const StringName &p_name) const { } } -// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it. -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wignored-qualifiers" -#endif if (_extension && _extension->property_can_revert) { - if (_extension->property_can_revert(_extension_instance, (const GDExtensionStringNamePtr)&p_name)) { + if (_extension->property_can_revert(_extension_instance, (GDExtensionConstStringNamePtr)&p_name)) { return true; } } -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic pop -#endif return _property_can_revertv(p_name); } @@ -602,19 +576,11 @@ Variant Object::property_get_revert(const StringName &p_name) const { } } -// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it. -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wignored-qualifiers" -#endif if (_extension && _extension->property_get_revert) { - if (_extension->property_get_revert(_extension_instance, (const GDExtensionStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) { + if (_extension->property_get_revert(_extension_instance, (GDExtensionConstStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) { return ret; } } -#if defined(__GNUC__) && !defined(__clang__) -#pragma GCC diagnostic pop -#endif if (_property_get_revertv(p_name, ret)) { return ret; @@ -924,6 +890,7 @@ void Object::notification(int p_notification, bool p_reversed) { } String Object::to_string() { + // Keep this method in sync with `Node::to_string`. if (script_instance) { bool valid; String ret = script_instance->to_string(&valid); |