summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/core
diff options
context:
space:
mode:
authorAndy Maloney <asmaloney@gmail.com>2023-02-16 10:38:38 -0500
committerAndy Maloney <asmaloney@gmail.com>2023-06-15 20:45:01 -0400
commitdb2394dbe76e0df9ac6933c38af7e7635367ee7b (patch)
tree08d53ae511dd7f18f07cfd5920a5f699cb5e2143 /include/godot_cpp/core
parent1bc9ca7b57799dd03dcb65b4a5a178bf1176ebcf (diff)
downloadredot-cpp-db2394dbe76e0df9ac6933c38af7e7635367ee7b.tar.gz
Identifiers containing double underscore are reserved according to the C++ standard
Rename __* to _gde_* https://timsong-cpp.github.io/cppwp/n3337/global.names https://en.cppreference.com/w/cpp/language/identifiers Identifiers appearing as a token or preprocessing token (i.e., not in user-defined-string-literal like operator ""id) (since C++11) of one of the following forms are reserved: - identifiers with a double underscore anywhere; - identifiers that begin with an underscore followed by an uppercase letter; - in the global namespace, identifiers that begin with an underscore.
Diffstat (limited to 'include/godot_cpp/core')
-rw-r--r--include/godot_cpp/core/class_db.hpp22
-rw-r--r--include/godot_cpp/core/method_bind.hpp4
-rw-r--r--include/godot_cpp/core/type_info.hpp4
3 files changed, 15 insertions, 15 deletions
diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp
index 46fbd42..425d5a2 100644
--- a/include/godot_cpp/core/class_db.hpp
+++ b/include/godot_cpp/core/class_db.hpp
@@ -150,22 +150,22 @@ public:
godot::ClassDB::bind_integer_constant(get_class_static(), "", #m_constant, m_constant);
#define BIND_ENUM_CONSTANT(m_constant) \
- godot::ClassDB::bind_integer_constant(get_class_static(), godot::__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant);
+ godot::ClassDB::bind_integer_constant(get_class_static(), godot::_gde_constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant);
#define BIND_BITFIELD_FLAG(m_constant) \
- godot::ClassDB::bind_integer_constant(get_class_static(), godot::__constant_get_bitfield_name(m_constant, #m_constant), #m_constant, m_constant, true);
-
-#define BIND_VIRTUAL_METHOD(m_class, m_method) \
- { \
- auto ___call##m_method = [](GDExtensionObjectPtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr p_ret) -> void { \
- call_with_ptr_args(reinterpret_cast<m_class *>(p_instance), &m_class::m_method, p_args, p_ret); \
- }; \
- godot::ClassDB::bind_virtual_method(m_class::get_class_static(), #m_method, ___call##m_method); \
+ godot::ClassDB::bind_integer_constant(get_class_static(), godot::_gde_constant_get_bitfield_name(m_constant, #m_constant), #m_constant, m_constant, true);
+
+#define BIND_VIRTUAL_METHOD(m_class, m_method) \
+ { \
+ auto _call##m_method = [](GDExtensionObjectPtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr p_ret) -> void { \
+ call_with_ptr_args(reinterpret_cast<m_class *>(p_instance), &m_class::m_method, p_args, p_ret); \
+ }; \
+ godot::ClassDB::bind_virtual_method(m_class::get_class_static(), #m_method, _call##m_method); \
}
template <class T, bool is_abstract>
void ClassDB::_register_class(bool p_virtual) {
- instance_binding_callbacks[T::get_class_static()] = &T::___binding_callbacks;
+ instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
// Register this class within our plugin
ClassInfo cl;
@@ -221,7 +221,7 @@ void ClassDB::register_abstract_class() {
template <class T>
void ClassDB::register_engine_class() {
- instance_binding_callbacks[T::get_class_static()] = &T::___binding_callbacks;
+ instance_binding_callbacks[T::get_class_static()] = &T::_gde_binding_callbacks;
}
template <class N, class M, typename... VarArgs>
diff --git a/include/godot_cpp/core/method_bind.hpp b/include/godot_cpp/core/method_bind.hpp
index ae2142a..37ae731 100644
--- a/include/godot_cpp/core/method_bind.hpp
+++ b/include/godot_cpp/core/method_bind.hpp
@@ -268,8 +268,8 @@ MethodBind *create_vararg_method_bind(R (T::*p_method)(const Variant **, GDExten
}
#ifndef TYPED_METHOD_BIND
-class ___UnexistingClass;
-#define MB_T ___UnexistingClass
+class _gde_UnexistingClass;
+#define MB_T _gde_UnexistingClass
#else
#define MB_T T
#endif
diff --git a/include/godot_cpp/core/type_info.hpp b/include/godot_cpp/core/type_info.hpp
index 039cb2e..f0edda5 100644
--- a/include/godot_cpp/core/type_info.hpp
+++ b/include/godot_cpp/core/type_info.hpp
@@ -241,7 +241,7 @@ inline String enum_qualified_name_to_class_info_name(const String &p_qualified_n
TEMPL_MAKE_ENUM_TYPE_INFO(m_enum, const m_enum &)
template <typename T>
-inline StringName __constant_get_enum_name(T param, StringName p_constant) {
+inline StringName _gde_constant_get_enum_name(T param, StringName p_constant) {
if (GetTypeInfo<T>::VARIANT_TYPE == Variant::NIL) {
ERR_PRINT(("Missing VARIANT_ENUM_CAST for constant's enum: " + String(p_constant)).utf8().get_data());
}
@@ -288,7 +288,7 @@ public:
TEMPL_MAKE_BITFIELD_TYPE_INFO(m_enum, const m_enum &)
template <typename T>
-inline StringName __constant_get_bitfield_name(T param, StringName p_constant) {
+inline StringName _gde_constant_get_bitfield_name(T param, StringName p_constant) {
if (GetTypeInfo<T>::VARIANT_TYPE == Variant::NIL) {
ERR_PRINT(("Missing VARIANT_ENUM_CAST for constant's bitfield: " + String(p_constant)).utf8().get_data());
}