Fix missing namespaces in macros#1996
Conversation
Ivorforce
left a comment
There was a problem hiding this comment.
Makes sense, thanks for the fix!
|
Ah, it looks like this is failing CI for some code style issues which would be fixed by this patch: diff --git a/include/godot_cpp/templates/safe_refcount.hpp b/include/godot_cpp/templates/safe_refcount.hpp
index 42b3b77..8dd97c3 100644
--- a/include/godot_cpp/templates/safe_refcount.hpp
+++ b/include/godot_cpp/templates/safe_refcount.hpp
@@ -48,11 +48,11 @@ namespace godot {
// even with threads that are already running.
// These are used in very specific areas of the engine where it's critical that these guarantees are held
-#define SAFE_NUMERIC_TYPE_PUN_GUARANTEES(m_type) \
+#define SAFE_NUMERIC_TYPE_PUN_GUARANTEES(m_type) \
static_assert(sizeof(::godot::SafeNumeric<m_type>) == sizeof(m_type)); \
static_assert(alignof(::godot::SafeNumeric<m_type>) == alignof(m_type)); \
static_assert(std::is_trivially_destructible_v<std::atomic<m_type>>);
-#define SAFE_FLAG_TYPE_PUN_GUARANTEES \
+#define SAFE_FLAG_TYPE_PUN_GUARANTEES \
static_assert(sizeof(::godot::SafeFlag) == sizeof(bool)); \ |
Reminds me: We should probably follow suit with godot (godotengine/godot#112381) |
Changed some macros to use the full (`::godot::*`) namespace path to method calls and class names.
|
Should be fixed now (and I figured out how to run the checks on my branch, so it should actually work this time, sorry about that). I'm also still relatively new to Git / Github, and I'm not sure if you got spammed with email notifications from me trying to fix the commit, I'm really sorry if you did. |
|
Thanks!
No worries :-) |
Changed the method call to
memnew_arr_templatein thememnew_arrand the classes in the size validation macros forSafeNumericandSafeFlagto use the full namespace path to their corresponding method / class. This ensures that if anyone is using these macros in their own code and they don't useusing namespace godot;in their code, these macros will still compile.memnew_arrwas the issue I initially ran into, and I came across theSafeNumericandSafeFlagmacros while checking to see if any other macros had this problem. I also found theMAKE_TYPE_INFO*macros in type_info.hpp, as well asMAKE_TYPED_ARRAYandMAKE_TYPED_DICTIONARY*in typed_array.hpp and typed_dictionary.hpp respectively, however, these seemed to be internal macros only, so I've left them untouched since I didn't think anyone would be using these in their own projects (I thought that it might be possible for theSafeNumericandSafeFlagmacros to appear in other projects though, which is why I included them).