File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -634,6 +634,7 @@ if env["strict_checks"]:
634634
635635# Run SCU file generation script if in a SCU build.
636636if env ["scu_build" ]:
637+ env .Append (CPPDEFINES = ["SCU_BUILD_ENABLED" ])
637638 max_includes_per_scu = 8
638639 if env .dev_build :
639640 max_includes_per_scu = 1024
Original file line number Diff line number Diff line change 3030
3131#include " ustring.h"
3232
33+ STATIC_ASSERT_INCOMPLETE_TYPE (class , Dictionary);
34+
3335#include " core/crypto/crypto_core.h"
3436#include " core/math/color.h"
3537#include " core/math/math_funcs.h"
Original file line number Diff line number Diff line change @@ -439,3 +439,23 @@ inline constexpr bool is_zero_constructible_v = is_zero_constructible<T>::value;
439439#define GODOT_MSVC_WARNING_POP
440440#define GODOT_MSVC_WARNING_PUSH_AND_IGNORE (m_warning )
441441#endif
442+
443+ template <typename T, typename = void >
444+ struct is_fully_defined : std::false_type {};
445+
446+ template <typename T>
447+ struct is_fully_defined <T, std::void_t <decltype (sizeof (T))>> : std::true_type {};
448+
449+ template <typename T>
450+ constexpr bool is_fully_defined_v = is_fully_defined<T>::value;
451+
452+ #ifndef SCU_BUILD_ENABLED
453+ // / Enforces the requirement that a class is not fully defined.
454+ // / This can be used to reduce include coupling and keep compile times low.
455+ // / The check must be made at the top of the corresponding .cpp file of a header.
456+ #define STATIC_ASSERT_INCOMPLETE_TYPE (m_keyword, m_type ) \
457+ m_keyword m_type; \
458+ static_assert (!is_fully_defined_v<m_type>, #m_type " was unexpectedly fully defined. Please check the include hierarchy of '" __FILE__ " ' and remove includes that resolve the " #m_keyword " ." );
459+ #else
460+ #define STATIC_ASSERT_INCOMPLETE_TYPE (m_keyword, m_type )
461+ #endif
Original file line number Diff line number Diff line change 3030
3131#include " array.h"
3232
33+ STATIC_ASSERT_INCOMPLETE_TYPE (class , Dictionary);
34+ STATIC_ASSERT_INCOMPLETE_TYPE (class , String);
35+
3336#include " container_type_validate.h"
3437#include " core/math/math_funcs.h"
3538#include " core/object/script_language.h"
You can’t perform that action at this time.
0 commit comments