From 56ce6911eb5b10bba6869230541ef220b21ded4c Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 31 Mar 2025 12:55:17 +0200 Subject: [PATCH] Moved the static_assert in GLOBAL_CACHED to the top. --- core/config/project_settings.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/config/project_settings.h b/core/config/project_settings.h index c2336478c..ca44e0504 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -224,19 +224,19 @@ Variant _GLOBAL_DEF_ALIAS(const String &p_var, const String &p_old_name, const V #define GLOBAL_DEF_ALIAS_RST(m_var, m_old_name, m_value) _GLOBAL_DEF(m_var, m_old_name, m_value, true) #define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var) -#define GLOBAL_CACHED(m_name, m_type, m_setting_name) \ - static m_type m_name; \ - { \ - static_assert(HAS_TRIVIAL_DESTRUCTOR(m_type), "GLOBAL_CACHED must use a trivial type that allows static lifetime."); \ - static uint32_t local_version = 0; \ - static Mutex local_mutex; \ - uint32_t new_version = ProjectSettings::get_singleton()->get_version(); \ - if (local_version != new_version) { \ - local_mutex.lock(); \ - local_version = new_version; \ - m_name = ProjectSettings::get_singleton()->get(m_setting_name); \ - local_mutex.unlock(); \ - } \ +#define GLOBAL_CACHED(m_name, m_type, m_setting_name) \ + static_assert(HAS_TRIVIAL_DESTRUCTOR(m_type), "GLOBAL_CACHED must use a trivial type that allows static lifetime."); \ + static m_type m_name; \ + { \ + static uint32_t local_version = 0; \ + static Mutex local_mutex; \ + uint32_t new_version = ProjectSettings::get_singleton()->get_version(); \ + if (local_version != new_version) { \ + local_mutex.lock(); \ + local_version = new_version; \ + m_name = ProjectSettings::get_singleton()->get(m_setting_name); \ + local_mutex.unlock(); \ + } \ } #endif // PROJECT_SETTINGS_H